Commit 34600f0
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>1 parent 0a71e4c commit 34600f0
1 file changed
+22
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
712 | | - | |
713 | | - | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
714 | 715 | | |
715 | | - | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
716 | 720 | | |
717 | 721 | | |
718 | 722 | | |
| |||
3185 | 3189 | | |
3186 | 3190 | | |
3187 | 3191 | | |
| 3192 | + | |
3188 | 3193 | | |
3189 | 3194 | | |
3190 | 3195 | | |
| |||
3211 | 3216 | | |
3212 | 3217 | | |
3213 | 3218 | | |
3214 | | - | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
3215 | 3232 | | |
3216 | 3233 | | |
3217 | 3234 | | |
| |||
3222 | 3239 | | |
3223 | 3240 | | |
3224 | 3241 | | |
3225 | | - | |
3226 | | - | |
3227 | 3242 | | |
3228 | | - | |
| 3243 | + | |
3229 | 3244 | | |
3230 | 3245 | | |
3231 | 3246 | | |
| |||
0 commit comments