mbox series

[v2,0/2] tracing: Fix deadlock in hwlat tracer

Message ID 20241121021823.1237741-1-liwei391@huawei.com (mailing list archive)
Headers show
Series tracing: Fix deadlock in hwlat tracer | expand

Message

Wei Li Nov. 21, 2024, 2:18 a.m. UTC
This patchset fixes a deadlock issue found in concurrent CPU-hotplug and
tracer-toggling testing:

Background: *test_hotplug.sh*
```
#!/bin/sh

while true
do
	echo 0 > /sys/devices/system/cpu/cpu1/online
	echo 1 > /sys/devices/system/cpu/cpu1/online
done
```

Test: *test_hwlat.sh*
```
#!/bin/sh

echo per-cpu > /sys/kernel/debug/tracing/hwlat_detector/mode
while true
do
	echo hwlat > /sys/kernel/debug/tracing/current_tracer
	echo nop > /sys/kernel/debug/tracing/current_tracer
done
```

v1 -> v2:
 - The previous solution try to make the mutex obtaining in kthread_fn()
 interruptible to fix this issue. To make the logic clearer, change to
 remove the mutex_lock in this version. 

Links:
 v1: https://lore.kernel.org/linux-trace-kernel/20240924094515.3561410-6-liwei391@huawei.com/

Wei Li (2):
  tracing: Allow custom read/write processing in
    trace_min_max_{write,read}()
  tracing/hwlat: Fix deadlock in cpuhp processing

 kernel/trace/trace.c       | 13 ++++++++++---
 kernel/trace/trace.h       |  2 ++
 kernel/trace/trace_hwlat.c | 15 +++++++++++----
 3 files changed, 23 insertions(+), 7 deletions(-)