Re: [RFT] usb: Don't enable LPM if the exit latency is zero.
On Wed, Oct 10, 2012 at 09:01:01PM +0200, Gabor Takacs wrote: > Dear Sarah, > > Great, I'm glad your disk works now! > > > > You can check if the roothub goes into a low power state by watching > > whether the parent hub reports U0 or U1/U2 in its port status registers. > > You can do this by running > > > > watch -n 1 'sudo lsusb -v -d 1d6b:0003 | grep "Hub Port Status" -A4' > I do not see any change, it always stays in U0. I can also watch the > power consumption with powertop and it is quite steady at around 1 Watt. Hmm, then I guess your device isn't going into U1. > How long is the software-programmed timeout for it to go into a "link > idle" state? > >> bU1DevExitLat 1 micro seconds > >> bU2DevExitLat 0 micro seconds At the smallest, 10ms. You would have seen the port go into U1 if the device was actually going into U1. But it seems like the device can handle being asked (and refusing) to go into U1, just not when it's asked to go into U2. Sarah Sharp -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFT] usb: Don't enable LPM if the exit latency is zero.
Dear Sarah, > Great, I'm glad your disk works now! > > You can check if the roothub goes into a low power state by watching > whether the parent hub reports U0 or U1/U2 in its port status registers. > You can do this by running > > watch -n 1 'sudo lsusb -v -d 1d6b:0003 | grep "Hub Port Status" -A4' I do not see any change, it always stays in U0. I can also watch the power consumption with powertop and it is quite steady at around 1 Watt. How long is the software-programmed timeout for it to go into a "link idle" state? >> bU1DevExitLat 1 micro seconds >> bU2DevExitLat 0 micro seconds > Interesting. So the device has a non-zero U1 device exit latency, but a > zeroed U2 device exit latency. In that case, we'll only enable U1. > Maybe the device only supports U1? It would be informative to know if > the roothub ports actually go into U1 when the device is plugged > directly into your computer (not through a hub). I am always plugging in the device directly (it is connected to one of the side USB 3.0 ports on an ASUS Zenbook UX21A notebook). Best wishes, Gabor -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFT] usb: Don't enable LPM if the exit latency is zero.
On Sun, Oct 07, 2012 at 04:05:26PM +0200, Gabor Takacs wrote: > Hi Sarah, > > I have successfully applied the two patches you sent. The lsusb -v > output is below. I am not sure if this is what I should see, but it > probably tells you what you need to know. > > The disk works, the thing I do not know is how to check whether it > properly goes into a low power state. Great, I'm glad your disk works now! You can check if the roothub goes into a low power state by watching whether the parent hub reports U0 or U1/U2 in its port status registers. You can do this by running watch -n 1 'sudo lsusb -v -d 1d6b:0003 | grep "Hub Port Status" -A4' > bU1DevExitLat 1 micro seconds > bU2DevExitLat 0 micro seconds Interesting. So the device has a non-zero U1 device exit latency, but a zeroed U2 device exit latency. In that case, we'll only enable U1. Maybe the device only supports U1? It would be informative to know if the roothub ports actually go into U1 when the device is plugged directly into your computer (not through a hub). Sarah Sharp -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFT] usb: Don't enable LPM if the exit latency is zero.
Hi Sarah, I have successfully applied the two patches you sent. The lsusb -v output is below. I am not sure if this is what I should see, but it probably tells you what you need to know. The disk works, the thing I do not know is how to check whether it properly goes into a low power state. Best wishes, Gabor Bus 004 Device 003: ID 1058:0730 Western Digital Technologies, Inc. Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 3.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 9 idVendor 0x1058 Western Digital Technologies, Inc. idProduct 0x0730 bcdDevice 10.08 iManufacturer 1 Western Digital iProduct2 My Passport 0730 iSerial 3 575846314139304E30363638 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 44 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 224mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk (Zip) iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x84 EP 4 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Binary Object Store Descriptor: bLength 5 bDescriptorType15 wTotalLength 22 bNumDeviceCaps 2 SuperSpeed USB Device Capability: bLength10 bDescriptorType16 bDevCapabilityType 3 bmAttributes 0x00 Latency Tolerance Messages (LTM) Supported wSpeedsSupported 0x000e Device can operate at Full Speed (12Mbps) Device can operate at High Speed (480Mbps) Device can operate at SuperSpeed (5Gbps) bFunctionalitySupport 0 Lowest fully-functional device speed is Low Speed (1Mbps) bU1DevExitLat 1 micro seconds bU2DevExitLat 0 micro seconds USB 2.0 Extension Device Capability: bLength 7 bDescriptorType16 bDevCapabilityType 2 bmAttributes 0x0002 Link Power Management (LPM) Supported Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled On 10/03/2012 08:29 PM, Sarah Sharp wrote: > Hi Don, > > Please test this patch on top of the other patch. > > Sarah Sharp > >> 8---8< > Some USB 3.0 devices signal that they don't implement Link PM by having > all zeroes in the U1/U2 exit latencies in their SuperSpeed BOS > descriptor. Don found that a Western Digital device he has experiences > transfer errors when LPM is enabled. The lsusb shows the U1/U2 exit > latencies are set to zero: > > Binary Object Store Descriptor: > bLength 5 > bDescriptorType15 > wTotalLength 22 > bNumDeviceCaps 2 > SuperSpeed USB Device Capability: > bLength10 > bDescriptorType16 > bDevCapabilityType 3 > bmAttributes 0x00 > Latency Tolerance Messages (LTM) Supported > wSpeedsSupported 0x000e > Device can operate at Full Speed (12Mbps) > Device can operate at High Speed (480Mbps) > Device can operate at SuperSpeed (5Gbps) > bFunctionalitySupport 1 > Lowest fully-functional device speed is Full Speed (12Mbps) > bU1DevExitLat 0 micro seconds > bU2DevExitLat 0 micro seconds > > The fix is to not enable LPM for a particular link state if we find its > corresponding exit latency is zero. > > Signed-off-by: Sarah Sharp > Reported-by: Don Zickus > --- > drivers/usb/core/hub.c | 14 ++ > 1 files changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index 55bef91..2568441 100644 > --- a/drivers/
Re: [RFT] usb: Don't enable LPM if the exit latency is zero.
On Wed, Oct 03, 2012 at 11:29:00AM -0700, Sarah Sharp wrote: > Hi Don, > > Please test this patch on top of the other patch. So yeah, that seemed to work. :-) Thanks! Cheers, Don > > Sarah Sharp > > >8---8< > Some USB 3.0 devices signal that they don't implement Link PM by having > all zeroes in the U1/U2 exit latencies in their SuperSpeed BOS > descriptor. Don found that a Western Digital device he has experiences > transfer errors when LPM is enabled. The lsusb shows the U1/U2 exit > latencies are set to zero: > > Binary Object Store Descriptor: > bLength 5 > bDescriptorType15 > wTotalLength 22 > bNumDeviceCaps 2 > SuperSpeed USB Device Capability: > bLength10 > bDescriptorType16 > bDevCapabilityType 3 > bmAttributes 0x00 > Latency Tolerance Messages (LTM) Supported > wSpeedsSupported 0x000e > Device can operate at Full Speed (12Mbps) > Device can operate at High Speed (480Mbps) > Device can operate at SuperSpeed (5Gbps) > bFunctionalitySupport 1 > Lowest fully-functional device speed is Full Speed (12Mbps) > bU1DevExitLat 0 micro seconds > bU2DevExitLat 0 micro seconds > > The fix is to not enable LPM for a particular link state if we find its > corresponding exit latency is zero. > > Signed-off-by: Sarah Sharp > Reported-by: Don Zickus > --- > drivers/usb/core/hub.c | 14 ++ > 1 files changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index 55bef91..2568441 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -3484,8 +3484,16 @@ static void usb_enable_link_state(struct usb_hcd *hcd, > struct usb_device *udev, > enum usb3_link_state state) > { > int timeout; > - __u8 u1_mel; > - __le16 u2_mel; > + __u8 u1_mel = udev->bos->ss_cap->bU1devExitLat; > + __le16 u2_mel = udev->bos->ss_cap->bU2DevExitLat; > + > + /* If the device says it doesn't have *any* exit latency to come out of > + * U1 or U2, it's probably lying. Assume it doesn't implement that link > + * state. > + */ > + if ((state == USB3_LPM_U1 && u1_mel == 0) || > + (state == USB3_LPM_U2 && u2_mel == 0)) > + return; > > /* We allow the host controller to set the U1/U2 timeout internally >* first, so that it can change its schedule to account for the > @@ -3512,8 +3520,6 @@ static void usb_enable_link_state(struct usb_hcd *hcd, > struct usb_device *udev, >* link commands. This can cause transfer errors, so only enable >* device-initiated LPM. >*/ > - u1_mel = udev->bos->ss_cap->bU1devExitLat; > - u2_mel = udev->bos->ss_cap->bU2DevExitLat; > if ((state == USB3_LPM_U1 && u1_mel == USB_U1_MAX_VALID_MEL) || > (state == USB3_LPM_U2 && >le16_to_cpu(u2_mel) == USB_U2_MAX_VALID_MEL)) { > -- > 1.7.9 > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html