mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cole Leavitt <cole@unwrap.rs>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Cole Leavitt <cole@unwrap.rs>, Pavel Machek <pavel@kernel.org>,
	Len Brown <lenb@kernel.org>, Josh Poimboeuf <jpoimboe@kernel.org>,
	Jiri Kosina <jikos@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] PM: hibernate: Don't lose create_image() errors to arch_resume_nosmt()
Date: Sun, 18 Oct 2026 12:39:42 -0400	[thread overview]
Message-ID: <20261018164004.132785-1-cole@unwrap.rs> (raw)

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


                 reply	other threads:[~2026-10-18 16:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261018164004.132785-1-cole@unwrap.rs \
    --to=cole@unwrap.rs \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®