LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()
@ 2021-08-31  2:29 qiang.zhang
  2021-09-07  1:29 ` Zhang, Qiang
  2021-09-08  1:17 ` Steven Rostedt
  0 siblings, 2 replies; 6+ messages in thread
From: qiang.zhang @ 2021-08-31  2:29 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.

Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations")
Cc: <stable@vger.kernel.org> # v5.14+
Signed-off-by: Qiang.Zhang <qiang.zhang@windriver.com>
---
 v1->v2:
 Modify submission information and code style, add tags.

 kernel/trace/trace_osnoise.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 65b08b8e5bf8..ce053619f289 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1548,7 +1548,7 @@ static int start_kthread(unsigned int cpu)
 static int start_per_cpu_kthreads(struct trace_array *tr)
 {
 	struct cpumask *current_mask = &save_cpumask;
-	int retval;
+	int retval = 0;
 	int cpu;
 
 	cpus_read_lock();
@@ -1568,13 +1568,13 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
 		retval = start_kthread(cpu);
 		if (retval) {
 			stop_per_cpu_kthreads();
-			return retval;
+			break;
 		}
 	}
 
 	cpus_read_unlock();
 
-	return 0;
+	return retval;
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-- 
2.17.1


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

* Re: [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()
  2021-08-31  2:29 [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads() qiang.zhang
@ 2021-09-07  1:29 ` Zhang, Qiang
  2021-09-08  1:17 ` Steven Rostedt
  1 sibling, 0 replies; 6+ messages in thread
From: Zhang, Qiang @ 2021-09-07  1:29 UTC (permalink / raw)
  To: bristot, rostedt, bristot, mingo; +Cc: linux-kernel

Hi  Daniel

Do you have time to review this modification?

Thanks
Qiang.zhang 

________________________________________
From: Zhang, Qiang <qiang.zhang@windriver.com>
Sent: Tuesday, 31 August 2021 10:28
To: bristot@redhat.com; rostedt@goodmis.org; bristot@kernel.org; mingo@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()

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

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

Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations")
Cc: <stable@vger.kernel.org> # v5.14+
Signed-off-by: Qiang.Zhang <qiang.zhang@windriver.com>
---
 v1->v2:
 Modify submission information and code style, add tags.

 kernel/trace/trace_osnoise.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 65b08b8e5bf8..ce053619f289 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1548,7 +1548,7 @@ static int start_kthread(unsigned int cpu)
 static int start_per_cpu_kthreads(struct trace_array *tr)
 {
        struct cpumask *current_mask = &save_cpumask;
-       int retval;
+       int retval = 0;
        int cpu;

        cpus_read_lock();
@@ -1568,13 +1568,13 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
                retval = start_kthread(cpu);
                if (retval) {
                        stop_per_cpu_kthreads();
-                       return retval;
+                       break;
                }
        }

        cpus_read_unlock();

-       return 0;
+       return retval;
 }

 #ifdef CONFIG_HOTPLUG_CPU
--
2.17.1


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

* Re: [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()
  2021-08-31  2:29 [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads() qiang.zhang
  2021-09-07  1:29 ` Zhang, Qiang
@ 2021-09-08  1:17 ` Steven Rostedt
  2021-09-08  2:34   ` Zhang, Qiang
  1 sibling, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2021-09-08  1:17 UTC (permalink / raw)
  To: qiang.zhang; +Cc: bristot, bristot, mingo, linux-kernel

On Tue, 31 Aug 2021 10:29:19 +0800
qiang.zhang@windriver.com wrote:

> From: "Qiang.Zhang" <qiang.zhang@windriver.com>
> 
> When start_kthread() return error, the cpus_read_unlock() need
> to be called.
> 
> Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations")
> Cc: <stable@vger.kernel.org> # v5.14+

FYI, no need to add the "# v5.14+", as it also breaks my scripts. The
"Fixes:" tag is now used to know what stable releases it needs to be
applied to (if any).

Daniel, that goes for you too, as you suggested it ;-)

-- Steve

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

* Re: [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()
  2021-09-08  1:17 ` Steven Rostedt
@ 2021-09-08  2:34   ` Zhang, Qiang
  2021-09-08  2:55     ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Qiang @ 2021-09-08  2:34 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: bristot, bristot, mingo, linux-kernel



________________________________________
From: Steven Rostedt <rostedt@goodmis.org>
Sent: Wednesday, 8 September 2021 09:17
To: Zhang, Qiang
Cc: bristot@redhat.com; bristot@kernel.org; mingo@redhat.com; linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()

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

On Tue, 31 Aug 2021 10:29:19 +0800
qiang.zhang@windriver.com wrote:

> From: "Qiang.Zhang" <qiang.zhang@windriver.com>
>
> When start_kthread() return error, the cpus_read_unlock() need
> to be called.
>
> Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations")
> Cc: <stable@vger.kernel.org> # v5.14+

>FYI, no need to add the "# v5.14+", as it also breaks my scripts. The
>"Fixes:" tag is now used to know what stable releases it needs to be
>applied to (if any).
>
Thanks Steve
I will resend v3.
 

>Daniel, that goes for you too, as you suggested it ;-)
>
>-- Steve

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

* Re: [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()
  2021-09-08  2:34   ` Zhang, Qiang
@ 2021-09-08  2:55     ` Steven Rostedt
  2021-09-08 10:15       ` Daniel Bristot de Oliveira
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2021-09-08  2:55 UTC (permalink / raw)
  To: Zhang, Qiang; +Cc: bristot, bristot, mingo, linux-kernel

On Wed, 8 Sep 2021 02:34:46 +0000
"Zhang, Qiang" <Qiang.Zhang@windriver.com> wrote:

> >FYI, no need to add the "# v5.14+", as it also breaks my scripts. The
> >"Fixes:" tag is now used to know what stable releases it needs to be
> >applied to (if any).
> >  
> Thanks Steve
> I will resend v3.
>  

No need. I fixed it. I'll add Daniel's reviewed by if he gives one.

I'm currently running it through my test suite (with several other patches).

-- Steve

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

* Re: [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()
  2021-09-08  2:55     ` Steven Rostedt
@ 2021-09-08 10:15       ` Daniel Bristot de Oliveira
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Bristot de Oliveira @ 2021-09-08 10:15 UTC (permalink / raw)
  To: Steven Rostedt, Zhang, Qiang; +Cc: bristot, mingo, linux-kernel

On 9/8/21 4:55 AM, Steven Rostedt wrote:
> On Wed, 8 Sep 2021 02:34:46 +0000
> "Zhang, Qiang" <Qiang.Zhang@windriver.com> wrote:
> 
>>> FYI, no need to add the "# v5.14+", as it also breaks my scripts. The
>>> "Fixes:" tag is now used to know what stable releases it needs to be
>>> applied to (if any).
>>>  
>> Thanks Steve
>> I will resend v3.
>>  
> 
> No need. I fixed it. I'll add Daniel's reviewed by if he gives one.

Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>

-- Daniel

> I'm currently running it through my test suite (with several other patches).
> 
> -- Steve
> 


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

end of thread, other threads:[~2021-09-08 10:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31  2:29 [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads() qiang.zhang
2021-09-07  1:29 ` Zhang, Qiang
2021-09-08  1:17 ` Steven Rostedt
2021-09-08  2:34   ` Zhang, Qiang
2021-09-08  2:55     ` Steven Rostedt
2021-09-08 10:15       ` Daniel Bristot de Oliveira

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).