Skip to content

RFC rcu/tracing: Export the RCU tracepoint string pointers

Steven Rostedt lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4rcu: Add const annotation to char * for RCU tracepoints and functionsinclude/linux/rcupdate.h include/trace/events/rcu.h kernel/rcu.h +6 more+60 -600 replies
2/4rcu: Simplify RCU_STATE_INITIALIZER() macrokernel/rcutree.c kernel/rcutree_plugin.h+7 -110 replies
3/4tracing: Add __tracepoint_string() to export string pointersinclude/asm-generic/vmlinux.lds.h include/linux/ftrace_event.h kernel/trace/trace.h +1 more+23 -10 replies
4/4rcu: Have the RCU tracepoints use the tracepoint_string infrastructurekernel/rcutree.c kernel/rcutree_plugin.h+64 -500 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC][PATCH 0/4] rcu/tracing: Export the RCU tracepoint string pointers

This has been on my todo list for a while. I've been promising Paul to get a way to have his tracepoints work for user tools, and I finally got around to it :-)

As his tracepoints just save a pointer to a string in the ring buffer and have the output use that pointer with a "%s" printf field, which works great in the kernel and is fast and efficient, it sucks for tools that read the binary data from the kernel but has no access to the strings that those pointers point to.

The trace_printk() had a similar problem when Frederic Weisbecker optimized it to just save the pointer to the format string along with the parameters, but that was solved by exporting a table of pointers with the strings in the /sys/kernel/debug/tracing/printk_formats file.

I've done the same thing for tracepoints using a separate section but the same file. I needed a seperate section as the trace_printk() section is used to know if a trace_printk() was added to the kernel (they should never be added to Linus's tree, unless its for a strict debugging option). If a trace_printk() is used, several temporary buffers are allocated, which we don't want in normal use.

Now tracepoints get a section that has the pointers to the strings and this gets added to the printk_format file. Doing this means that none of the tools (perf or trace-cmd) require any changes as they already handle reading the printk_formats via the event_parse library.

-- Steve

Steven Rostedt (Red Hat) (4):
rcu: Add const annotation to char * for RCU tracepoints and functions
rcu: Simplify RCU_STATE_INITIALIZER() macro
tracing: Add __tracepoint_string() to export string pointers
rcu: Have the RCU tracepoints use the tracepoint_string infrastructure

----

 include/asm-generic/vmlinux.lds.h |    7 ++-
 include/linux/ftrace_event.h      |    7 +++
 include/linux/rcupdate.h          |    4 +-
 include/trace/events/rcu.h        |   82 +++++++++++++++---------------
 kernel/rcu.h                      |    2 +-
 kernel/rcupdate.c                 |    2 +-
 kernel/rcutiny_plugin.h           |    2 +-
 kernel/rcutorture.c               |   14 +++---
 kernel/rcutree.c                  |  100 +++++++++++++++++++++----------------
 kernel/rcutree.h                  |    2 +-
 kernel/rcutree_plugin.h           |   44 ++++++++--------
 kernel/trace/trace.h              |    3 ++
 kernel/trace/trace_printk.c       |    7 +++
 13 files changed, 154 insertions(+), 122 deletions(-)