Skip to contentSkip to conversation

trace/osnoise: fix missed cpus_read_unlock()

PATCH Superseded [email protected] 2 participants 3 messages Aug 29, 2021 – Aug 31, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace/osnoise: fix missed cpus_read_unlock()

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

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

---
 kernel/trace/trace_osnoise.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_osnoise.c +1 -0
index 65b08b8e5bf8..45d22d6f3acb 100644
@@ -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;
 		}
 	}
Signature · 1 line
2.25.1
#1 lore raw

Hi Qiang,

Quoted 1 line · On 8/29/21 7:52 AM, [email protected] wrote:

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

set the Subject to:

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

Quoted 5 lines

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

Add:

Fixes c8895e271f79 ("trace/osnoise: Support hotplug operations")
Cc <[email protected]> # v5.14+
Quoted 9 lines
---
 kernel/trace/trace_osnoise.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_osnoise.c +0 -0
index 65b08b8e5bf8..45d22d6f3acb 100644

kernel/trace/trace_osnoise.c static int start_per_cpu_kthreads(struct trace_array *tr) · line 1574

Quoted 7 lines
kernel/trace/trace_osnoise.c +1 -0
@@ -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

#2 lore raw

________________________________________
From: Daniel Bristot de Oliveira <[email protected]>
Sent: Tuesday, 31 August 2021 01:26
To: Zhang, Qiang; [email protected]; [email protected]; [email protected]
Cc: [email protected]
Subject: Re: [PATCH] trace/osnoise: fix missed cpus_read_unlock()

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

Quoted 36 lines

Hi Qiang,

On 8/29/21 7:52 AM, [email protected] wrote:
From: "Qiang.zhang" <[email protected]> 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.

Add:

Fixes c8895e271f79 ("trace/osnoise: Support hotplug operations")
Cc <[email protected]> # v5.14+
---
 kernel/trace/trace_osnoise.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_osnoise.c +1 -0
index 65b08b8e5bf8..45d22d6f3acb 100644
@@ -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;
              }
      }
Quoted 3 lines

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

Quoted 1 line

-- Daniel