Bug 292568 - ACPI S3 broken on CURRENT (system can enter sleep state only once)
Summary: ACPI S3 broken on CURRENT (system can enter sleep state only once)
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 16.0-CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: dogfood, needs-patch, regression
Depends on:
Blocks:
 
Reported: 2026-01-18 16:34 UTC by Marek Zarychta
Modified: 2026-01-19 16:58 UTC (History)
5 users (show)

See Also:


Attachments
enter_s3without_limit.diff (442 bytes, patch)
2026-01-19 10:09 UTC, Marek Zarychta
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Zarychta 2026-01-18 16:34:24 UTC
After commit 7669cbd0f06402573fe627e9e6f86c69cfd3d12b (“acpi: Suspend-to-idle support (s2idle)”), the system can enter the S3 sleep state only once. Following the first resume, the system is no longer able to suspend again. Reverting this commit removes the limitation and allows unlimited suspend/resume cycles.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2026-01-18 23:18:03 UTC
^Triage: fix typo in Cc: .
Comment 2 Nuno Teixeira freebsd_committer freebsd_triage 2026-01-19 07:54:42 UTC
(In reply to Marek Zarychta from comment #0)

Hello Marek,

Could "acpi0: request to enter state NONE failed (err 22)" be related when closing/opening laptop?

Cheers
Comment 3 Marek Zarychta 2026-01-19 08:26:51 UTC
(In reply to Nuno Teixeira from comment #2)
I don’t know, this is most likely a different bug. This bug manifests itself in such a way that after the first wake-up, the acpiconf -s 3 or acpiconf -s S3 command hangs (it cannot be interrupted or killed), and the computer (in this case, a desktop PC) does not enter sleep mode.

I can confirm that the situation you are describing occurs on a laptop with 16.0-CURRENT. FreeBSD 15.0-STABLE correctly handles suspend and resume via opening and closing the laptop lid. FreeBSD 16.0-CURRENT does not, and there the situation is exactly as you describe, but it is still possible to suspend the system using a command, and waking up from opening the lid works normally.

Therefore, the situation you described is a different kind of regression, which was probably not reported before. Bisecting will be harder here because it is not known when it was exactly broken.
Comment 4 Marek Zarychta 2026-01-19 08:49:20 UTC
(In reply to Nuno Teixeira from comment #2)
With regard to the issue you reported, it is sufficient to set, for example, via an entry in sysctl.conf, hw.acpi.lid_switch_state=s2mem, and everything returns to normal - suspending by closing the lid works again. It appears that this was changed in commit eeaa865edba68.
Comment 5 Marek Zarychta 2026-01-19 10:09:36 UTC
Created attachment 267294 [details]
enter_s3without_limit.diff

This trivial patch resolves the issue. Forgive me for making a storm in a teapot on the current@ mailing list.
Comment 6 Aymeric Wibo freebsd_committer freebsd_triage 2026-01-19 13:12:46 UTC
Marek, can you send me the contents of the hw.acpi and kern.power sysctl trees? Just to be sure your machine is actually selecting s2mem/S3 (as it should) and its not accidentally trying to enter s2idle.

I'm surprised your patch fixes the issue, because all unsetting the bits in slp_state only serves to make sure it is ACPI_SS_NONE after cleanup (see the MPASS).
Comment 7 Aymeric Wibo freebsd_committer freebsd_triage 2026-01-19 13:14:31 UTC
Sorry scratch that, I just realized that ACPI_SS_SLP_PREP is being used after its being unset in the if statement surrounding the AcpiLeaveSleepState() call. I'm preparing a fix for this right now.
Comment 8 Aymeric Wibo freebsd_committer freebsd_triage 2026-01-19 13:31:08 UTC
Can you try this patch out and see if it fixes S3 entry for you?

https://reviews.freebsd.org/D54777
Comment 9 Marek Zarychta 2026-01-19 13:32:43 UTC
(In reply to Aymeric Wibo from comment #6)
It's the same machine that was used on bug 289634 submission. Please reuse data from that PR if it's really required, and if the bug isn't reproducible (I believe it is).
Comment 10 Marek Zarychta 2026-01-19 13:53:21 UTC
(In reply to Aymeric Wibo from comment #8)
This patch solves the problem as well. Thank you for giving opportunity to test it.
Comment 11 commit-hook freebsd_committer freebsd_triage 2026-01-19 16:30:31 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=4b534b814aa03b44660ede6d5f1a62cb33c24115

commit 4b534b814aa03b44660ede6d5f1a62cb33c24115
Author:     Aymeric Wibo <obiwac@FreeBSD.org>
AuthorDate: 2026-01-19 13:19:52 +0000
Commit:     Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2026-01-19 16:30:10 +0000

    acpi: Fix not calling AcpiLeaveSleepState() in S3 path

    When resuming from ACPI suspend, the ACPI_SS_SLP_PREP bit in slp_state
    was being checked and subsequently unset when calling resumeclock().
    This bit was also being checked for the AcpiLeaveSleepState() call in
    the non-s2idle path, but having just been unset, it was never actually
    being called.

    Change this so that resumeclock() is always being called (since we never
    goto breakout between suspendclock() and resumeclock() anyway) and
    ACPI_SS_SLP_PREP is purely used for AcpiEnterSleepStatePrep() and
    AcpiLeaveSleepState() in the non-s2idle paths.

    PR:             292568
    Reported by:    Marek Zarychta
    Reviewed by:    olce
    Tested by:      Marek Zarychta
    Approved by:    olce
    Fixes:  7669cbd0f064 (“acpi: Suspend-to-idle support (s2idle)”)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D54777

 sys/dev/acpica/acpi.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
Comment 12 Marek Zarychta 2026-01-19 16:33:21 UTC
Thank you for fixing it !
Comment 13 Aymeric Wibo freebsd_committer freebsd_triage 2026-01-19 16:58:52 UTC
And thank you for reporting this and testing the fix so promptly :)