Skip to content

Commit 79250de

Browse files
stkidgregkh
authored andcommitted
tracing/hwlat: Fix a race during cpuhp processing
commit 2a13ca2 upstream. The cpuhp online/offline processing race also exists in percpu-mode hwlat tracer in theory, apply the fix too. That is: T1 | T2 [CPUHP_ONLINE] | cpu_device_down() hwlat_hotplug_workfn() | | cpus_write_lock() | takedown_cpu(1) | cpus_write_unlock() [CPUHP_OFFLINE] | cpus_read_lock() | start_kthread(1) | cpus_read_unlock() | Cc: [email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: ba998f7 ("trace/hwlat: Support hotplug operations") Signed-off-by: Wei Li <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b8c118c commit 79250de

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/trace/trace_hwlat.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,8 @@ static void hwlat_hotplug_workfn(struct work_struct *dummy)
520520
if (!hwlat_busy || hwlat_data.thread_mode != MODE_PER_CPU)
521521
goto out_unlock;
522522

523+
if (!cpu_online(cpu))
524+
goto out_unlock;
523525
if (!cpumask_test_cpu(cpu, tr->tracing_cpumask))
524526
goto out_unlock;
525527

0 commit comments

Comments
 (0)