diff mbox series

[4/5] tracing/hwlat: Fix a race during cpuhp processing

Message ID 20240924094515.3561410-5-liwei391@huawei.com (mailing list archive)
State Accepted
Commit 2a13ca2e8abb12ee43ada8a107dadca83f140937
Headers show
Series tracing: Fix several deadlock/race issues in timerlat and hwlat tracer | expand

Commit Message

Wei Li Sept. 24, 2024, 9:45 a.m. UTC
The cpuhp online/offline processing race also exists in percpu-mode hwlat
tracer in theory, apply the fix too.

Fixes: ba998f7d9531 ("trace/hwlat: Support hotplug operations")
Signed-off-by: Wei Li <liwei391@huawei.com>
---
 kernel/trace/trace_hwlat.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
index b791524a6536..3bd6071441ad 100644
--- a/kernel/trace/trace_hwlat.c
+++ b/kernel/trace/trace_hwlat.c
@@ -520,6 +520,8 @@  static void hwlat_hotplug_workfn(struct work_struct *dummy)
 	if (!hwlat_busy || hwlat_data.thread_mode != MODE_PER_CPU)
 		goto out_unlock;
 
+	if (!cpu_online(cpu))
+		goto out_unlock;
 	if (!cpumask_test_cpu(cpu, tr->tracing_cpumask))
 		goto out_unlock;