From: Praveen Talari <praveen.talari@oss.qualcomm.com>
To: "Rafael J. Wysocki (Intel)" <rafael@kernel.org>
Cc: Mark Brown <broonie@kernel.org>,
Dilip Kota <dkota@codeaurora.org>,
Stephen Boyd <swboyd@chromium.org>,
Girish Mahadevan <girishm@codeaurora.org>,
Alok Chauhan <alokc@codeaurora.org>,
bjorn.andersson@oss.qualcomm.com,
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Danilo Krummrich <dakr@kernel.org>,
Douglas Anderson <dianders@chromium.org>,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>,
aniket.randive@oss.qualcomm.com,
chandana.chiluveru@oss.qualcomm.com,
jyothi.seerapu@oss.qualcomm.com, linux-pm@vger.kernel.org,
driver-core@lists.linux.dev
Subject: Re: [PATCH v2 1/2] PM: runtime: Only set runtime_error on suspend callback failures
Date: Sat, 4 Jul 2026 11:20:54 +0530 [thread overview]
Message-ID: <ecbaece7-764c-4e0e-b490-55d538f8aa29@oss.qualcomm.com> (raw)
In-Reply-To: <CAJZ5v0haSHfupyfnVGX_v4K0wYrjn-83NiDPPfC22x=zwi8igg@mail.gmail.com>
Hi Rafael,
On 04-07-2026 01:53, Rafael J. Wysocki (Intel) wrote:
> On Fri, Jul 3, 2026 at 5:05 PM Praveen Talari
> <praveen.talari@oss.qualcomm.com> wrote:
>> When a runtime resume callback returns an error, rpm_callback() sets
>> power.runtime_error on the device. This causes all subsequent calls to
>> rpm_resume() to return -EINVAL immediately at the top of the function
>> without invoking the callback again, making the failure permanent until
>> runtime PM is explicitly re-initialized.
>>
>> Unlike suspend failures, resume failures should be retryable. If a
>> device's resume callback fails transiently, there is no reason to
>> permanently block future resume attempts on that device and all of its
>> consumers.
>>
>> Fix this by conditioning the power.runtime_error assignment in
>> rpm_callback() on the device being in the RPM_SUSPENDING state. At the
>> point rpm_callback() runs, __update_runtime_status() has already set the
>> device status to either RPM_SUSPENDING or RPM_RESUMING, so the two paths
>> are reliably distinguishable. Suspend callback failures continue to set
>> power.runtime_error as before. Resume callback failures return the error
>> to the caller but leave power.runtime_error clear, allowing the next
>> resume attempt to invoke the callback normally.
>>
>> Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
>> ---
>> drivers/base/power/runtime.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
>> index 335288e8b5b3..70d933bcd295 100644
>> --- a/drivers/base/power/runtime.c
>> +++ b/drivers/base/power/runtime.c
>> @@ -469,7 +469,13 @@ static int rpm_callback(int (*cb)(struct device *), struct device *dev)
>> if (retval == -EACCES)
>> retval = -EAGAIN;
>>
>> - if (retval != -EAGAIN && retval != -EBUSY)
>> + /*
>> + * Only stick the error on suspend failures. Resume failures are not
>> + * treated as permanent so that the next resume attempt will run the
>> + * callback again rather than short-circuiting on runtime_error.
>> + */
>> + if (retval != -EAGAIN && retval != -EBUSY &&
>> + dev->power.runtime_status == RPM_SUSPENDING)
>> dev->power.runtime_error = retval;
> Why don't you move this check to rpm_suspend()?
Yes, we can do that.
I hope the changes below address your concerns. Please let me know if
there is anything else that needs to be adjusted.
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 335288e8b5b3..fab38bc98113 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -469,9 +469,6 @@ static int rpm_callback(int (*cb)(struct device *),
struct device *dev)
if (retval == -EACCES)
retval = -EAGAIN;
- if (retval != -EAGAIN && retval != -EBUSY)
- dev->power.runtime_error = retval;
-
return retval;
}
@@ -751,6 +748,9 @@ static int rpm_suspend(struct device *dev, int rpmflags)
dev->power.deferred_resume = false;
wake_up_all(&dev->power.wait_queue);
+ if (retval != -EAGAIN && retval != -EBUSY)
+ dev->power.runtime_error = retval;
+
Thanks,
Praveen Talari
next prev parent reply other threads:[~2026-07-04 5:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 15:05 [PATCH v2 0/2] Fix sticky -EINVAL after resume callback failure Praveen Talari
2026-07-03 15:05 ` [PATCH v2 1/2] PM: runtime: Only set runtime_error on suspend callback failures Praveen Talari
2026-07-03 20:23 ` Rafael J. Wysocki (Intel)
2026-07-04 5:50 ` Praveen Talari [this message]
2026-07-03 15:05 ` [PATCH v2 2/2] spi: qcom-geni: Fix missing error check on pm_runtime_get_sync() Praveen Talari
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=ecbaece7-764c-4e0e-b490-55d538f8aa29@oss.qualcomm.com \
--to=praveen.talari@oss.qualcomm.com \
--cc=alokc@codeaurora.org \
--cc=aniket.randive@oss.qualcomm.com \
--cc=bjorn.andersson@oss.qualcomm.com \
--cc=broonie@kernel.org \
--cc=chandana.chiluveru@oss.qualcomm.com \
--cc=dakr@kernel.org \
--cc=dianders@chromium.org \
--cc=dkota@codeaurora.org \
--cc=driver-core@lists.linux.dev \
--cc=girishm@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=jyothi.seerapu@oss.qualcomm.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=lenb@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mukesh.savaliya@oss.qualcomm.com \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=swboyd@chromium.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