summaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_selftest.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2013-01-22 19:35:11 +0100
committerSteven Rostedt <rostedt@goodmis.org>2013-01-23 05:33:07 +0100
commit34600f0e9c33c9cd48ae87448205f51332b7d5a0 (patch)
treefb6159552edf55526219b4c4c55f6120595be53e /kernel/trace/trace_selftest.c
parenttracing: Remove trace.h header from trace_clock.c (diff)
downloadlinux-34600f0e9c33c9cd48ae87448205f51332b7d5a0.tar.xz
linux-34600f0e9c33c9cd48ae87448205f51332b7d5a0.zip
tracing: Fix race with max_tr and changing tracers
There's a race condition between the setting of a new tracer and the update of the max trace buffers (the swap). When a new tracer is added, it sets current_trace to nop_trace before disabling the old tracer. At this moment, if the old tracer uses update_max_tr(), the update may trigger the warning against !current_trace->use_max-tr, as nop_trace doesn't have that set. As update_max_tr() requires that interrupts be disabled, we can add a check to see if current_trace == nop_trace and bail if it does. Then when disabling the current_trace, set it to nop_trace and run synchronize_sched(). This will make sure all calls to update_max_tr() have completed (it was called with interrupts disabled). As a clean up, this commit also removes shrinking and recreating the max_tr buffer if the old and new tracers both have use_max_tr set. The old way use to always shrink the buffer, and then expand it for the next tracer. This is a waste of time. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_selftest.c')
0 files changed, 0 insertions, 0 deletions