From: Alex Courbot <acourbot@nvidia.com>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: USB list <linux-usb@vger.kernel.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Alexandre Courbot <gnurou@gmail.com>
Subject: Re: usb_wwan_write() called while device still being resumed
Date: Mon, 18 Feb 2013 12:20:26 +0900 [thread overview]
Message-ID: <51219DFA.6070902@nvidia.com> (raw)
In-Reply-To: <87r4khu9az.fsf@nemi.mork.no>
On 02/15/2013 08:05 PM, Bjørn Mork wrote:
> Maybe something like the completely untested:
>
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index 3148b10..38e19ba 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -512,6 +512,9 @@ static int rpm_resume(struct device *dev, int rpmflags)
> else if (dev->power.disable_depth == 1 && dev->power.is_suspended
> && dev->power.runtime_status == RPM_ACTIVE)
> retval = 1;
> + else if (rpmflags & RPM_ASYNC && dev->power.request_pending &&
> + dev->power.request == RPM_REQ_RESUME)
> + retval = -EINPROGRESS;
> else if (dev->power.disable_depth > 0)
> retval = -EACCES;
> if (retval)
Second thought: not sure this will work since power.request_pending and
power.request are set to these values later in the same rpm_resume()
function. However, the three lines before yours caught my attention.
They are not in my 3.1 source tree and the conditions are very close
from the ones I am seeing when the issue happens: disable_depth == 1,
is_suspended == 1. Only runtime_status is not equal to RPM_ACTIVE.
Nonetheless, I have looked at the patch that introduced these
(http://pastebin.com/PmHUjiAE ) and it details a problem that is very
similar to mine. It also mentions a workaround to be implemented in the
driver by saving the suspend status into a variable that is checked when
pm_runtime_get() return -EACCES. This variable already exists in
usb_wwan, actually it is the very variable that is checked a bit later
in that other chunk of code you mentioned:
spin_lock_irqsave(&intfdata->susp_lock, flags);
if (intfdata->suspended) {
usb_anchor_urb(this_urb, &portdata->delayed);
spin_unlock_irqrestore(&intfdata->susp_lock, flags);
} else {
So it looks like this code is here for exactly that purpose. However in
my current condition I do not see how this block could be run since
runtime PM is disabled when intfdata->suspended is set to true.
I will try implementing the workaround suggested (checking if
intfdata->suspended is set when -EACCES is returned and go on if it is
the case) and see if it works (and I bet it will). In the upstream
kernel the issue seems to have been addressed already, so this might
just be a source-out-of-date issue.
Thanks,
Alex.
prev parent reply other threads:[~2013-02-18 3:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-14 10:31 usb_wwan_write() called while device still being resumed Alex Courbot
2013-02-14 17:41 ` Bjørn Mork
2013-02-15 8:23 ` Alex Courbot
2013-02-15 11:05 ` Bjørn Mork
2013-02-17 11:31 ` Alex Courbot
2013-02-18 3:20 ` Alex Courbot [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=51219DFA.6070902@nvidia.com \
--to=acourbot@nvidia.com \
--cc=bjorn@mork.no \
--cc=gnurou@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-usb@vger.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