mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,  Pavel Machek <pavel@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Danilo Krummrich	 <dakr@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>,
	Peter Zijlstra	 <peterz@infradead.org>
Cc: kernel@collabora.com, linux-pm@vger.kernel.org,
	driver-core@lists.linux.dev, 	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] PM: sleep: Return -ECANCELED if aborting due to pm_wakeup_pending()
Date: Tue, 21 Jul 2026 17:25:53 -0300	[thread overview]
Message-ID: <73718a50f53f1ba8963a7ea40516a008d5c1a67c.camel@collabora.com> (raw)
In-Reply-To: <20260609-wakeup-pending-ecanceled-v1-1-428d897c07cb@collabora.com>

On Tue, 2026-06-09 at 08:48 -0400, Nícolas F. R. A. Prado wrote:
> If system sleep (suspend or hibernate) has been aborted due to
> pm_wakeup_pending() returning true, return -ECANCELED so userspace
> can
> tell it apart from actual failures.
> 
> ECANCELED is chosen both because it is a less common error code, so
> it is less likely to be used for purposes other than the sleep abort
> due
> to pending wakeups in this code path, and also because it more
> clearly
> represents that the sleep was intentionally canceled.
> 
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
> To give more context on my specific use case:
> 
> I want to address the situation where the system is running systemd's
> suspend-then-hibernate and while going into hibernation, the user
> triggers a wakeup (by pressing the power button). The expectation is
> that the system would abort suspend-then-hibernate and wakeup, but
> instead it considers that as a hibernation failure and falls back to
> suspend instead. The key thing here is that systemd isn't able to
> tell
> that this hibernation failure is not really a failure but an
> intentional
> abort, which is where the consistent error code for
> pm_wakeup_pending()
> can solve the problem.
> 
> Sending as an RFC as this is changing an ABI and although I'm not
> aware
> of userspace that relies on the current error codes, it would be good
> to
> get more input on this.

Hi,

Any feedback on this RFC?

-- 
Thanks,

Nícolas

      reply	other threads:[~2026-07-21 20:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 12:48 Nícolas F. R. A. Prado
2026-07-21 20:25 ` Nícolas F. R. A. Prado [this message]

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=73718a50f53f1ba8963a7ea40516a008d5c1a67c.camel@collabora.com \
    --to=nfraprado@collabora.com \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@collabora.com \
    --cc=lenb@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=tglx@kernel.org \
    /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

all inboxes | Powered by JetHome®