Re: [PATCH 2/4] ACPI: button: Cancel hibernation if button is pressed during hibernation

From: Greg Kroah-Hartman
Date: Tue Nov 25 2025 - 06:48:01 EST


On Tue, Nov 25, 2025 at 04:12:54PM +0500, Muhammad Usama Anjum wrote:
> Hi Greg,
>
> Thank you for the review.
>
> On 11/24/25 10:03 PM, Greg Kroah-Hartman wrote:
> > On Fri, Nov 07, 2025 at 11:44:29PM +0500, Muhammad Usama Anjum wrote:
> >> acpi_pm_wakeup_event() is called from acpi_button_notify() which is
> >> called when power button is pressed. The system is worken up from s2idle
> >> in this case by setting hard parameter to pm_wakeup_dev_event().
> >>
> >> Call acpi_pm_wakeup_event() if power button is pressed and hibernation
> >> is in progress. Set the hard parameter such that pm_system_wakeup()
> >> gets called which increments pm_abort_suspend counter. The explicit call
> >> to acpi_pm_wakeup_event() is necessary as ACPI button device has the
> >> wakeup source. Hence call to input_report_key() with input device
> >> doesn't call pm_system_wakeup() as it doesn't have wakeup source
> >> registered.
> >>
> >> Hence hibernation would be cancelled as in hibernation path, this counter
> >> is checked if it should be aborted.
> >>
> >> Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>
> >
> My thinking is that people don't press power button after triggering
> hibernation. They will only press power button if they want to cancel the
> hibernation or resume from hibernation a bit later when hibernation completes.
> > This could be dangerous, as this is not what happens today, are you sure
> > that people aren't just used to pressing the button multiple times until
> > the system is hibernated? If so, that would now break with this change
> > as it's hard to determine what is going on.
> Yes, its possible. Previously the device wouldn't cancel hibernation on power
> button press; while now it'll cancel.
>
> So should we put this cancellation under some config option to avoid breaking
> the default behavior?

Do not add another config option, that way lies madness. As proof, what
would your distro select for this, in order to preserve old behavior? :)

> > And why does hibernate take so long? Why not fix that up instead?
> Hibernation is inherently slow: it must freeze devices, copy and
> compress/encrypt memory, then resume storage devices to write the image to
> disk.
>
> While I've thought about increasing the speed, I've no concrete ideas yet.
> The main problem is that its sequential in nature.

Then fix that?

thanks,

greg k-h