All of lore.kernel.org
 help / color / mirror / Atom feed
* [for-linus][PATCH 0/7] tracing: Fixes and updates for 6.0
@ 2022-09-07 16:15 Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 1/7] rv/monitors: Make monitors automata definition static Steven Rostedt
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Steven Rostedt @ 2022-09-07 16:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

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(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [for-linus][PATCH 1/7] rv/monitors: Make monitors automata definition static
  2022-09-07 16:15 [for-linus][PATCH 0/7] tracing: Fixes and updates for 6.0 Steven Rostedt
@ 2022-09-07 16:15 ` Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 2/7] MAINTAINERS: Add Runtime Verification (RV) entry Steven Rostedt
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2022-09-07 16:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, kernel test robot,
	Daniel Bristot de Oliveira

From: Daniel Bristot de Oliveira <bristot@kernel.org>

Monitor's automata definition is only used locally, so make
them static for all existing monitors.

Link: https://lore.kernel.org/all/202208210332.gtHXje45-lkp@intel.com
Link: https://lore.kernel.org/all/202208210358.6HH3OrVs-lkp@intel.com
Link: https://lkml.kernel.org/r/a50e27c3738d6ef809f4201857229fed64799234.1661266564.git.bristot@kernel.org

Fixes: ccc319dcb450 ("rv/monitor: Add the wwnr monitor")
Fixes: 8812d21219b9 ("rv/monitor: Add the wip monitor skeleton created by dot2k")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/rv/monitors/wip/wip.h   | 2 +-
 kernel/trace/rv/monitors/wwnr/wwnr.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/rv/monitors/wip/wip.h b/kernel/trace/rv/monitors/wip/wip.h
index c1c47e2305ef..dacc37b62a2c 100644
--- a/kernel/trace/rv/monitors/wip/wip.h
+++ b/kernel/trace/rv/monitors/wip/wip.h
@@ -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"
diff --git a/kernel/trace/rv/monitors/wwnr/wwnr.h b/kernel/trace/rv/monitors/wwnr/wwnr.h
index d1afe55cdd4c..118e576b91b4 100644
--- a/kernel/trace/rv/monitors/wwnr/wwnr.h
+++ b/kernel/trace/rv/monitors/wwnr/wwnr.h
@@ -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"
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [for-linus][PATCH 2/7] MAINTAINERS: Add Runtime Verification (RV) entry
  2022-09-07 16:15 [for-linus][PATCH 0/7] tracing: Fixes and updates for 6.0 Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 1/7] rv/monitors: Make monitors automata definition static Steven Rostedt
@ 2022-09-07 16:15 ` Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 3/7] MAINTAINERS: add scripts/tracing/ to TRACING Steven Rostedt
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2022-09-07 16:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Joe Perches,
	Daniel Bristot de Oliveira

From: Daniel Bristot de Oliveira <bristot@kernel.org>

Add a Runtime Verification (RV) entry in the MAINTAINERS file
with Steven Rostedt and myself as maintainers.

Link: https://lkml.kernel.org/r/b24c13553b6947a8da16d884ca464e4233eb8fb7.1661268579.git.bristot@kernel.org

Cc: Joe Perches <joe@perches.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 MAINTAINERS | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index d30f26e07cd3..b89b70af0b07 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17735,6 +17735,17 @@ L:	linux-rdma@vger.kernel.org
 S:	Maintained
 F:	drivers/infiniband/ulp/rtrs/
 
+RUNTIME VERIFICATION (RV)
+M:	Daniel Bristot de Oliveira <bristot@kernel.org>
+M:	Steven Rostedt <rostedt@goodmis.org>
+L:	linux-trace-devel@vger.kernel.org
+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 <dhowells@redhat.com>
 M:	Marc Dionne <marc.dionne@auristor.com>
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [for-linus][PATCH 3/7] MAINTAINERS: add scripts/tracing/ to TRACING
  2022-09-07 16:15 [for-linus][PATCH 0/7] tracing: Fixes and updates for 6.0 Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 1/7] rv/monitors: Make monitors automata definition static Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 2/7] MAINTAINERS: Add Runtime Verification (RV) entry Steven Rostedt
@ 2022-09-07 16:15 ` Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 4/7] tracepoint: Allow trace events in modules with TAINT_TEST Steven Rostedt
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2022-09-07 16:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Lukas Bulwahn

From: Lukas Bulwahn <lukas.bulwahn@gmail.com>

The files in scripts/tracing/ belong to the TRACING subsystem.

Add a corresponding file entry for TRACING.

Link: https://lkml.kernel.org/r/20220825115927.20598-1-lukas.bulwahn@gmail.com

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b89b70af0b07..93ffebc3e6c0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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)
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [for-linus][PATCH 4/7] tracepoint: Allow trace events in modules with TAINT_TEST
  2022-09-07 16:15 [for-linus][PATCH 0/7] tracing: Fixes and updates for 6.0 Steven Rostedt
                   ` (2 preceding siblings ...)
  2022-09-07 16:15 ` [for-linus][PATCH 3/7] MAINTAINERS: add scripts/tracing/ to TRACING Steven Rostedt
@ 2022-09-07 16:15 ` Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 5/7] tracing: hold caller_addr to hardirq_{enable,disable}_ip Steven Rostedt
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2022-09-07 16:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Ira Weiny, Dan Williams, David Gow,
	Alison Schofield

From: Alison Schofield <alison.schofield@intel.com>

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.

Link: https://lkml.kernel.org/r/20220829171048.263065-1-alison.schofield@intel.com

Fixes: 2852ca7fba9f7 ("panic: Taint kernel if tests are run")
Reported-by: Ira Weiny <ira.weiny@intel.com>
Suggested-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/tracepoint.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 64ea283f2f86..ef42c1a11920 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -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;
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [for-linus][PATCH 5/7] tracing: hold caller_addr to hardirq_{enable,disable}_ip
  2022-09-07 16:15 [for-linus][PATCH 0/7] tracing: Fixes and updates for 6.0 Steven Rostedt
                   ` (3 preceding siblings ...)
  2022-09-07 16:15 ` [for-linus][PATCH 4/7] tracepoint: Allow trace events in modules with TAINT_TEST Steven Rostedt
@ 2022-09-07 16:15 ` Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 6/7] tracing: Fix to check event_mutex is held while accessing trigger list Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 7/7] rv/reactor: add __init/__exit annotations to module init/exit funcs Steven Rostedt
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2022-09-07 16:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, stable, Yipeng Zou

From: Yipeng Zou <zouyipeng@huawei.com>

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

Link: https://lkml.kernel.org/r/20220901104515.135162-2-zouyipeng@huawei.com

Cc: stable@vger.kernel.org
Fixes: c3bc8fd637a96 ("tracing: Centralize preemptirq tracepoints and unify their usage")
Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_preemptirq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptirq.c
index 95b58bd757ce..1e130da1b742 100644
--- a/kernel/trace/trace_preemptirq.c
+++ b/kernel/trace/trace_preemptirq.c
@@ -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);
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [for-linus][PATCH 6/7] tracing: Fix to check event_mutex is held while accessing trigger list
  2022-09-07 16:15 [for-linus][PATCH 0/7] tracing: Fixes and updates for 6.0 Steven Rostedt
                   ` (4 preceding siblings ...)
  2022-09-07 16:15 ` [for-linus][PATCH 5/7] tracing: hold caller_addr to hardirq_{enable,disable}_ip Steven Rostedt
@ 2022-09-07 16:15 ` Steven Rostedt
  2022-09-07 16:15 ` [for-linus][PATCH 7/7] rv/reactor: add __init/__exit annotations to module init/exit funcs Steven Rostedt
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2022-09-07 16:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, stable, Masami Hiramatsu (Google)

From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>

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().

Link: https://lkml.kernel.org/r/166226474977.223837.1992182913048377113.stgit@devnote2

Cc: stable@vger.kernel.org
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_trigger.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index cb866c3141af..918730d74932 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -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;
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [for-linus][PATCH 7/7] rv/reactor: add __init/__exit annotations to module init/exit funcs
  2022-09-07 16:15 [for-linus][PATCH 0/7] tracing: Fixes and updates for 6.0 Steven Rostedt
                   ` (5 preceding siblings ...)
  2022-09-07 16:15 ` [for-linus][PATCH 6/7] tracing: Fix to check event_mutex is held while accessing trigger list Steven Rostedt
@ 2022-09-07 16:15 ` Steven Rostedt
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2022-09-07 16:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Xiu Jianfeng,
	Daniel Bristot de Oliveira

From: Xiu Jianfeng <xiujianfeng@huawei.com>

Add missing __init/__exit annotations to module init/exit funcs.

Link: https://lkml.kernel.org/r/20220906141210.132607-1-xiujianfeng@huawei.com

Fixes: 135b881ea885 ("rv/reactor: Add the printk reactor")
Fixes: e88043c0ac16 ("rv/reactor: Add the panic reactor")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/rv/reactor_panic.c  | 4 ++--
 kernel/trace/rv/reactor_printk.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/rv/reactor_panic.c b/kernel/trace/rv/reactor_panic.c
index b698d05dd069..d65f6c25a87c 100644
--- a/kernel/trace/rv/reactor_panic.c
+++ b/kernel/trace/rv/reactor_panic.c
@@ -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);
 }
diff --git a/kernel/trace/rv/reactor_printk.c b/kernel/trace/rv/reactor_printk.c
index 31899f953af4..4b6b7106a477 100644
--- a/kernel/trace/rv/reactor_printk.c
+++ b/kernel/trace/rv/reactor_printk.c
@@ -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);
 }
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-07 16:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-07 16:15 [for-linus][PATCH 0/7] tracing: Fixes and updates for 6.0 Steven Rostedt
2022-09-07 16:15 ` [for-linus][PATCH 1/7] rv/monitors: Make monitors automata definition static Steven Rostedt
2022-09-07 16:15 ` [for-linus][PATCH 2/7] MAINTAINERS: Add Runtime Verification (RV) entry Steven Rostedt
2022-09-07 16:15 ` [for-linus][PATCH 3/7] MAINTAINERS: add scripts/tracing/ to TRACING Steven Rostedt
2022-09-07 16:15 ` [for-linus][PATCH 4/7] tracepoint: Allow trace events in modules with TAINT_TEST Steven Rostedt
2022-09-07 16:15 ` [for-linus][PATCH 5/7] tracing: hold caller_addr to hardirq_{enable,disable}_ip Steven Rostedt
2022-09-07 16:15 ` [for-linus][PATCH 6/7] tracing: Fix to check event_mutex is held while accessing trigger list Steven Rostedt
2022-09-07 16:15 ` [for-linus][PATCH 7/7] rv/reactor: add __init/__exit annotations to module init/exit funcs Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.