From: "Bjørn Mork" <bjorn@mork.no>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>,
<gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH 3/7] xhci: Don't suspend a xhci usb bus if there is a pending event.
Date: Wed, 06 Apr 2016 18:18:28 +0200 [thread overview]
Message-ID: <87y48qvhgr.fsf@nemi.mork.no> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1604061208420.2242-100000@iolanthe.rowland.org> (Alan Stern's message of "Wed, 6 Apr 2016 12:11:18 -0400 (EDT)")
Alan Stern <stern@rowland.harvard.edu> writes:
> On Wed, 6 Apr 2016, Bjørn Mork wrote:
>> Alan Stern <stern@rowland.harvard.edu> writes:
>> > On Wed, 6 Apr 2016, Mathias Nyman wrote:
>> >
>> >> We don't want to runtime suspend a bus if there is an event pending.
>> >> The roothub on a NEC uPD720200 host with a single USB3 device connected
>> >> might go back to runtime suspend immediately after runtime resume as
>> >> hub might not yet see any port changes in resume.
>> >>
>> >> Prevent this by checking if there is a unhandled event pending when
>> >> calling runtime suspend.
>> >>
>> >> Cc: <stable@vger.kernel.org>
>> >> Tested-by: Mike Murdoch <main.haarp@gmail.com>
>> >> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>> >> ---
>> >> drivers/usb/host/xhci-hub.c | 6 ++++++
>> >> drivers/usb/host/xhci.c | 1 +
>> >> 2 files changed, 7 insertions(+)
>> >>
>> >> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>> >> index d61fcc4..7e8999a 100644
>> >> --- a/drivers/usb/host/xhci-hub.c
>> >> +++ b/drivers/usb/host/xhci-hub.c
>> >> @@ -1289,12 +1289,18 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
>> >> __le32 __iomem **port_array;
>> >> struct xhci_bus_state *bus_state;
>> >> unsigned long flags;
>> >> + u32 status;
>> >>
>> >> max_ports = xhci_get_ports(hcd, &port_array);
>> >> bus_state = &xhci->bus_state[hcd_index(hcd)];
>> >>
>> >> spin_lock_irqsave(&xhci->lock, flags);
>> >>
>> >> + /* Don't suspend root hub if there's an event pending. */
>> >> + status = readl(&xhci->op_regs->status);
>> >> + if (status & STS_EINT)
>> >> + return -EBUSY;
>> >
>> > Does anybody else see a problem here?
>>
>> Like the EBUSY being propagated all the way to usb_suspend(), which is
>> called on PMSG_HIBERNATE, PMSG_FREEZE and PMSG_SUSPEND?
>>
>> This will not only prevent runtime suspend, but also system suspend,
>> wont it? Or did I miss something on the way? The call chain between
>> the USB dev_pm_ops .suspend and xhci_bus_suspend() is quite long..
>
> I was thinking of returning with a private spinlock held.
No, I didn't see that. So I am happy to support Mathias' case by
demonstrating that it wasn't *that* bloody obvious :)
Bjørn
next prev parent reply other threads:[~2016-04-06 16:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1459948088-27118-1-git-send-email-mathias.nyman@linux.intel.com>
2016-04-06 13:08 ` [PATCH 1/7] usb: xhci: applying XHCI_PME_STUCK_QUIRK to Intel BXT B0 host Mathias Nyman
2016-04-06 13:08 ` [PATCH 2/7] xhci: resume USB 3 roothub first Mathias Nyman
2016-04-06 13:08 ` [PATCH 3/7] xhci: Don't suspend a xhci usb bus if there is a pending event Mathias Nyman
2016-04-06 15:01 ` Alan Stern
2016-04-06 15:33 ` Bjørn Mork
2016-04-06 16:11 ` Alan Stern
2016-04-06 16:18 ` Bjørn Mork [this message]
2016-04-06 21:05 ` Greg KH
2016-04-06 21:25 ` Alan Stern
2016-04-07 8:10 ` Mathias Nyman
2016-04-07 14:23 ` Alan Stern
2016-04-08 10:16 ` Mathias Nyman
2016-04-06 13:08 ` [PATCH 4/7] usb: host: xhci: add a new quirk XHCI_NO_64BIT_SUPPORT Mathias Nyman
2016-04-06 13:08 ` [PATCH 5/7] usb: host: xhci-plat: fix cannot work if R-Car Gen2/3 run on above 4GB phys Mathias Nyman
2016-04-06 13:08 ` [PATCH 6/7] usb: xhci: fix wild pointers in xhci_mem_cleanup Mathias Nyman
2016-04-06 13:08 ` [PATCH 7/7] xhci: fix 10 second timeout on removal of PCI hotpluggable xhci controllers Mathias Nyman
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=87y48qvhgr.fsf@nemi.mork.no \
--to=bjorn@mork.no \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.