LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] trace/osnoise: fix missed cpus_read_unlock()
@ 2021-08-29  5:52 qiang.zhang
  2021-08-30 17:26 ` Daniel Bristot de Oliveira
  0 siblings, 1 reply; 3+ messages in thread
From: qiang.zhang @ 2021-08-29  5:52 UTC (permalink / raw)
  To: bristot, rostedt, bristot, mingo; +Cc: linux-kernel

From: "Qiang.zhang" <qiang.zhang@windriver.com>

When start_kthread() return error, the cpus_read_unlock() need
to be called.

Signed-off-by: Qiang.zhang <qiang.zhang@windriver.com>
---
 kernel/trace/trace_osnoise.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 65b08b8e5bf8..45d22d6f3acb 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1568,6 +1568,7 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
 		retval = start_kthread(cpu);
 		if (retval) {
 			stop_per_cpu_kthreads();
+			cpus_read_unlock();
 			return retval;
 		}
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] trace/osnoise: fix missed cpus_read_unlock()
  2021-08-29  5:52 [PATCH] trace/osnoise: fix missed cpus_read_unlock() qiang.zhang
@ 2021-08-30 17:26 ` Daniel Bristot de Oliveira
  2021-08-31  1:47   ` Zhang, Qiang
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Bristot de Oliveira @ 2021-08-30 17:26 UTC (permalink / raw)
  To: qiang.zhang, rostedt, bristot, mingo; +Cc: linux-kernel

Hi Qiang,

On 8/29/21 7:52 AM, qiang.zhang@windriver.com wrote:
> From: "Qiang.zhang" <qiang.zhang@windriver.com>
set the Subject to:

trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()

> 
> When start_kthread() return error, the cpus_read_unlock() need
> to be called.
> 
> Signed-off-by: Qiang.zhang <qiang.zhang@windriver.com>

Add:

Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations")
Cc: <stable@vger.kernel.org> # v5.14+

> ---
>  kernel/trace/trace_osnoise.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> index 65b08b8e5bf8..45d22d6f3acb 100644
> --- a/kernel/trace/trace_osnoise.c
> +++ b/kernel/trace/trace_osnoise.c
> @@ -1568,6 +1568,7 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
>  		retval = start_kthread(cpu);
>  		if (retval) {
>  			stop_per_cpu_kthreads();
> +			cpus_read_unlock();
>  			return retval;
>  		}
>  	}

Why not initialize retval = 0, and then remove the "return retval" from this if,
returning rteval at the end of the function?

-- Daniel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] trace/osnoise: fix missed cpus_read_unlock()
  2021-08-30 17:26 ` Daniel Bristot de Oliveira
@ 2021-08-31  1:47   ` Zhang, Qiang
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qiang @ 2021-08-31  1:47 UTC (permalink / raw)
  To: Daniel Bristot de Oliveira, rostedt, bristot, mingo; +Cc: linux-kernel



________________________________________
From: Daniel Bristot de Oliveira <bristot@redhat.com>
Sent: Tuesday, 31 August 2021 01:26
To: Zhang, Qiang; rostedt@goodmis.org; bristot@kernel.org; mingo@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] trace/osnoise: fix missed cpus_read_unlock()

[Please note: This e-mail is from an EXTERNAL e-mail address]

>Hi Qiang,
>
>On 8/29/21 7:52 AM, qiang.zhang@windriver.com wrote:
> From: "Qiang.zhang" <qiang.zhang@windriver.com>
>set the Subject to:

>trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()
>
>
> When start_kthread() return error, the cpus_read_unlock() need
> to be called.
>
> Signed-off-by: Qiang.zhang <qiang.zhang@windriver.com>

>Add:
>
>Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations")
>Cc: <stable@vger.kernel.org> # v5.14+
>
> ---
>  kernel/trace/trace_osnoise.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> index 65b08b8e5bf8..45d22d6f3acb 100644
> --- a/kernel/trace/trace_osnoise.c
> +++ b/kernel/trace/trace_osnoise.c
> @@ -1568,6 +1568,7 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
>               retval = start_kthread(cpu);
>               if (retval) {
>                       stop_per_cpu_kthreads();
> +                     cpus_read_unlock();
>                       return retval;
>               }
>       }
>
>Why not initialize retval = 0, and then remove the "return retval" from this if,
>returning rteval at the end of the function?
>

Thank you for your suggestion. I'll modify it and resend it. 

Qiang.zhang

>-- Daniel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-31  1:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-29  5:52 [PATCH] trace/osnoise: fix missed cpus_read_unlock() qiang.zhang
2021-08-30 17:26 ` Daniel Bristot de Oliveira
2021-08-31  1:47   ` Zhang, Qiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).