Linux ACPI
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: usama.anjum@collabora.com,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-input@vger.kernel.org,
	kernel@collabora.com, superm1@kernel.org
Subject: Re: [PATCH 2/4] ACPI: button: Cancel hibernation if button is pressed during hibernation
Date: Tue, 25 Nov 2025 21:41:22 +0500	[thread overview]
Message-ID: <cef1d96b-b642-4e69-8c1b-2e0bf7528edf@collabora.com> (raw)
In-Reply-To: <2025112506-acting-tipoff-3a49@gregkh>

On 11/25/25 4:47 PM, Greg Kroah-Hartman wrote:
> 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@collabora.com>
>>>
>> 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?  :)
I think, the new behavior would be desirable by most distros. They don't care
about the old behavior. But its just my thinking. What do you think is the way forward?

Even if there are users which used to pressing power button during hibernation,
will not press it after a few tries if they really want the hibernation to complete.

> 
>>> 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?
That's in the plan. But who knows when we get time to attempt that. 

First I need a board/machine with serial console access to view all logs in real
time. :)

---
Thanks,
Usama

  reply	other threads:[~2025-11-25 16:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07 18:44 [PATCH 0/4] PM: Hibernate: Add hibernation cancellation support Muhammad Usama Anjum
2025-11-07 18:44 ` [PATCH 1/4] PM: hibernate: export pm_sleep_transition_in_progress() Muhammad Usama Anjum
2025-11-24 17:01   ` Greg Kroah-Hartman
2025-11-25 16:44     ` Muhammad Usama Anjum
2025-11-07 18:44 ` [PATCH 2/4] ACPI: button: Cancel hibernation if button is pressed during hibernation Muhammad Usama Anjum
2025-11-24 17:03   ` Greg Kroah-Hartman
2025-11-25 11:12     ` Muhammad Usama Anjum
2025-11-25 11:47       ` Greg Kroah-Hartman
2025-11-25 16:41         ` Muhammad Usama Anjum [this message]
2025-11-26  7:38           ` Greg Kroah-Hartman
2025-11-26 12:55             ` Mario Limonciello
2025-11-26 13:26               ` Muhammad Usama Anjum
2025-11-26 13:41             ` Muhammad Usama Anjum
2025-11-24 18:42   ` Rafael J. Wysocki
2025-11-28 14:17     ` Muhammad Usama Anjum
2025-11-07 18:44 ` [PATCH 3/4] Input: Ignore the KEY_POWER events if hibernation is in progress Muhammad Usama Anjum
2025-11-24 18:50   ` Rafael J. Wysocki
2025-11-25 10:22     ` Muhammad Usama Anjum
2025-11-25 12:25       ` Rafael J. Wysocki
2025-11-25 16:05         ` Muhammad Usama Anjum
2025-11-28 17:00         ` Muhammad Usama Anjum
2025-11-07 18:44 ` [PATCH 4/4] PM: sleep: clear pm_abort_suspend at suspend Muhammad Usama Anjum
2025-11-24 18:54   ` Rafael J. Wysocki
2025-11-25  9:53     ` Muhammad Usama Anjum
2025-11-25 12:59       ` Rafael J. Wysocki
2025-11-24 13:03 ` [PATCH 0/4] PM: Hibernate: Add hibernation cancellation support Muhammad Usama Anjum
2026-01-02 22:40 ` Pavel Machek

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=cef1d96b-b642-4e69-8c1b-2e0bf7528edf@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=dakr@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@collabora.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=superm1@kernel.org \
    --cc=tglx@linutronix.de \
    /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