Thread (27 messages) 27 messages, 5 authors, 2023-01-28

[PATCH 3/6] ftrace/x86: Warn and ignore graph tracing when RCU is disabled

flat view
STALE1366d

From: Peter Zijlstra <peterz@infradead.org>
Date: 2023-01-23 20:58:44
Also in: kvm, linux-pm, lkml, virtualization
Subsystem: function hooks (ftrace), the rest, x86 architecture (32-bit and 64-bit) · Maintainers: Steven Rostedt, Masami Hiramatsu, Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen

All RCU disabled code should be noinstr and hence we should never get
here -- when we do, WARN about it and make sure to not actually do
tracing.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/kernel/ftrace.c |    3 +++
 1 file changed, 3 insertions(+)
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -646,6 +646,9 @@ void prepare_ftrace_return(unsigned long
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
+	if (WARN_ONCE(!rcu_is_watching(), "RCU not on for: %pS\n", (void *)ip))
+		return;
+
 	bit = ftrace_test_recursion_trylock(ip, *parent);
 	if (bit < 0)
 		return;

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help