https://bugs.kde.org/show_bug.cgi?id=528651

Eli <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Eli <[email protected]> ---
Same failure here, but triggered by the critical-battery action rather than the
lid, and I think I found why it fails every time at low battery.

System: HP Spectre x360 14-eu0xxx (BIOS F.15), CachyOS, kernel 7.3.4-1-cachyos,
Plasma/PowerDevil 6.8.3, systemd 262.2, UPower 1.91.5. mem_sleep: [s2idle]
deep. Hibernation set up and working (swap partition, resume= set).

What happened: battery reached the critical level (5%), PowerDevil requested
hibernate, and it failed 47 times in a row, about once a minute, until the
battery died:
  systemd-sleep: Failed to put system to sleep. System resumed again: Device or
resource busy
Kernel log for each attempt: "PM: hibernation: hibernation entry" ->
"Filesystems sync: 0.015 seconds" -> "PM: hibernation: hibernation exit", with
no freezing in between.
org.kde.powerdevil.wakeupsourcehelper runs right before every attempt (e.g.
helper at 00:58:14, hibernate at 00:58:18).

Why (as far as I can tell):
1. Since 6.19 ("PM: Support aborting sleep during filesystem sync"),
pm_sleep_fs_sync() returns -EBUSY if a wakeup event is pending during the fs
sync. That matches the log exactly (abort right after the sync line).
2. The ACPI battery driver fires a wakeup event on every battery update once
capacity is at or below the firmware alarm level (acpi_battery_update: wakeup =
critical || capacity_now <= alarm). On this laptop the alarm is 6.012 of 60.578
Wh, about 10%.
3. PowerDevil's wakeupsourcehelper arms wakeup-event checking before the sleep,
so those battery events abort it.
So any critical-battery hibernate below the firmware alarm level gets
cancelled, every retry.

Confirmation: a dry run (pm_test=freezer, systemctl hibernate directly, not via
PowerDevil) passes on battery at 70%.
Workaround that works here: a systemd unit (WantedBy=hibernate.target,
StopWhenUnneeded=yes) that writes "disabled" to
/sys/bus/platform/devices/PNP0C0A:00/power/wakeup before hibernation and
restores it afterwards.

Suggestions: don't arm wakeup counting (dark resume) for hibernation, at least
not for the critical-battery action; and stop retrying after a failure with a
notification instead of looping until the battery dies. Possibly related: bug
510992.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to