tracing: Updates for 5.10
Steven Rostedt
maintainerLinus,
Updates for tracing and bootconfig:
- Add support for "bool" type in synthetic events
- Add per instance tracing for bootconfig
- Support perf-style return probe ("SYMBOL%return") in kprobes and uprobes
- Allow for kprobes to be enabled earlier in boot up
- Added tracepoint helper function to allow testing if tracepoints are enabled in headers
- Synthetic events can now have dynamic strings (variable length)
- Various fixes and cleanups
Please pull the latest trace-v5.10 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.10
Tag SHA1: 26ab68b2a2fa3a0e3724d4b025ca3a15dd7ec1f3 Head SHA1: 6107742d15832011cd0396d821f3225b52551f1f
Axel Rasmussen (1):
tracing: support "bool" type in synthetic trace events
Dan Carpenter (1):
tracing: remove a pointless assignment
Davidlohr Bueso (1):
fgraph: Convert ret_stack tasklist scanning to rcu
Gaurav Kohli (1):
tracing: Fix race in trace_open and buffer resize call
Jarkko Sakkinen (1):
kprobes: Use module_name() macro
Masami Hiramatsu (21):
tools/bootconfig: Show bootconfig compact tree from bootconfig file tools/bootconfig: Add list option
tools/bootconfig: Make all functions static
tools/bootconfig: Add a script to generate ftrace shell-command from bootconfig tools/bootconfig: Add a script to generates bootconfig from ftrace tools/bootconfig: Add --init option for bconf2ftrace.sh tracing/boot: Add per-instance tracing_on option support
Documentation: tracing: Add tracing_on option to boot-time tracer tracing/kprobes: Support perf-style return probe
tracing/uprobes: Support perf-style return probe
Documentation: tracing: Add %return suffix description
Documentation: tracing: boot: Add an example of tracing function-calls selftests/ftrace: Add %return suffix tests
kprobes: Init kprobes in early_initcall
tracing: Define event fields early stage
tracing: Enable adding dynamic events early stage
tracing: Enable creating new instance early boot
tracing/boot, kprobe, synth: Initialize boot-time tracing earlier
Documentation: tracing: Add the startup timing of boot-time tracing tracing/boot: Initialize per-instance event list in early boot tracing/boot: Add ftrace.instance.*.alloc_snapshot option
Qiujun Huang (2):
ftrace: Fix some typos in comment
tracing: Fix some typos in comments
Randy Dunlap (1):
tracing: Delete repeated words in comments
Steven Rostedt (VMware) (8):
tracepoints: Add helper to test if tracepoint is enabled in a header mm/page_ref: Convert the open coded tracepoint enabled to the new helper
x86: Use tracepoint_enabled() for msr tracepoints instead of open coding it
tracing: Change synthetic event string format to limit printed length
ftrace: Simplify the hash calculation
ftrace: Format variable declarations of ftrace_allocate_records
tracing: Fix synthetic print fmt check for use of __get_str()
tracing: Check return value of __create_val_fields() before using its result
Sudip Mukherjee (1):
tracing: Remove a pointless assignment
Tom Zanussi (13):
tracing: Change STR_VAR_MAX_LEN
tracing: Fix parse_synth_field() error handling
tracing: Save normal string variables
tracing: Add support for dynamic strings to synthetic events
tracing: Add README information for synthetic_events file selftests/ftrace: Add test case for synthetic event dynamic strings
tracing: Don't show dynamic string internals in synthetic event description
tracing: Move is_good_name() from trace_probe.h to trace.h
tracing: Check that the synthetic event and field names are legal
tracing: Add synthetic event error logging
selftests/ftrace: Change synthetic event name for inter-event-combined test
tracing: Handle synthetic event array field type checking correctly selftests/ftrace: Add test case for synthetic event syntax errors
Wei Yang (6):
tracing: toplevel d_entry already initialized
tracing: make tracing_init_dentry() returns an integer instead of a d_entry pointer
ftrace: Use fls() to get the bits for dup_hash()
ftrace: Simplify the dyn_ftrace->flags macro
ftrace: Simplify the calculation of page number for ftrace_page->records
ftrace: ftrace_global_list is renamed to ftrace_ops_list
Xianting Tian (1):
tracing: Use __this_cpu_read() in trace_buffered_event_enable()
----
Documentation/trace/boottime-trace.rst | 38 ++ Documentation/trace/events.rst | 15 +- Documentation/trace/histogram.rst | 18 + Documentation/trace/kprobetrace.rst | 2 + Documentation/trace/tracepoints.rst | 27 ++ Documentation/trace/uprobetracer.rst | 2 + MAINTAINERS | 1 + arch/x86/include/asm/msr.h | 20 +- include/linux/ftrace.h | 11 +- include/linux/page_ref.h | 42 +-- include/linux/tracepoint-defs.h | 34 ++ kernel/kprobes.c | 2 +- kernel/trace/fgraph.c | 8 +- kernel/trace/ftrace.c | 24 +- kernel/trace/ring_buffer.c | 10 + kernel/trace/synth_event_gen_test.c | 18 +- kernel/trace/trace.c | 111 ++++-- kernel/trace/trace.h | 31 +- kernel/trace/trace_boot.c | 23 +- kernel/trace/trace_dynevent.c | 10 +- kernel/trace/trace_events.c | 140 ++++--- kernel/trace/trace_events_hist.c | 45 ++- kernel/trace/trace_events_synth.c | 413 ++++++++++++++++++--- kernel/trace/trace_functions.c | 22 +- kernel/trace/trace_functions_graph.c | 8 +- kernel/trace/trace_hwlat.c | 8 +- kernel/trace/trace_kprobe.c | 41 +- kernel/trace/trace_printk.c | 8 +- kernel/trace/trace_probe.h | 14 +- kernel/trace/trace_stack.c | 12 +- kernel/trace/trace_stat.c | 8 +- kernel/trace/trace_synth.h | 6 +- kernel/trace/trace_uprobe.c | 24 +- kernel/trace/tracing_map.c | 2 +- tools/bootconfig/main.c | 147 +++++--- tools/bootconfig/scripts/bconf2ftrace.sh | 199 ++++++++++ tools/bootconfig/scripts/ftrace.sh | 109 ++++++ tools/bootconfig/scripts/ftrace2bconf.sh | 244 ++++++++++++ tools/bootconfig/scripts/xbc.sh | 56 +++ .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 6 + .../test.d/kprobe/kretprobe_return_suffix.tc | 21 ++ .../ftrace/test.d/kprobe/uprobe_syntax_errors.tc | 6 + .../trigger-inter-event-combined-hist.tc | 8 +- .../trigger-synthetic-event-dynstring.tc | 31 ++ .../trigger-synthetic_event_syntax_errors.tc | 19 + 45 files changed, 1709 insertions(+), 335 deletions(-) create mode 100755 tools/bootconfig/scripts/bconf2ftrace.sh create mode 100644 tools/bootconfig/scripts/ftrace.sh create mode 100755 tools/bootconfig/scripts/ftrace2bconf.sh create mode 100644 tools/bootconfig/scripts/xbc.sh create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_return_suffix.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-dynstring.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic_event_syntax_errors.tc
---------------------------
The pull request you sent on Thu, 15 Oct 2020 13:53:45 -0400:
The pull request you sent on Thu, 15 Oct 2020 13:53:45 -0400:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.gittrace-v5.10
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/fefa636d815975b34afc45f50852a2810fb23ba9
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html
Quoted 2 lines · Steven Rostedt
Updates for tracing and bootconfig:
Hmm. I haven't verified that this came from you, but it seems likely.. Once again my clang build shows something that I don't see in my allmodconfig gcc build:
WARNING: modpost: vmlinux.o(.text+0x1e5b06): Section mismatch in
reference from the function __trace_early_add_events() to the function .init.text:__trace_early_add_new_event()
The function __trace_early_add_events() references
the function __init __trace_early_add_new_event().
This is often because __trace_early_add_events lacks a __init annotation or the annotation of __trace_early_add_new_event is wrong.
Hmm?
Linus
Steven Rostedt
maintainerQuoted 16 lines · On Thu, 15 Oct 2020 18:54:34 -0700 Linus Torvalds…
Quoted 2 lines · Steven Rostedt
Updates for tracing and bootconfig:
Hmm. I haven't verified that this came from you, but it seems likely.. Once again my clang build shows something that I don't see in my allmodconfig gcc build:
WARNING: modpost:
vmlinux.o(.text+0x1e5b06): Section mismatch in
reference from the function__trace_early_add_events()to the function .init.text:__trace_early_add_new_event()
The function__trace_early_add_events()references
the function__init__trace_early_add_new_event().
This is often because__trace_early_add_eventslacks a__initannotation or the annotation of__trace_early_add_new_eventis wrong.
Quoted 3 lines
Hmm?
Linus
I see the issue, and I wonder if it has to do with optimization, for gcc not to warn.
The issue is that we have:
trace_array_create() that can be called at any time. And it has:
if (trace_instance_dir) {
ret = trace_array_create_dir(tr);
if (ret)
goto out_free_tr;
} else
__trace_early_add_events(tr);Where trace_instance_dir gets set at boot up, and thus the else statement will never get called after that.
The __trace_early_add_events() then calls __trace_early_add_new_events() which is __init.
I don't know how gcc didn't trigger this and clang does.
I'll have to think about how to untangle this. Is there some kind of annotation that makes it show that a path can only be called at boot up and not later?
-- Steve
Masami Hiramatsu
maintainerQuoted 19 lines · On Thu, 15 Oct 2020 22:21:39 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 16 lines · On Thu, 15 Oct 2020 18:54:34 -0700 Linus Torvalds…
Quoted 2 lines · Steven Rostedt
Updates for tracing and bootconfig:
Hmm. I haven't verified that this came from you, but it seems likely.. Once again my clang build shows something that I don't see in my allmodconfig gcc build:
WARNING: modpost:
vmlinux.o(.text+0x1e5b06): Section mismatch in
reference from the function__trace_early_add_events()to the function .init.text:__trace_early_add_new_event()
The function__trace_early_add_events()references
the function__init__trace_early_add_new_event().
This is often because__trace_early_add_eventslacks a__initannotation or the annotation of__trace_early_add_new_eventis wrong.
Quoted 6 lines
Quoted 3 lines
Hmm?
Linus
I see the issue, and I wonder if it has to do with optimization, for gcc not to warn.
I also couldn't reproduce it even with CONFIG_DEBUG_SECTION_MISMATCH=y. It seems that the __trace_early_add_new_event() is inlined in __trace_early_add_events().
$ eu-readelf -w kernel/trace/trace_events.o
...
[ 1af20] subprogram abbrev: 53
name (strp) "__trace_early_add_new_event"
decl_file (data1) trace_events.c (1)
decl_line (data2) 2502
decl_column (data1) 1
prototyped (flag_present) yes
type (ref4) [ cc]
inline (data1) inlined (1)
$ gcc -v
...
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) Quoted 19 lines
The issue is that we have:
trace_array_create()that can be called at any time. And it has:if (trace_instance_dir) { ret = trace_array_create_dir(tr); if (ret) goto out_free_tr; } else __trace_early_add_events(tr);Where
trace_instance_dirgets set at boot up, and thus the else statement will never get called after that.The
__trace_early_add_events()then calls__trace_early_add_new_events()which is__init.
Quoted 6 lines
I don't know how gcc didn't trigger this and clang does.
I'll have to think about how to untangle this. Is there some kind of annotation that makes it show that a path can only be called at boot up and not later?
What happen if we use Peter's static_call() and update it after boot up? Or, we might need to break apart the trace_array_create() and restruct it as __init trace_array_early_create() and trace_array_create().
Thank you,
Signature · 1 line
Masami Hiramatsu <[email protected]>
Steven Rostedt
maintainerQuoted 6 lines · On Fri, 16 Oct 2020 11:53:23 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 4 lines
I'll have to think about how to untangle this. Is there some kind of annotation that makes it show that a path can only be called at boot up and not later?
What happen if we use Peter's
static_call()and update it after boot up?
I think that's a bit over engineering ;-)
Quoted 2 lines
Or, we might need to break apart the
trace_array_create()and restruct it as__inittrace_array_early_create()andtrace_array_create().
That will likely make the code a bit more complex and possibly add as much code as we save from the __init sections.
I think the best solution is what you proposed, and removing the __init, and possibly making that function inline as well.
Care to send an official patch?
Thanks!
-- Steve
Masami Hiramatsu
maintainerQuoted 15 lines · On Thu, 15 Oct 2020 23:54:44 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Fri, 16 Oct 2020 11:53:23 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 4 lines
I'll have to think about how to untangle this. Is there some kind of annotation that makes it show that a path can only be called at boot up and not later?
What happen if we use Peter's
static_call()and update it after boot up?I think that's a bit over engineering ;-)
Quoted 2 lines
Or, we might need to break apart the
trace_array_create()and restruct it as__inittrace_array_early_create()andtrace_array_create().
Quoted 7 lines
That will likely make the code a bit more complex and possibly add as much code as we save from the
__initsections.I think the best solution is what you proposed, and removing the
__init, and possibly making that function inline as well.Care to send an official patch?
Sure, I'll send it.
Thank you,
Signature · 1 line
Masami Hiramatsu <[email protected]>
Masami Hiramatsu
maintainerPATCH 1/1 tracing: Remove __init from __trace_early_add_new_event()
In reply to Steven RostedtThe commit 720dee53ad8d ("tracing/boot: Initialize per-instance event list in early boot") removes __init from __trace_early_add_events() but __trace_early_add_new_event() still has __init and will cause a section mismatch.
Remove __init from __trace_early_add_new_event() as same as __trace_early_add_events().
--- kernel/trace/trace_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_events.c +1 -1
@@ -2498,7 +2498,7 @@ __trace_add_new_event(struct trace_event_call *call, struct trace_array *tr)* for enabling events at boot. We want to enable events before * the filesystem is initialized. */ -static __init int +static int __trace_early_add_new_event (struct trace_event_call *call,struct trace_array *tr) {
Masami Hiramatsu
maintainerQuoted 16 lines · On Thu, 15 Oct 2020 18:54:34 -0700 Linus Torvalds…
Quoted 2 lines · Steven Rostedt
Updates for tracing and bootconfig:
Hmm. I haven't verified that this came from you, but it seems likely.. Once again my clang build shows something that I don't see in my allmodconfig gcc build:
WARNING: modpost:
vmlinux.o(.text+0x1e5b06): Section mismatch in
reference from the function__trace_early_add_events()to the function .init.text:__trace_early_add_new_event()
The function__trace_early_add_events()references
the function__init__trace_early_add_new_event().
This is often because__trace_early_add_eventslacks a__initannotation or the annotation of__trace_early_add_new_eventis wrong.
Quoted 1 line
Hmm?
Oops, that's my fault.
The commit 720dee53ad8d ("tracing/boot: Initialize per-instance event list
in early boot") removes __init from __trace_early_add_events() but I
forgot to do same on __trace_early_add_new_event().
Would this work?
kernel/trace/trace_events.c +1 -1
@@ -2498,7 +2498,7 @@ __trace_add_new_event(struct trace_event_call *call, struct trace_array *tr)* for enabling events at boot. We want to enable events before * the filesystem is initialized. */ -static __init int +static int __trace_early_add_new_event (struct trace_event_call *call,struct trace_array *tr) {
Signature · 1 line
Masami Hiramatsu <[email protected]>