Skip to content

tracing: Clean up the snapshot and max tracer code

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. v3 Latest3 patches 0 repliesNew
  2. v23 patches 0 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tracing: Rename trace_array field max_buffer to snapshot_bufferkernel/trace/trace.c kernel/trace/trace.h kernel/trace/trace_selftest.c+48 -470 replies
2/3tracing: Add tracer_uses_snapshot() helper to remove #ifdefskernel/trace/trace.c kernel/trace/trace.h+28 -350 replies
3/3tracing: Better separate SNAPSHOT and MAX_TRACE optionskernel/trace/Kconfig kernel/trace/trace.c kernel/trace/trace.h+53 -470 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/3] tracing: Clean up the snapshot and max tracer code

When tracing first was added it had latency tracers that used a separate snapshot buffer to swap the current buffer being written to with a static buffer that is only read. This later became a feature that user space could use by attaching to the latency tracer snapshot buffer. But the buffer was named max_buffer which is not what it is used for in all cases.

Rename the max_buffer name to snapshot_buffer.

The "use_max_tr" field of the tracer structure is only defined when CONFIG_TRACER_MAX_TRACE is defined. To get rid of some of the #ifdefs in the code around accesses of that field, use a helper function tracer_uses_snapshot() that access the field when the config is defined, or returns false if not.

Finally, since the latency tracers use the snapshot buffer and snapshot buffers do not need latency tracers, have the TRACER_MAX_TRACE config select TRACE_SNAPSHOT config and not the other way around. Also clean up the code to properly protect the max tracer references and the snapshot references.

Changes since v2: https://lore.kernel.org/all/[email protected]/

- Fix tracing_set_tracer() when CONFIG_TRACER_SNAPSHOT is not enabled. Seems that some fields that are only available with that config were still exposed, and the local variable used was still hidden. (kernel test robot)

- Fix trace_create_maxlat_file() declaration when CONFIG_TRACER_SNAPSHOT is not defined.

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

- This separates the updates to snapshot buffer and max tracers from the last series. It was a rewrite.

Steven Rostedt (3):
tracing: Rename trace_array field max_buffer to snapshot_buffer
tracing: Add tracer_uses_snapshot() helper to remove #ifdefs
tracing: Better separate SNAPSHOT and MAX_TRACE options

----

 kernel/trace/Kconfig          |   8 +-
 kernel/trace/trace.c          | 192 +++++++++++++++++++-----------------------
 kernel/trace/trace.h          |  44 +++++++---
 kernel/trace/trace_selftest.c |  10 +--
 4 files changed, 127 insertions(+), 127 deletions(-)