tracing: Fixes and updates for 6.0
Subsystems (3)
Steven Rostedt
maintainercover tracing: Fixes and updates for 6.0
Alison Schofield (1):
tracepoint: Allow trace events in modules with TAINT_TEST
Daniel Bristot de Oliveira (2):
rv/monitors: Make monitor's automata definition static
MAINTAINERS: Add Runtime Verification (RV) entry
Lukas Bulwahn (1):
MAINTAINERS: add scripts/tracing/ to TRACING
Masami Hiramatsu (Google) (1):
tracing: Fix to check event_mutex is held while accessing trigger list
Xiu Jianfeng (1):
rv/reactor: add __init/__exit annotations to module init/exit funcs
Yipeng Zou (1):
tracing: hold caller_addr to hardirq_{enable,disable}_ip
----
MAINTAINERS | 12 ++++++++++++ kernel/trace/rv/monitors/wip/wip.h | 2 +- kernel/trace/rv/monitors/wwnr/wwnr.h | 2 +- kernel/trace/rv/reactor_panic.c | 4 ++-- kernel/trace/rv/reactor_printk.c | 4 ++-- kernel/trace/trace_events_trigger.c | 3 ++- kernel/trace/trace_preemptirq.c | 4 ++-- kernel/tracepoint.c | 5 +++-- 8 files changed, 25 insertions(+), 11 deletions(-)
Steven Rostedt
maintainerPATCH 1/7 rv/monitors: Make monitors automata definition static
From: Daniel Bristot de Oliveira <[email protected]>
Monitor's automata definition is only used locally, so make them static for all existing monitors.
--- kernel/trace/rv/monitors/wip/wip.h | 2 +- kernel/trace/rv/monitors/wwnr/wwnr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/rv/monitors/wip/wip.h +1 -1
@@ -27,7 +27,7 @@ struct automaton_wip {bool final_states[state_max_wip]; }; -struct automaton_wip automaton_wip = { +static struct automaton_wip automaton_wip = { .state_names = {"preemptive" ,"non_preemptive"
kernel/trace/rv/monitors/wwnr/wwnr.h +1 -1
@@ -27,7 +27,7 @@ struct automaton_wwnr {bool final_states[state_max_wwnr]; }; -struct automaton_wwnr automaton_wwnr = { +static struct automaton_wwnr automaton_wwnr = { .state_names = {"not_running" ,"running"
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 2/7 MAINTAINERS: Add Runtime Verification (RV) entry
In reply to Steven RostedtFrom: Daniel Bristot de Oliveira <[email protected]>
Add a Runtime Verification (RV) entry in the MAINTAINERS file with Steven Rostedt and myself as maintainers.
--- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+)
MAINTAINERS +11 -0
@@ -17735,6 +17735,17 @@ L: [email protected] S: Maintained F: drivers/infiniband/ulp/rtrs/ +RUNTIME VERIFICATION (RV) +M: Daniel Bristot de Oliveira <[email protected]> +M: Steven Rostedt <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/trace/rv/ +F: include/linux/rv.h +F: include/rv/ +F: kernel/trace/rv/ +F: tools/verification/ + RXRPC SOCKETS (AF_RXRPC) M: David Howells <[email protected]> M: Marc Dionne <[email protected]>
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 3/7 MAINTAINERS: add scripts/tracing/ to TRACING
In reply to Steven RostedtFrom: Lukas Bulwahn <[email protected]>
The files in scripts/tracing/ belong to the TRACING subsystem.
Add a corresponding file entry for TRACING.
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -20612,6 +20612,7 @@ F: include/*/ftrace.h F: include/linux/trace*.h F: include/trace/ F: kernel/trace/ +F: scripts/tracing/ F: tools/testing/selftests/ftrace/ TRACING MMIO ACCESSES (MMIOTRACE)
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 4/7 tracepoint: Allow trace events in modules with TAINT_TEST
In reply to Steven RostedtFrom: Alison Schofield <[email protected]>
Commit 2852ca7fba9f ("panic: Taint kernel if tests are run") introduced a new taint type, TAINT_TEST, to signal that an in-kernel test module has been loaded.
TAINT_TEST taint type defaults into a 'bad_taint' list for kernel tracing and blocks the creation of trace events. This causes a problem for CXL testing where loading the cxl_test module makes all CXL modules out-of-tree, blocking any trace events.
Trace events are in development for CXL at the moment and this issue was found in test with v6.0-rc1.
--- kernel/tracepoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/tracepoint.c +3 -2
@@ -571,7 +571,8 @@ static void for_each_tracepoint_range(bool trace_module_has_bad_taint (struct module *mod) {return mod->taints & ~((1 <<TAINT_OOT_MODULE ) | (1 <<TAINT_CRAP ) | - (1 <<TAINT_UNSIGNED_MODULE )); + (1 <<TAINT_UNSIGNED_MODULE ) | + (1 <<TAINT_TEST )); }static BLOCKING_NOTIFIER_HEAD (tracepoint_notify_list);
@@ -647,7 +648,7 @@ static int tracepoint_module_coming(struct module *mod)/* * We skip modules that taint the kernel, especially those with different * module headers (for forced load), to make sure we don't cause a crash. -* Staging, out-of-tree, and unsigned GPL modules are fine. +* Staging, out-of-tree, unsigned GPL, and test modules are fine. */ if (trace_module_has_bad_taint (mod))return 0 ;
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 5/7 tracing: hold caller_addr to hardirq_{enable,disable}_ip
In reply to Steven RostedtFrom: Yipeng Zou <[email protected]>
Currently, The arguments passing to lockdep_hardirqs_{on,off} was fixed in CALLER_ADDR0.
The function trace_hardirqs_on_caller should have been intended to use caller_addr to represent the address that caller wants to be traced.
For example, lockdep log in riscv showing the last {enabled,disabled} at __trace_hardirqs_{on,off} all the time(if called by):
[ 57.853175] hardirqs last enabled at (2519): __trace_hardirqs_on+0xc/0x14 [ 57.853848] hardirqs last disabled at (2520): __trace_hardirqs_off+0xc/0x14
After use trace_hardirqs_xx_caller, we can get more effective information:
[ 53.781428] hardirqs last enabled at (2595): restore_all+0xe/0x66 [ 53.782185] hardirqs last disabled at (2596): ret_from_exception+0xa/0x10
--- kernel/trace/trace_preemptirq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_preemptirq.c +2 -2
@@ -95,14 +95,14 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr) }lockdep_hardirqs_on_prepare (); -lockdep_hardirqs_on (CALLER_ADDR0 ); +lockdep_hardirqs_on (caller_addr); }EXPORT_SYMBOL (trace_hardirqs_on_caller);NOKPROBE_SYMBOL (trace_hardirqs_on_caller); __visible void trace_hardirqs_off_caller(unsigned long caller_addr) { -lockdep_hardirqs_off (CALLER_ADDR0 ); +lockdep_hardirqs_off (caller_addr);if (!this_cpu_read (tracing_irq_cpu)) {this_cpu_write (tracing_irq_cpu,1 );
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 6/7 tracing: Fix to check event_mutex is held while accessing trigger list
In reply to Steven RostedtFrom: "Masami Hiramatsu (Google)" <[email protected]>
Since the check_user_trigger() is called outside of RCU read lock, this list_for_each_entry_rcu() caused a suspicious RCU usage warning.
# echo hist:keys=pid > events/sched/sched_stat_runtime/trigger # cat events/sched/sched_stat_runtime/trigger [ 43.167032] [ 43.167418] ============================= [ 43.167992] WARNING: suspicious RCU usage [ 43.168567] 5.19.0-rc5-00029-g19ebe4651abf #59 Not tainted [ 43.169283] ----------------------------- [ 43.169863] kernel/trace/trace_events_trigger.c:145 RCU-list traversed in non-reader section!! ...
However, this file->triggers list is safe when it is accessed under event_mutex is held.
To fix this warning, adds a lockdep_is_held check to the list_for_each_entry_rcu().
--- kernel/trace/trace_events_trigger.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace_events_trigger.c +2 -1
@@ -142,7 +142,8 @@ static bool check_user_trigger(struct trace_event_file *file) {struct event_trigger_data *data; -list_for_each_entry_rcu (data, &file->triggers, list) { +list_for_each_entry_rcu (data, &file->triggers, list, +lockdep_is_held (&event_mutex)) {if (data->flags &EVENT_TRIGGER_FL_PROBE )continue ;return true;
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 7/7 rv/reactor: add __init/__exit annotations to module init/exit funcs
In reply to Steven RostedtFrom: Xiu Jianfeng <[email protected]>
Add missing __init/__exit annotations to module init/exit funcs.
--- kernel/trace/rv/reactor_panic.c | 4 ++-- kernel/trace/rv/reactor_printk.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
kernel/trace/rv/reactor_panic.c +2 -2
@@ -24,13 +24,13 @@ static struct rv_reactor rv_panic = { .react = rv_panic_reaction }; -static int register_react_panic (void ) +static int __init register_react_panic (void ) {rv_register_reactor (&rv_panic);return 0 ; } -static void unregister_react_panic (void ) +static void __exit unregister_react_panic(void) {rv_unregister_reactor (&rv_panic); }
kernel/trace/rv/reactor_printk.c +2 -2
@@ -23,13 +23,13 @@ static struct rv_reactor rv_printk = { .react = rv_printk_reaction }; -static int register_react_printk (void ) +static int __init register_react_printk (void ) {rv_register_reactor (&rv_printk);return 0 ; } -static void unregister_react_printk (void ) +static void __exit unregister_react_printk(void) {rv_unregister_reactor (&rv_printk); }
Signature · 1 line
2.35.1