mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PM: hibernate: Don't lose create_image() errors to arch_resume_nosmt()
@ 2026-10-18 16:39 Cole Leavitt
  0 siblings, 0 replies; only message in thread
From: Cole Leavitt @ 2026-10-18 16:39 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Cole Leavitt, Pavel Machek, Len Brown, Josh Poimboeuf,
	Jiri Kosina, Thomas Gleixner, linux-pm, linux-kernel

create_image() calls arch_resume_nosmt() on every path that returns
with in_suspend cleared and assigns its return value to error.  That
includes the error paths taken when pm_sleep_disable_secondary_cpus()
or syscore_suspend() fails, which jump to Enable_cpus/Enable_irqs.

When SMT is not disabled (for example on CPUs without SMT, where
cpu_smt_control is CPU_SMT_NOT_SUPPORTED), arch_resume_nosmt() returns
0, so the failure is lost:  create_image() returns 0 with in_suspend
unset, hibernation_snapshot() treats that as a successful restore and
hibernate() reports success to user space although no image was
created.  A wakeup event that aborts image creation in syscore_suspend()
is thus indistinguishable from resuming a hibernation image.

Only call arch_resume_nosmt() when image creation succeeded.  Failures
now propagate, so a wakeup event that makes syscore_suspend() fail
returns -EBUSY to user space, like wakeup aborts in freeze_processes()
and dpm_suspend() already do.

Fixes: ec527c318036 ("x86/power: Fix 'nosmt' vs hibernation triple fault during resume")
Cc: stable@vger.kernel.org
Signed-off-by: Cole Leavitt <cole@unwrap.rs>
---

Notes:
    Tested on a Lenovo ThinkPad P16 Gen 3 (Core Ultra 9 275HX, JHL9580
    Barlow Ridge host, I226 Ethernet), in daily use since 2026-09-17.

 kernel/power/hibernate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index c13f68ab7f6e..f53f844114a1 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -380,7 +380,7 @@ static int create_image(int platform_mode)
 	pm_sleep_enable_secondary_cpus();
 
 	/* Allow architectures to do nosmt-specific post-resume dances */
-	if (!in_suspend)
+	if (!in_suspend && !error)
 		error = arch_resume_nosmt();
 
  Platform_finish:

base-commit: 32c52ec87d6245ee2d12ed5dd509e40062939b50
-- 
2.54.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-18 16:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18 16:39 [PATCH] PM: hibernate: Don't lose create_image() errors to arch_resume_nosmt() Cole Leavitt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®