Re: [PATCH V5 12/14] trace: Protect tr->tracing_cpumask with get/put_online_cpus

From
Daniel Bristot de Oliveira <hidden>
Date
2021-06-25 04:34:51
Also in
lkml
Reply to
Steven Rostedt, 2021-06-24
On 6/24/21 11:39 PM, Steven Rostedt wrote:
On Tue, 22 Jun 2021 16:42:30 +0200
Daniel Bristot de Oliveira [off-list ref] wrote:
quoted
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 52fc9438b7b4..c14f33db147e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5053,7 +5053,13 @@ int tracing_set_cpumask(struct trace_array *tr,
 	arch_spin_unlock(&tr->max_lock);
 	local_irq_enable();
 
+	/*
+	 * tracing_cpumask is read by tracers that support CPU
+	 * hotplug.
+	 */
+	get_online_cpus();
 	cpumask_copy(tr->tracing_cpumask, tracing_cpumask_new);
+	put_online_cpus();
 
 	return 0;
Hmm, the tracing_cpumask is only touched in he work function, with the
necessary locks. How is get_online_cpus() protecting it here?

That is, tracing_cpumask isn't touched in the path of bringing up or
taking down a CPU, and shouldn't be an issue here.
You are right, it is not needed with the new hotplug method.
Should I just drop this patch?
Yes! drop it.

Thanks Steven!
-- Daniel
-- Steve
  
Thread (19 messages) 19 messages, 4 authors, last reply 2021-06-25
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help