On Wed, Sep 10, 2025 at 7:48 PM Mario Limonciello <supe...@kernel.org> wrote: > > On 9/10/25 8:58 AM, Rafael J. Wysocki wrote: > > On Tue, Sep 9, 2025 at 9:16 PM Mario Limonciello (AMD) > > <supe...@kernel.org> wrote: > >> > >> PMSG_POWEROFF will be used for the PM core to allow differentiating between > >> a hibernation or shutdown sequence when re-using callbacks. > >> > >> This event should not have wakeups enabled > > > > Why? > > > > It surely is valid to wake up the system while it is being powered > > off, especially in the hibernation case. > > In the hibernation case - yes you want wakeups. > > But in what is perceived as powering off the machine it's not expected > that you would have wakeups. > > If I have a USB mouse connected and set as a wakeup source, I can click > the mouse and the machine wakes up. A user wouldn't expect that happens > with a powered off machine. > > That's certainly not how it works today at least.
Sure, but you want to use the same transition mechanism to handle those two cases. In one of them, you don't want wakeup events to be disabled, so you cannot do that at the transition type level. > > > > The "poweroff" transition is generally not recoverable, however, so it > > may be better to complete it and trigger a reboot if wakeup has been > > signaled. > > Hmm, I'm not sure about that. Back to hypothesizing on the USB mouse case: > If I'm entering suspend, the mouse is an enabled wakeup source and I'm > moving the mouse the suspend should be aborted. > > But if I requested the machine to be powered off and and I clicked the > mouse while powering off that would be an "aborted power off?. > Wouldn't that be really counterintuitive to reboot instead? I was talking about the last stage of hibernation, sorry if that wasn't clear enough. So in the last stage of hibernation, which also carries out a "power-off" transition (if run in the "platform" mode that is), you want wakeups to be enabled, don't you? But the "power-off" transition is not recoverable in general (IOW, it cannot be reliably rolled back, at least as of today), it may be better to complete it and make the kernel load the just created hibernation image and restore from it in response to a wakeup event. Something like the latter is already done in the "test_resume" hibernation mode. > IE as a user you expect that pressing the power button gets you an off > machine, not a different result based on other activity. That's a slightly different case, but if you press the power button once while hibernation is in progress, you may actually expect to get back to the pre-hibernation state (or at least hope that this is going to happen).