Skip to content

Commit a9839d2

Browse files
committed
tracing: kdb: Use tracer_tracing_on/off() instead of setting per CPU disabled
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 kdb_ftdump() 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, simply call tracer_tracing_off() and then tracer_tracing_on() to disable and then enabled the entire ring buffer in one go! Cc: Jason Wessel <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Daniel Thompson <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 6ba3e05 commit a9839d2

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

kernel/trace/trace_kdb.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ static int kdb_ftdump(int argc, const char **argv)
9898
long cpu_file;
9999
int err;
100100
int cnt;
101-
int cpu;
102101

103102
if (argc > 2)
104103
return KDB_ARGCOUNT;
@@ -120,9 +119,7 @@ static int kdb_ftdump(int argc, const char **argv)
120119
trace_init_global_iter(&iter);
121120
iter.buffer_iter = buffer_iter;
122121

123-
for_each_tracing_cpu(cpu) {
124-
atomic_inc(&per_cpu_ptr(iter.array_buffer->data, cpu)->disabled);
125-
}
122+
tracer_tracing_disable(iter.tr);
126123

127124
/* A negative skip_entries means skip all but the last entries */
128125
if (skip_entries < 0) {
@@ -135,9 +132,7 @@ static int kdb_ftdump(int argc, const char **argv)
135132

136133
ftrace_dump_buf(skip_entries, cpu_file);
137134

138-
for_each_tracing_cpu(cpu) {
139-
atomic_dec(&per_cpu_ptr(iter.array_buffer->data, cpu)->disabled);
140-
}
135+
tracer_tracing_enable(iter.tr);
141136

142137
kdb_trap_printk--;
143138

0 commit comments

Comments
 (0)