linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [4.19,014/110] usb: xhci: Prevent bus suspend if a port connect change or polling state is detected
@ 2018-12-13 20:53 Thomas Zeitlhofer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zeitlhofer @ 2018-12-13 20:53 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: Greg Kroah-Hartman, linux-kernel, stable, linux-usb

On Thu, Dec 13, 2018 at 02:24:14PM +0200, Mathias Nyman wrote:
> On 13.12.2018 09:36, Greg Kroah-Hartman wrote:
> > On Wed, Dec 12, 2018 at 11:53:34PM +0100, Thomas Zeitlhofer wrote:
> > > Hello,
> > > 
> > > On Thu, Nov 29, 2018 at 03:11:45PM +0100, Greg Kroah-Hartman wrote:
> > > > 4.19-stable review patch.  If anyone has any objections, please let me
> > > > know.
> > > > 
> > > > ------------------
> > > > 
> > > > From: Mathias Nyman <mathias.nyman@linux.intel.com>
> > > > 
> > > > commit 2f31a67f01a8beb22cae754c53522cb61a005750 upstream.
> > > [...]
> > > 
> > > on a current Thinkpad X1 Yoga, this breaks resume from hibernate such
> > > that opening the lid has (in the regular use case, see below) no effect
> > > any more:
> > > 
> > > The system is configured to hibernate when the lid is closed. So, the
> > > expected behavior, which is restored by reverting this patch, is:
> > > 
> > > 	close lid => system hibernates
> > > 	open lid => system resumes
> > > 
> > > With this patch, the following two cases are observed:
> > > 
> > > 	1)
> > > 		close lid => system hibernates
> > > 		open lid => system stays off
> > > 		press power button => system boots and resumes
> > > 
> > > 	2)
> > > 		# systemctl hibernate => system hibernates
> > > 		close lid
> > > 		open lid => system resumes
> > > 
> > 
> > So this is a problem in Linus's tree?  If so, let's work to get this
> > fixed there first.
> > 
> > If not, then we have other issues :)
> > 
> 
> That patch incorrectly reacts to USB2 polling states as well,
> which could cause issues like this.
> 
> Does applying the below code help?
> 
> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
> index 94aca1b..01b5818 100644
> --- a/drivers/usb/host/xhci-hub.c
> +++ b/drivers/usb/host/xhci-hub.c
> @@ -1507,7 +1507,8 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
>                 portsc_buf[port_index] = 0;
>                 /* Bail out if a USB3 port has a new device in link training */
> -               if ((t1 & PORT_PLS_MASK) == XDEV_POLLING) {
> +               if ((hcd->speed >= HCD_USB3) &&
> +                   (t1 & PORT_PLS_MASK) == XDEV_POLLING) {
>                         bus_state->bus_suspended = 0;
>                         spin_unlock_irqrestore(&xhci->lock, flags);
>                         xhci_dbg(xhci, "Bus suspend bailout, port in polling\n");

Yes, this fixes the problem.

Thanks,

Thomas

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [4.19,014/110] usb: xhci: Prevent bus suspend if a port connect change or polling state is detected
@ 2018-12-13 12:24 Mathias Nyman
  0 siblings, 0 replies; 2+ messages in thread
From: Mathias Nyman @ 2018-12-13 12:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thomas Zeitlhofer; +Cc: linux-kernel, stable, linux-usb

On 13.12.2018 09:36, Greg Kroah-Hartman wrote:
> On Wed, Dec 12, 2018 at 11:53:34PM +0100, Thomas Zeitlhofer wrote:
>> Hello,
>>
>> On Thu, Nov 29, 2018 at 03:11:45PM +0100, Greg Kroah-Hartman wrote:
>>> 4.19-stable review patch.  If anyone has any objections, please let me
>>> know.
>>>
>>> ------------------
>>>
>>> From: Mathias Nyman <mathias.nyman@linux.intel.com>
>>>
>>> commit 2f31a67f01a8beb22cae754c53522cb61a005750 upstream.
>> [...]
>>
>> on a current Thinkpad X1 Yoga, this breaks resume from hibernate such
>> that opening the lid has (in the regular use case, see below) no effect
>> any more:
>>
>> The system is configured to hibernate when the lid is closed. So, the
>> expected behavior, which is restored by reverting this patch, is:
>>
>> 	close lid => system hibernates
>> 	open lid => system resumes
>>
>> With this patch, the following two cases are observed:
>>
>> 	1)
>> 		close lid => system hibernates
>> 		open lid => system stays off
>> 		press power button => system boots and resumes
>>
>> 	2)
>> 		# systemctl hibernate => system hibernates
>> 		close lid
>> 		open lid => system resumes
>>
> 
> So this is a problem in Linus's tree?  If so, let's work to get this
> fixed there first.
> 
> If not, then we have other issues :)
> 

That patch incorrectly reacts to USB2 polling states as well,
which could cause issues like this.

Does applying the below code help?

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 94aca1b..01b5818 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1507,7 +1507,8 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
                 portsc_buf[port_index] = 0;
  
                 /* Bail out if a USB3 port has a new device in link training */
-               if ((t1 & PORT_PLS_MASK) == XDEV_POLLING) {
+               if ((hcd->speed >= HCD_USB3) &&
+                   (t1 & PORT_PLS_MASK) == XDEV_POLLING) {
                         bus_state->bus_suspended = 0;
                         spin_unlock_irqrestore(&xhci->lock, flags);
                         xhci_dbg(xhci, "Bus suspend bailout, port in polling\n");

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-13 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-13 20:53 [4.19,014/110] usb: xhci: Prevent bus suspend if a port connect change or polling state is detected Thomas Zeitlhofer
  -- strict thread matches above, loose matches on Subject: below --
2018-12-13 12:24 Mathias Nyman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).