FAILED: patch "[PATCH] panic: flatten nmi_panic control flow" failed to apply to 6.12-stable tree
Sasha Levin
maintainerThe patch below does not apply to the 6.12-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 <[email protected]>.
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.12.y
git checkout FETCH_HEAD
git cherry-pick -x 75eb687ff2bcec9fba31bbe266e5f91e5c283efe
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 75eb687ff2bcec9fba31bbe266e5f91e5c283efe Mon Sep 17 00:00:00 2001
From: Bradley Morgan <[email protected]>
Date: Wed, 16 Sep 2026 18:29:53 +0000
Subject: [PATCH] panic: flatten nmi_panic control flow
panic() is __noreturn, so the else after panic_try_start() is dead. Drop it so the force_cpu path can be added cleanly on top.
--- kernel/panic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/panic.c +2 -1
@@ -517,7 +517,8 @@ void nmi_panic(struct pt_regs *regs, const char *msg) {if (panic_try_start ())panic ("%s" , msg); -else if (panic_on_other_cpu ()) + +if (panic_on_other_cpu ())nmi_panic_self_stop (regs); }EXPORT_SYMBOL (nmi_panic);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/2 panic: use panic_try_start() in nmi_panic()
From: Jinchao Wang <[email protected]>
[ Upstream commit 6b69c7ef96f1afc7b426195087f7488f1510c2a4 ]
nmi_panic() duplicated the logic to claim panic_cpu with atomic_try_cmpxchg. This is already wrapped in panic_try_start().
Replace the open-coded logic with panic_try_start(), and use panic_on_other_cpu() for the fallback path.
This removes duplication and keeps panic handling code consistent.
Stable-dep-of: 75eb687ff2bc ("panic: flatten nmi_panic control flow")
--- kernel/panic.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
kernel/panic.c +2 -8
@@ -248,15 +248,9 @@ EXPORT_SYMBOL(panic_on_other_cpu);*/ void nmi_panic (struct pt_regs *regs,const char *msg) { -int old_cpu, this_cpu; - - old_cpu =PANIC_CPU_INVALID ; - this_cpu =raw_smp_processor_id (); - -/* atomic_try_cmpxchg updates old_cpu on failure */ -if (atomic_try_cmpxchg (&panic_cpu, &old_cpu, this_cpu)) +if (panic_try_start ())panic ("%s" , msg); -else if (old_cpu != this_cpu) +else if (panic_on_other_cpu ())nmi_panic_self_stop (regs); }EXPORT_SYMBOL (nmi_panic);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 panic: flatten nmi_panic control flow
From: Bradley Morgan <[email protected]>
[ Upstream commit 75eb687ff2bcec9fba31bbe266e5f91e5c283efe ]
panic() is __noreturn, so the else after panic_try_start() is dead. Drop it so the force_cpu path can be added cleanly on top.
--- kernel/panic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/panic.c +2 -1
@@ -250,7 +250,8 @@ void nmi_panic(struct pt_regs *regs, const char *msg) {if (panic_try_start ())panic ("%s" , msg); -else if (panic_on_other_cpu ()) + +if (panic_on_other_cpu ())nmi_panic_self_stop (regs); }EXPORT_SYMBOL (nmi_panic);
Signature · 1 line
2.53.0