Skip to content

tracing: Remove most uses of "disabled" field

Steven Rostedt linux-trace-kernel lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 0 repliesNew
  2. v112 patches 2 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13tracing/mmiotrace: Remove reference to unused per CPU data pointerkernel/trace/trace_mmiotrace.c+2 -100 replies
2/13ftrace: Do not bother checking per CPU "disabled" flagkernel/trace/trace_functions.c+3 -130 replies
3/13tracing: Just use this_cpu_read() to access ignore_pidkernel/trace/trace_events.c+5 -40 replies
4/13tracing: Add tracer_tracing_disable/enable() functionskernel/trace/trace.c kernel/trace/trace.h+35 -00 replies
5/13tracing: Use tracer_tracing_disable() instead of "disabled" field for ftrace_dump_one()kernel/trace/trace.c+4 -70 replies
6/13tracing: kdb: Use tracer_tracing_on/off() instead of setting per CPU disabledkernel/trace/trace_kdb.c+2 -70 replies
7/13ftrace: Do not disabled function graph based on "disabled" fieldkernel/trace/trace_functions_graph.c+9 -290 replies
8/13tracing: Do not use per CPU array_buffer.data->disabled for cpumaskkernel/trace/trace.c+0 -20 replies
9/13ring-buffer: Add ring_buffer_record_is_on_cpu()include/linux/ring_buffer.h kernel/trace/ring_buffer.c kernel/trace/trace.h+34 -00 replies
10/13tracing: branch: Use trace_tracing_is_on_cpu() instead of "disabled" fieldkernel/trace/trace_branch.c+1 -30 replies
11/13tracing: Convert the per CPU "disabled" counter to local from atomickernel/trace/trace.h kernel/trace/trace_functions.c kernel/trace/trace_irqsoff.c +1 more+25 -250 replies
12/13tracing: Use atomic_inc_return() for updating "disabled" counter in irqsoff tracerkernel/trace/trace_irqsoff.c+18 -110 replies
13/13tracing: Remove unused buffer_page field from trace_array_cpu structurekernel/trace/trace.h+0 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/13] tracing: Remove most uses of "disabled" field

Looking into allowing syscall events to fault and read user space, I found that the use of the per CPU data "disabled" field was mostly obsolete. This goes back to 2008 when the tracing subsystem was first created. The "disabled" field was the only way to know if tracing was disabled or not. But things have changed in the last 17 years! The ring buffer itself can disable tracing, and for the most part, that is what determines if tracing is enabled or not.

Now the stack tracer and latency tracers still use the disabled field to prevent corruption while its doing its per CPU accounting.

This series removes most uses of the disabled field. It also does some various clean ups, like convert the disabled field into a local_t type from an atomic_t type as it only is used to synchronize with interrupts and such.

Also, while inspecting the per CPU data, I realized that there's a "buffer_page" field that was supposed to hold the reader page to be able to reuse it. But that is done by the ring buffer infrastructure itself and this field is unneeded, so it is removed.

Note, with this change, the trace events shouldn't need to be called with preemption disabled anymore. This should allow the syscall trace event to be updated to read user memory. It still has some code that requires preemption disabled, but it does it internally and doesn't expect the functions to be called with preemption disabled.

Changes since v1: https://lore.kernel.org/linux-trace-kernel/[email protected]/

- Fixed "raw_smp_process_id()" to "raw_smp_processor_id()" in branch tracer (kernel test robot)

- Fixed unused "int cpu;" (kernel test robot)

- Add tracer_tracing_disable/enable() functions

- Use tracer_tracing_disable() instead of tracer_tracing_on() for ftrace_dump_one()

- Use the new tracer_tracing_disable() instead of tracer_tracing_off() for kdb_ftdump (Doug Anderson)

Head SHA1: 70b9ea306f1c611f81d6365f0866ee421c664200

Steven Rostedt (13):
tracing/mmiotrace: Remove reference to unused per CPU data pointer
ftrace: Do not bother checking per CPU "disabled" flag
tracing: Just use this_cpu_read() to access ignore_pid
tracing: Add tracer_tracing_disable/enable() functions
tracing: Use tracer_tracing_disable() instead of "disabled" field for ftrace_dump_one()
tracing: kdb: Use tracer_tracing_on/off() instead of setting per CPU disabled
ftrace: Do not disabled function graph based on "disabled" field
tracing: Do not use per CPU array_buffer.data->disabled for cpumask
ring-buffer: Add ring_buffer_record_is_on_cpu()
tracing: branch: Use trace_tracing_is_on_cpu() instead of "disabled" field
tracing: Convert the per CPU "disabled" counter to local from atomic
tracing: Use atomic_inc_return() for updating "disabled" counter in irqsoff tracer
tracing: Remove unused buffer_page field from trace_array_cpu structure

----

 include/linux/ring_buffer.h          |  1 +
 kernel/trace/ring_buffer.c           | 18 ++++++++++++++
 kernel/trace/trace.c                 | 46 ++++++++++++++++++++++++++++-------
 kernel/trace/trace.h                 | 20 +++++++++++++--
 kernel/trace/trace_branch.c          |  4 +--
 kernel/trace/trace_events.c          |  9 ++++---
 kernel/trace/trace_functions.c       | 24 ++++++------------
 kernel/trace/trace_functions_graph.c | 38 +++++++----------------------
 kernel/trace/trace_irqsoff.c         | 47 +++++++++++++++++++++---------------
 kernel/trace/trace_kdb.c             |  9 ++-----
 kernel/trace/trace_mmiotrace.c       | 12 ++-------
 kernel/trace/trace_sched_wakeup.c    | 18 +++++++-------
 12 files changed, 136 insertions(+), 110 deletions(-)