Thread (5 messages) 5 messages, 3 authors, 2023-01-21

Re: [tip:sched/core] [tracing, hardirq] 9aedeaed6f: WARNING:suspicious_RCU_usage

flat view

From: Peter Zijlstra <peterz@infradead.org>
Date: 2023-01-19 15:46:32
Also in: lkml, oe-lkp
Subsystem: cpu idle time management framework, the rest · Maintainers: "Rafael J. Wysocki", Daniel Lezcano, Linus Torvalds

On Thu, Jan 19, 2023 at 10:06:21PM +0800, kernel test robot wrote:
Greeting,

FYI, we noticed WARNING:suspicious_RCU_usage due to commit (built with gcc-11):

commit: 9aedeaed6fc6fe8452b9b8225e95cc2b8631ff91 ("tracing, hardirq: No moar _rcuidle() tracing")
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git sched/core

[test failed on linux-next/master f3381a7baf5ccbd091eb2c4fd2afd84266fcef24]

in testcase: kernel-selftests
version: kernel-selftests-x86_64-d4cf28ee-1_20230110
with following parameters:

	group: ftrace
Moo, so I've had these patches in my git tree for months :/

The thing that seems to shut it up is the below, but I'm not entirely
sure how we get there, all the code should be cpuidle/noinstr, which
implies notrace.

Steve, what's the easiest way to figure out what triggers this? Put a
printk() in prepare_ftrace_return() or so?

---
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 3183aeb7f5b4..fecdf0bb3bc4 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -15,6 +15,7 @@
 #include <linux/list.h>
 #include <linux/hrtimer.h>
 #include <linux/context_tracking.h>
+#include <linux/ftrace.h>
 
 #define CPUIDLE_STATE_MAX	10
 #define CPUIDLE_NAME_LEN	16
@@ -119,6 +120,7 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev);
 static __always_inline void ct_cpuidle_enter(void)
 {
 	lockdep_assert_irqs_disabled();
+	pause_graph_tracing();
 	/*
 	 * Idle is allowed to (temporary) enable IRQs. It
 	 * will return with IRQs disabled.
@@ -143,6 +145,7 @@ static __always_inline void ct_cpuidle_exit(void)
 	lockdep_hardirqs_off(_RET_IP_);
 	ct_idle_exit();
 	instrumentation_begin();
+	unpause_graph_tracing();
 }
 
 /****************************
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help