[PATCH] cpuidle: tegra: Keep RCU watching for the cluster PM notifiers

From: Patrick Fischer via B4 Relay

Date: Tue Dec 01 2026 - 18:27:06 EST


From: Patrick Fischer <admin@xxxxxxxxxxxxxxxxxx>

On Tegra20 and Tegra30 the coupled CC6 state runs the CPU cluster PM
notifiers after RCU has stopped watching. With PROVE_LOCKING on a
Nexus 7 2012 (Tegra30), entering CC6 warns "RCU not watching for
tracepoint" in lock_acquire(), notifier_call_chain() and
lock_release(), and reports "suspicious RCU usage" for rcu_read_lock()
and rcu_read_unlock() in cpu_pm_notify(). I have seen no other effect.

Since commit 5fca0d9f5d76 ("cpuidle, tegra: Push RCU-idle into
driver"), tegra_cpuidle_state_enter() calls ct_cpuidle_enter() before
it enters C7 or CC6. For CC6, CPU0 then calls tegra_pm_enter_lp2(),
which runs cpu_cluster_pm_enter() and cpu_cluster_pm_exit().
Commit 924aed1646bf ("cpuidle, cpu_pm: Remove RCU fiddling from
cpu_pm_{enter,exit}()") from the same series removed the RCU handling
from these two, so they need RCU to be watching: the first takes a
raw spinlock and walks the notifier chain, which hits the lock and
notifier tracepoints; the second walks the chain under
rcu_read_lock().

Call ct_cpuidle_enter() and ct_cpuidle_exit() only around
cpu_suspend() instead, as commit b3f46658ce40 ("cpuidle, ARM/imx6:
Push RCU-idle into driver") did for cpuidle-imx6sx: in the C7 path,
for the secondary CPUs that park for CC6, and in tegra_pm_enter_lp2(),
whose only caller is the CC6 path of this driver. Mark these three
functions __cpuidle.

The cause was traced from these warnings with the help of Claude Code
(an LLM coding assistant).

Fixes: 5fca0d9f5d76 ("cpuidle, tegra: Push RCU-idle into driver")
Signed-off-by: Patrick Fischer <admin@xxxxxxxxxxxxxxxxxx>
---
Tested on a Nexus 7 2012 (Tegra30) on top of v7.4-rc5 with
PROVE_LOCKING, 90 s idle after boot. Without this patch: 645 CC6
entries and the five warnings above. With it: 663 CC6 entries, 2607 to
3660 C7 entries per secondary CPU, no warning. Without the patch but
with CC6 disabled there is no warning either, so the C7 path alone
does not trigger it.

Each of these boots also hits an unrelated lockdep report (EMC,
reported separately) after 8.4 to 9.3 s. It turns lockdep off and with
it the two "suspicious RCU usage" checks; without the patch they fire
before that, at 6.6 s. The tracepoint checks stay armed and cover both
notifier calls.

Not tested on Tegra20 (CC6 takes the same path; C7 is disabled there)
or on Tegra114/Tegra124 (CC6 is disabled; only the place of
ct_cpuidle_enter() in the C7 path changes).

Based on linux-pm linux-next. The patch also touches
arch/arm/mach-tegra/pm.c, so it needs an ack from the Tegra side, or
it can go through the Tegra tree if you prefer.

Tool use: Claude Code also drafted this patch and its description; I
reviewed both.
---
arch/arm/mach-tegra/pm.c | 9 ++++++++-
drivers/cpuidle/cpuidle-tegra.c | 16 +++++++++-------
2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index b21f51b8e19e..673559889719 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -8,6 +8,7 @@
#include <linux/clk/tegra.h>
#include <linux/cpumask.h>
#include <linux/cpu_pm.h>
+#include <linux/cpuidle.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
@@ -194,7 +195,7 @@ static void tegra_pm_set(enum tegra_suspend_mode mode)
tegra_pmc_enter_suspend_mode(mode);
}

-int tegra_pm_enter_lp2(void)
+int __cpuidle tegra_pm_enter_lp2(void)
{
int err;

@@ -203,7 +204,13 @@ int tegra_pm_enter_lp2(void)
cpu_cluster_pm_enter();
suspend_cpu_complex();

+ /*
+ * The cluster PM notifiers called before and after this need RCU
+ * to be watching, so stop it only around the actual power-down.
+ */
+ ct_cpuidle_enter();
err = cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu);
+ ct_cpuidle_exit();

/*
* Resume L2 cache if it wasn't re-enabled early during resume,
diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c
index d2fc216c38fc..131cbcb31517 100644
--- a/drivers/cpuidle/cpuidle-tegra.c
+++ b/drivers/cpuidle/cpuidle-tegra.c
@@ -109,12 +109,14 @@ static void tegra_cpuidle_unpark_secondary_cpus(void)
}
}

-static int tegra_cpuidle_cc6_enter(unsigned int cpu)
+static __cpuidle int tegra_cpuidle_cc6_enter(unsigned int cpu)
{
int ret;

if (cpu > 0) {
+ ct_cpuidle_enter();
ret = cpu_suspend(cpu, tegra_pm_park_secondary_cpu);
+ ct_cpuidle_exit();
} else {
ret = tegra_cpuidle_wait_for_secondary_cpus_parking();
if (!ret)
@@ -126,7 +128,7 @@ static int tegra_cpuidle_cc6_enter(unsigned int cpu)
return ret;
}

-static int tegra_cpuidle_c7_enter(void)
+static __cpuidle int tegra_cpuidle_c7_enter(void)
{
int err;

@@ -134,7 +136,11 @@ static int tegra_cpuidle_c7_enter(void)
if (err && err != -ENOSYS)
return err;

- return cpu_suspend(0, tegra30_pm_secondary_cpu_suspend);
+ ct_cpuidle_enter();
+ err = cpu_suspend(0, tegra30_pm_secondary_cpu_suspend);
+ ct_cpuidle_exit();
+
+ return err;
}

static int tegra_cpuidle_coupled_barrier(struct cpuidle_device *dev)
@@ -183,8 +189,6 @@ static __cpuidle int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
tegra_pm_set_cpu_in_lp2();
cpu_pm_enter();

- ct_cpuidle_enter();
-
switch (index) {
case TEGRA_C7:
err = tegra_cpuidle_c7_enter();
@@ -199,8 +203,6 @@ static __cpuidle int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
break;
}

- ct_cpuidle_exit();
-
cpu_pm_exit();
tegra_pm_clear_cpu_in_lp2();
local_fiq_enable();

---
base-commit: 185f43f084029d63fbb39dc93ad98912059a9d73
change-id: 20261130-upstream-cpuidle-tegra-rcu-bce826e44d11

Best regards,
--
Patrick Fischer <admin@xxxxxxxxxxxxxxxxxx>