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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In preparation to the hotplug support on tracers with workload,
protect tr->tracing_cpumask with get/put_online_cpus() to avoid
concurrency with hotplug operations.

Cc: Jonathan Corbet <corbet@xxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Alexandre Chartre <alexandre.chartre@xxxxxxxxxx>
Cc: Clark Willaims <williams@xxxxxxxxxx>
Cc: John Kacur <jkacur@xxxxxxxxxx>
Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: x86@xxxxxxxxxx
Cc: linux-doc@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
---
 kernel/trace/trace.c | 6 ++++++
 1 file changed, 6 insertions(+)

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;
 }
-- 
2.31.1




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux