* FAILED: patch "[PATCH] arm64: suspend: Only track cpuidle context for idle tasks" failed to apply to 6.18-stable tree
@ 2026-11-25 10:08 gregkh
2026-11-25 16:15 ` [PATCH 6.18.y 1/2] arm64: suspend: rely on daif helpers to handle PMR Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2026-11-25 10:08 UTC (permalink / raw)
To: uladzislau.zhauniarovich, catalin.marinas, stable; +Cc: stable
The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x ad3fc05c7e65009355effeea06aa629a687acef2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026112539-amenity-spinster-254c@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ad3fc05c7e65009355effeea06aa629a687acef2 Mon Sep 17 00:00:00 2001
From: Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
Date: Thu, 5 Nov 2026 20:19:45 +0000
Subject: [PATCH] arm64: suspend: Only track cpuidle context for idle tasks
Commit 19235e472798 ("cpuidle, arm64: Fix the ARM64 cpuidle logic") moved
the calls to ct_cpuidle_enter() and ct_cpuidle_exit() into cpu_suspend() so
that arm64 cpuidle could keep RCU watching longer and manage context
tracking internally. However, cpu_suspend() is called not only by cpuidle
via psci_cpu_suspend_enter() (which runs in the context of the idle task),
but also during system suspend via psci_system_suspend_enter() (which runs
in the context of the task initiating suspend, such as a process writing to
/sys/power/state).
When entering system suspend, current is a non-idle task. Calling
ct_cpuidle_enter() invokes ct_kernel_exit() from kernel space (!user) on a
non-idle task. With CONFIG_RCU_EQS_DEBUG enabled, this violates context
tracking invariants and triggers a warning:
WARNING: kernel/context_tracking.c:120 at ct_kernel_exit+0x1b4/0x1f4
kernel/context_tracking.c:118
Call trace:
ct_kernel_exit+0x1b4/0x1f4 kernel/context_tracking.c:118
ct_idle_enter+0x20/0x34 kernel/context_tracking.c:299
ct_cpuidle_enter include/linux/cpuidle.h:134 [inline]
cpu_suspend+0x264/0x474 arch/arm64/kernel/suspend.c:136
psci_system_suspend_enter+0x4c/0x80 drivers/firmware/psci/psci.c:544
suspend_enter kernel/power/suspend.c:468 [inline]
suspend_devices_and_enter+0x88c/0xd0c kernel/power/suspend.c:533
enter_state kernel/power/suspend.c:618 [inline]
pm_suspend+0x498/0x698 kernel/power/suspend.c:644
state_store+0x14c/0x1fc kernel/power/main.c:819
kobj_attr_store+0x6c/0x90 lib/kobject.c:842
sysfs_kf_write+0xe0/0x108 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x260/0x3b8 fs/kernfs/file.c:345
vfs_write+0x51c/0xa0c fs/read_write.c:687
ksys_write+0x12c/0x228 fs/read_write.c:739
A corresponding warning is subsequently triggered in ct_kernel_enter() via
ct_cpuidle_exit() upon resume.
Fix this by checking is_idle_task(current) in cpu_suspend() and only
invoking ct_cpuidle_enter() and ct_cpuidle_exit() when executing in the
context of an idle task.
Fixes: 19235e472798 ("cpuidle, arm64: Fix the ARM64 cpuidle logic")
Cc: <stable@vger.kernel.org>
Assisted-by: Gemini:gemini-3.8-flash Gemini:gemini-3.1-pro-preview syzbot
Reported-by: syzbot+79883955da3a62652a80@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=79883955da3a62652a80
Link: https://syzkaller.appspot.com/ai_job?id=5359e16f-013b-4850-9cbc-ddfb3bac95e5
Signed-off-by: Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
Tested-by: Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
Link: https://lore.kernel.org/r/3e92ccb0-2952-4317-af4c-45457c15efae@gmail.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index c41724a40b75..cde0b8c19377 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -5,6 +5,7 @@
#include <linux/uaccess.h>
#include <linux/pgtable.h>
#include <linux/cpuidle.h>
+#include <linux/sched.h>
#include <asm/alternative.h>
#include <asm/cacheflush.h>
#include <asm/cpufeature.h>
@@ -99,6 +100,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
int ret = 0;
unsigned long flags;
struct sleep_stack_data state;
+ bool idle = is_idle_task(current);
/*
* Some portions of CPU state (e.g. PSTATE.{PAN,DIT}) are initialized
@@ -133,7 +135,8 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
*/
pause_graph_tracing();
- ct_cpuidle_enter();
+ if (idle)
+ ct_cpuidle_enter();
if (__cpu_suspend_enter(&state)) {
/* Call the suspend finisher */
@@ -149,9 +152,11 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
if (!ret)
ret = -EOPNOTSUPP;
- ct_cpuidle_exit();
+ if (idle)
+ ct_cpuidle_exit();
} else {
- ct_cpuidle_exit();
+ if (idle)
+ ct_cpuidle_exit();
__cpu_suspend_exit();
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 6.18.y 1/2] arm64: suspend: rely on daif helpers to handle PMR
2026-11-25 10:08 FAILED: patch "[PATCH] arm64: suspend: Only track cpuidle context for idle tasks" failed to apply to 6.18-stable tree gregkh
@ 2026-11-25 16:15 ` Sasha Levin
2026-11-25 16:15 ` [PATCH 6.18.y 2/2] arm64: suspend: Only track cpuidle context for idle tasks Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2026-11-25 16:15 UTC (permalink / raw)
To: stable
Cc: Ada Couprie Diaz, Vladimir Murzin, Jinjie Ruan, Will Deacon,
Sasha Levin
From: Ada Couprie Diaz <ada.coupriediaz@arm.com>
[ Upstream commit 630ca6c58fcfeaddd96dd46e7b11826013977955 ]
Commit 77345ef70445 ("arm64: suspend: Use cpuidle context helpers
in cpu_suspend()") added cpuidle helpers to handle PMR manipulation
and restoration to ensure that the CPU receives interrupts when suspended
and pseudo-NMIs are enabled.
However, those helpers are called in between a pair of `local_daif_save()`
and `local_daif_restore()`, which already configure the PMR as expected.
Effectively, `arm_cpuidle_save_irq_context()` is a no-op here,
even when using pseudo-NMIs, and `arm_cpuidle_restore_irq_context()`
would not restore proper interrupt masking configuration early enough
if there were unexpected changes during suspend or resume.
(This can be observed with Trusted Firmware A (TF-A) at EL3 handling
suspend through PSCI. Even though it should not be the case, TF-A can
reset `ICC_PMR_EL1` during CPU_SUSPEND, thus resuming the kernel
with an inconsistent priority mask value on hardware implementing
more than the minimum number of priority levels, such as Morello.)
Thus : remove the cpuidle context helpers as they do not do anything,
but keep the comment mentioning the need for interrupts to reach the CPU
if we are using pseudo-NMIs.
Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Reviewed-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Will Deacon <will@kernel.org>
Stable-dep-of: ad3fc05c7e65 ("arm64: suspend: Only track cpuidle context for idle tasks")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/kernel/suspend.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index eaaff94329cdd..c41724a40b756 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -99,7 +99,6 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
int ret = 0;
unsigned long flags;
struct sleep_stack_data state;
- struct arm_cpuidle_irq_context context;
/*
* Some portions of CPU state (e.g. PSTATE.{PAN,DIT}) are initialized
@@ -121,6 +120,9 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
* Strictly speaking the trace_hardirqs_off() here is superfluous,
* hardirqs should be firmly off by now. This really ought to use
* something like raw_local_daif_save().
+ *
+ * This also unmasks interrupts in PMR in order to reliably
+ * resume if we're using pseudo-NMIs.
*/
flags = local_daif_save();
@@ -131,12 +133,6 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
*/
pause_graph_tracing();
- /*
- * Switch to using DAIF.IF instead of PMR in order to reliably
- * resume if we're using pseudo-NMIs.
- */
- arm_cpuidle_save_irq_context(&context);
-
ct_cpuidle_enter();
if (__cpu_suspend_enter(&state)) {
@@ -159,8 +155,6 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
__cpu_suspend_exit();
}
- arm_cpuidle_restore_irq_context(&context);
-
unpause_graph_tracing();
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 6.18.y 2/2] arm64: suspend: Only track cpuidle context for idle tasks
2026-11-25 16:15 ` [PATCH 6.18.y 1/2] arm64: suspend: rely on daif helpers to handle PMR Sasha Levin
@ 2026-11-25 16:15 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-11-25 16:15 UTC (permalink / raw)
To: stable
Cc: Uladzislau Zhauniarovich, syzbot+79883955da3a62652a80,
Catalin Marinas, Sasha Levin
From: Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
[ Upstream commit ad3fc05c7e65009355effeea06aa629a687acef2 ]
Commit 19235e472798 ("cpuidle, arm64: Fix the ARM64 cpuidle logic") moved
the calls to ct_cpuidle_enter() and ct_cpuidle_exit() into cpu_suspend() so
that arm64 cpuidle could keep RCU watching longer and manage context
tracking internally. However, cpu_suspend() is called not only by cpuidle
via psci_cpu_suspend_enter() (which runs in the context of the idle task),
but also during system suspend via psci_system_suspend_enter() (which runs
in the context of the task initiating suspend, such as a process writing to
/sys/power/state).
When entering system suspend, current is a non-idle task. Calling
ct_cpuidle_enter() invokes ct_kernel_exit() from kernel space (!user) on a
non-idle task. With CONFIG_RCU_EQS_DEBUG enabled, this violates context
tracking invariants and triggers a warning:
WARNING: kernel/context_tracking.c:120 at ct_kernel_exit+0x1b4/0x1f4
kernel/context_tracking.c:118
Call trace:
ct_kernel_exit+0x1b4/0x1f4 kernel/context_tracking.c:118
ct_idle_enter+0x20/0x34 kernel/context_tracking.c:299
ct_cpuidle_enter include/linux/cpuidle.h:134 [inline]
cpu_suspend+0x264/0x474 arch/arm64/kernel/suspend.c:136
psci_system_suspend_enter+0x4c/0x80 drivers/firmware/psci/psci.c:544
suspend_enter kernel/power/suspend.c:468 [inline]
suspend_devices_and_enter+0x88c/0xd0c kernel/power/suspend.c:533
enter_state kernel/power/suspend.c:618 [inline]
pm_suspend+0x498/0x698 kernel/power/suspend.c:644
state_store+0x14c/0x1fc kernel/power/main.c:819
kobj_attr_store+0x6c/0x90 lib/kobject.c:842
sysfs_kf_write+0xe0/0x108 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x260/0x3b8 fs/kernfs/file.c:345
vfs_write+0x51c/0xa0c fs/read_write.c:687
ksys_write+0x12c/0x228 fs/read_write.c:739
A corresponding warning is subsequently triggered in ct_kernel_enter() via
ct_cpuidle_exit() upon resume.
Fix this by checking is_idle_task(current) in cpu_suspend() and only
invoking ct_cpuidle_enter() and ct_cpuidle_exit() when executing in the
context of an idle task.
Fixes: 19235e472798 ("cpuidle, arm64: Fix the ARM64 cpuidle logic")
Cc: <stable@vger.kernel.org>
Assisted-by: Gemini:gemini-3.8-flash Gemini:gemini-3.1-pro-preview syzbot
Reported-by: syzbot+79883955da3a62652a80@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=79883955da3a62652a80
Link: https://syzkaller.appspot.com/ai_job?id=5359e16f-013b-4850-9cbc-ddfb3bac95e5
Signed-off-by: Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
Tested-by: Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
Link: https://lore.kernel.org/r/3e92ccb0-2952-4317-af4c-45457c15efae@gmail.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/kernel/suspend.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index c41724a40b756..cde0b8c19377e 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -5,6 +5,7 @@
#include <linux/uaccess.h>
#include <linux/pgtable.h>
#include <linux/cpuidle.h>
+#include <linux/sched.h>
#include <asm/alternative.h>
#include <asm/cacheflush.h>
#include <asm/cpufeature.h>
@@ -99,6 +100,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
int ret = 0;
unsigned long flags;
struct sleep_stack_data state;
+ bool idle = is_idle_task(current);
/*
* Some portions of CPU state (e.g. PSTATE.{PAN,DIT}) are initialized
@@ -133,7 +135,8 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
*/
pause_graph_tracing();
- ct_cpuidle_enter();
+ if (idle)
+ ct_cpuidle_enter();
if (__cpu_suspend_enter(&state)) {
/* Call the suspend finisher */
@@ -149,9 +152,11 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
if (!ret)
ret = -EOPNOTSUPP;
- ct_cpuidle_exit();
+ if (idle)
+ ct_cpuidle_exit();
} else {
- ct_cpuidle_exit();
+ if (idle)
+ ct_cpuidle_exit();
__cpu_suspend_exit();
}
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-25 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 10:08 FAILED: patch "[PATCH] arm64: suspend: Only track cpuidle context for idle tasks" failed to apply to 6.18-stable tree gregkh
2026-11-25 16:15 ` [PATCH 6.18.y 1/2] arm64: suspend: rely on daif helpers to handle PMR Sasha Levin
2026-11-25 16:15 ` [PATCH 6.18.y 2/2] arm64: suspend: Only track cpuidle context for idle tasks Sasha Levin
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.