History

tracing/hwlat: Fix a race during cpuhp processing

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() |

Wei Li committed 2 years ago

Commit 2a13ca21 parent 829e0c91 file · +2 −0Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/trace/trace_hwlat.c+2−0
@@ -520,6 +520,8 @@ static void hwlat_hotplug_workfn(struct work_struct *dummy) · 519 unmodified lines
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