Skip to contentSkip to conversation

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

PATCH In review [email protected] 3 participants 6 messages Aug 31, 2021 – Sep 8, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()

From: "Qiang.Zhang" <[email protected]>

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

Fixes c8895e271f79 ("trace/osnoise: Support hotplug operations")
Cc <[email protected]> # v5.14+

---
v1->v2:
Modify submission information and code style, add tags.

 kernel/trace/trace_osnoise.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace_osnoise.c +3 -3
index 65b08b8e5bf8..ce053619f289 100644
@@ -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
Signature · 1 line
2.17.1
#1 lore raw

Hi Daniel

Do you have time to review this modification?

Thanks
Qiang.zhang

________________________________________
From: Zhang, Qiang <[email protected]>
Sent: Tuesday, 31 August 2021 10:28
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]
Subject: [PATCH v2] trace/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()

From: "Qiang.Zhang" <[email protected]>

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

Fixes c8895e271f79 ("trace/osnoise: Support hotplug operations")
Cc <[email protected]> # v5.14+

---
v1->v2:
Modify submission information and code style, add tags.

 kernel/trace/trace_osnoise.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace_osnoise.c +3 -3
index 65b08b8e5bf8..ce053619f289 100644
@@ -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

maintainer
#2 lore raw
In reply to [email protected]
Quoted 7 lines · On Tue, 31 Aug 2021 10:29:19 +0800 [email protected] wrote:

From: "Qiang.Zhang" <[email protected]>

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

Fixes c8895e271f79 ("trace/osnoise: Support hotplug operations")
Cc <[email protected]> # 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

#3 lore raw

________________________________________
From: Steven Rostedt <[email protected]>
Sent: Wednesday, 8 September 2021 09:17
To: Zhang, Qiang
Cc: [email protected]; [email protected]; [email protected]; [email protected]
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]

Quoted 5 lines · On Tue, 31 Aug 2021 10:29:19 +0800 [email protected] wrote:

From: "Qiang.Zhang" <[email protected]>

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

Quoted 7 lines
Fixes c8895e271f79 ("trace/osnoise: Support hotplug operations")
Cc <[email protected]> # 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.

Quoted 3 lines

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

-- Steve

maintainer
#4 lore raw
Quoted 7 lines · Qiang
Quoted 4 lines

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

#5 lore raw
Quoted 7 lines · Steven Rostedt
Quoted 4 lines · Qiang
Quoted 4 lines

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

Quoted 5 lines
Quoted 3 lines

Thanks Steve
I will resend v3.

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

-- Daniel

Quoted 4 lines

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

-- Steve