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(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/