mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 12:03:54 +02:00
tracing: Use tracer_tracing_disable() instead of "disabled" field for ftrace_dump_one()
The per CPU "disabled" value was the original way to disable tracing when the tracing subsystem was first created. Today, the ring buffer infrastructure has its own way to disable tracing. In fact, things have changed so much since 2008 that many things ignore the disable flag. The ftrace_dump_one() function iterates over all the current tracing CPUs and increments the "disabled" counter before doing the dump, and decrements it afterward. As the disabled flag can be ignored, doing this today is not reliable. Instead use the new tracer_tracing_disable() that calls into the ring buffer code to do the disabling. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andrew Morton <akpm@linux-foundation.org> Link: https://lore.kernel.org/20250505212235.381188238@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
dbecef68ad
commit
6ba3e0533f
|
|
@ -10484,7 +10484,7 @@ static void ftrace_dump_one(struct trace_array *tr, enum ftrace_dump_mode dump_m
|
|||
static struct trace_iterator iter;
|
||||
unsigned int old_userobj;
|
||||
unsigned long flags;
|
||||
int cnt = 0, cpu;
|
||||
int cnt = 0;
|
||||
|
||||
/*
|
||||
* Always turn off tracing when we dump.
|
||||
|
|
@ -10501,9 +10501,8 @@ static void ftrace_dump_one(struct trace_array *tr, enum ftrace_dump_mode dump_m
|
|||
/* Simulate the iterator */
|
||||
trace_init_iter(&iter, tr);
|
||||
|
||||
for_each_tracing_cpu(cpu) {
|
||||
atomic_inc(&per_cpu_ptr(iter.array_buffer->data, cpu)->disabled);
|
||||
}
|
||||
/* While dumping, do not allow the buffer to be enable */
|
||||
tracer_tracing_disable(tr);
|
||||
|
||||
old_userobj = tr->trace_flags & TRACE_ITER_SYM_USEROBJ;
|
||||
|
||||
|
|
@ -10562,9 +10561,7 @@ static void ftrace_dump_one(struct trace_array *tr, enum ftrace_dump_mode dump_m
|
|||
|
||||
tr->trace_flags |= old_userobj;
|
||||
|
||||
for_each_tracing_cpu(cpu) {
|
||||
atomic_dec(&per_cpu_ptr(iter.array_buffer->data, cpu)->disabled);
|
||||
}
|
||||
tracer_tracing_enable(tr);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user