From: Raag Jadav <raag.jadav@intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Linux PM <linux-pm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Ulf Hansson <ulf.hansson@linaro.org>,
Oliver Neukum <oneukum@suse.com>,
Ajay Agarwal <ajayagarwal@google.com>,
Brian Norris <briannorris@google.com>
Subject: Re: [PATCH v1] PM: runtime: Unify error handling during suspend and resume
Date: Mon, 24 Feb 2025 14:56:51 +0200 [thread overview]
Message-ID: <Z7xsk72jQgBkfpwZ@black.fi.intel.com> (raw)
In-Reply-To: <CAJZ5v0jmp4PFb6z+K9cGS83CmX=5Ms0F9HSgcpq-VXn=rTdXgg@mail.gmail.com>
On Mon, Feb 24, 2025 at 01:39:14PM +0100, Rafael J. Wysocki wrote:
> On Sun, Feb 23, 2025 at 4:42 PM Raag Jadav <raag.jadav@intel.com> wrote:
> >
> > On Sun, Feb 23, 2025 at 01:56:07PM +0100, Rafael J. Wysocki wrote:
> > > On Sun, Feb 23, 2025 at 8:33 AM Raag Jadav <raag.jadav@intel.com> wrote:
> > > >
> > > > On Thu, Feb 20, 2025 at 09:18:23PM +0100, Rafael J. Wysocki wrote:
> > > > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > > >
> > > > > There is a confusing difference in error handling between rpm_suspend()
> > > > > and rpm_resume() related to the special way in which the -EAGAIN and
> > > > > -EBUSY error values are treated by the former. Also, converting
> > > > > -EACCES coming from the callback to an I/O error, which it quite likely
> > > > > is not, may confuse runtime PM users a bit.
> > > > >
> > > > > To address the above, modify rpm_callback() to convert -EACCES coming
> > > > > from the driver to -EAGAIN and to set power.runtime_error only if the
> > > > > return value is not -EAGAIN or -EBUSY.
> > > > >
> > > > > This will cause the error handling in rpm_resume() and rpm_suspend() to
> > > > > work consistently, so drop the no longer needed -EAGAIN or -EBUSY
> > > > > special case from the latter and make it retry autosuspend if
> > > > > power.runtime_error is unset.
> > > > >
> > > > > Link: https://lore.kernel.org/linux-pm/20220620144231.GA23345@axis.com/
> > > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > > > ---
> > > > > drivers/base/power/runtime.c | 34 ++++++++++++++++++----------------
> > > > > 1 file changed, 18 insertions(+), 16 deletions(-)
> > > > >
> > > > > --- a/drivers/base/power/runtime.c
> > > > > +++ b/drivers/base/power/runtime.c
> > > > > @@ -448,8 +448,13 @@
> > > > > retval = __rpm_callback(cb, dev);
> > > > > }
> > > > >
> > > > > - dev->power.runtime_error = retval;
> > > > > - return retval != -EACCES ? retval : -EIO;
> > > > > + if (retval == -EACCES)
> > > > > + retval = -EAGAIN;
> > > >
> > > > While this is one way to address the problem, are we opening the door
> > > > to changing error codes when convenient? This might lead to different
> > > > kind of confusion from user standpoint.
> > >
> > > Are you saying that if a mistake was made sufficiently long ago, it
> > > can't be fixed any more because someone may be confused?
> >
> > Nothing against the fix but "sufficiently long ago" is why we might
> > have users that rely on it. As long as we don't break anything I don't
> > see a problem.
> >
> > Messing with error codes is usually received with mixed feelings and
> > coming across such a code raises more questions than answers. Perhaps a
> > small explanation might do the trick?
>
> Do you mean an explanation why -EACCES needs to be converted to something else?
>
> That's because -EACCES has a special meaning in runtime PM: it means
> that runtime PM is disabled for the given device.
I meant a small comment above for those who may not see it as an obvious
thing, but whatever you think is best.
Raag
prev parent reply other threads:[~2025-02-24 12:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 20:18 [PATCH v1] PM: runtime: Unify error handling during suspend and resume Rafael J. Wysocki
2025-02-23 7:33 ` Raag Jadav
2025-02-23 12:56 ` Rafael J. Wysocki
2025-02-23 15:42 ` Raag Jadav
2025-02-24 12:39 ` Rafael J. Wysocki
2025-02-24 12:56 ` Raag Jadav [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=Z7xsk72jQgBkfpwZ@black.fi.intel.com \
--to=raag.jadav@intel.com \
--cc=ajayagarwal@google.com \
--cc=briannorris@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.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