Re: Error: DMA: Out of SW-IOMMU space [was: External USB drives become unresponsive after few hours.]
On 17 April 2015 at 22:06, Konrad Rzeszutek Wilk wrote: > On Fri, Apr 17, 2015 at 05:14:20PM +0200, Dorian Gray wrote: >> On 16 April 2015 at 20:42, Konrad Rzeszutek Wilk >> wrote: >> > And easier way is to compile the kernel with CONFIG_DMA_API_DEBUG >> > and then load the attached module. >> > >> > That should tell you who and what else is holding on the buffers. >> >> Ok, I have compiled 3.19.4 w/ CONFIG_DMA_API_DEBUG=y + the module you sent >> me. >> Now, I'm not sure if I've done it right - I waited until the error >> occured and then modprobe'd dump_dma. >> I have attached the kernel log, but it tells me not much, if anything... > > The network driver is quite hungry for DMA. Did it do the same thing > in the earlier kernels? > > Thanks. >> >> Thanks again. >> Jake > > Yeah, you're right: # grep rtl8192se dump_dma_k3.19.4.log | wc -l 6789 # # grep rtl8192se dump_dma_k3.17.8.log | wc -l 162 # So, wlan driver would be the real culprit then..? I would have never thought... I guess I'm gonna test 3.19.4 once more (just to be sure) with rtl8192se removed and see what happens. Thanks! Jake dump_dma_logs.tar.bz2 Description: BZip2 compressed data
Re: Error: DMA: Out of SW-IOMMU space [was: External USB drives become unresponsive after few hours.]
On 18 April 2015 at 12:10, Dorian Gray wrote: > On 17 April 2015 at 22:06, Konrad Rzeszutek Wilk > wrote: >> On Fri, Apr 17, 2015 at 05:14:20PM +0200, Dorian Gray wrote: >>> On 16 April 2015 at 20:42, Konrad Rzeszutek Wilk >>> wrote: >>> > And easier way is to compile the kernel with CONFIG_DMA_API_DEBUG >>> > and then load the attached module. >>> > >>> > That should tell you who and what else is holding on the buffers. >>> >>> Ok, I have compiled 3.19.4 w/ CONFIG_DMA_API_DEBUG=y + the module you sent >>> me. >>> Now, I'm not sure if I've done it right - I waited until the error >>> occured and then modprobe'd dump_dma. >>> I have attached the kernel log, but it tells me not much, if anything... >> >> The network driver is quite hungry for DMA. Did it do the same thing >> in the earlier kernels? >> >> Thanks. >>> >>> Thanks again. >>> Jake >> >> > > Yeah, you're right: > > # grep rtl8192se dump_dma_k3.19.4.log | wc -l > 6789 > # > # grep rtl8192se dump_dma_k3.17.8.log | wc -l > 162 > # > > So, wlan driver would be the real culprit then..? > I would have never thought... > > I guess I'm gonna test 3.19.4 once more (just to be sure) with > rtl8192se removed and see what happens. > > Thanks! > Jake [update] Ok, 6 hours of uptime (3.19.4 + blacklisted rtl8192se) and everything was fine... However, I was checking periodically and noticed that 'radeon' also tends to grow continuously over time, whereas ethernet driver sticks to, more or less, the same range: # uname -r 3.19.4 # # grep -Eo 'radeon|r8169' L1.log | sort | uniq -c 62 r8169 4183 radeon # # grep -Eo 'radeon|r8169' L2.log | sort | uniq -c 33 r8169 5582 radeon # # grep -Eo 'radeon|r8169' L3.log | sort | uniq -c 54 r8169 7007 radeon # # grep -Eo 'radeon|r8169' L4.log | sort | uniq -c 49 r8169 7429 radeon # # grep -Eo 'radeon|r8169' L5.log | sort | uniq -c 34 r8169 9360 radeon # It doesn't grow that much in 3.17.8: # uname -r 3.17.8 # # grep -Eo 'radeon|r8169|rtl8192se' L1.log | sort | uniq -c 265 r8169 1229 radeon 142 rtl8192se # # grep -Eo 'radeon|r8169|rtl8192se' L2.log | sort | uniq -c 187 r8169 3159 radeon 124 rtl8192se # # grep -Eo 'radeon|r8169|rtl8192se' L3.log | sort | uniq -c 41 r8169 1894 radeon 39 rtl8192se # # grep -Eo 'radeon|r8169|rtl8192se' L4.log | sort | uniq -c 64 r8169 3370 radeon 77 rtl8192se # # grep -Eo 'radeon|r8169|rtl8192se' L5.log | sort | uniq -c 52 r8169 2597 radeon 49 rtl8192se # Btw, at some point (3.19.4) I encounetered this: [21631.181909] DMA-API: debugging out of memory - disabling Jake -- 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
[PATCH 3/3] Usb: core: buffer: fixed the checkpatch warning
Fixed two warnings sizeof name and clank line after declaration Signed-off-by: Nizam Haider --- drivers/usb/core/buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index 684ef70..04125b6 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c @@ -62,7 +62,7 @@ int hcd_buffer_create(struct usb_hcd *hcd) size = pool_max[i]; if (!size) continue; - snprintf(name, sizeof name, "buffer-%d", size); + snprintf(name, sizeof(name), "buffer-%d", size); hcd->pool[i] = dma_pool_create(name, hcd->self.controller, size, size, 0); if (!hcd->pool[i]) { @@ -87,6 +87,7 @@ void hcd_buffer_destroy(struct usb_hcd *hcd) for (i = 0; i < HCD_BUFFER_POOLS; i++) { struct dma_pool *pool = hcd->pool[i]; + if (pool) { dma_pool_destroy(pool); hcd->pool[i] = NULL; -- 1.8.1.4 -- 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
[PATCH] usb: storage: scsiglue: Remove SPRINTF macro use
Single transform macros with hidden arguments are not particularly useful. Just use seq_printf directly instead. Signed-off-by: Joe Perches --- drivers/usb/storage/scsiglue.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 0e400f3..a8cbbff 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -456,17 +456,13 @@ static int write_info(struct Scsi_Host *host, char *buffer, int length) return length; } -/* we use this macro to help us write into the buffer */ -#undef SPRINTF -#define SPRINTF(args...) seq_printf(m, ## args) - static int show_info (struct seq_file *m, struct Scsi_Host *host) { struct us_data *us = host_to_us(host); const char *string; /* print the controller name */ - SPRINTF(" Host scsi%d: usb-storage\n", host->host_no); + seq_printf(m, " Host scsi%d: usb-storage\n", host->host_no); /* print product, vendor, and serial number strings */ if (us->pusb_dev->manufacturer) @@ -475,26 +471,26 @@ static int show_info (struct seq_file *m, struct Scsi_Host *host) string = us->unusual_dev->vendorName; else string = "Unknown"; - SPRINTF(" Vendor: %s\n", string); + seq_printf(m, " Vendor: %s\n", string); if (us->pusb_dev->product) string = us->pusb_dev->product; else if (us->unusual_dev->productName) string = us->unusual_dev->productName; else string = "Unknown"; - SPRINTF(" Product: %s\n", string); + seq_printf(m, " Product: %s\n", string); if (us->pusb_dev->serial) string = us->pusb_dev->serial; else string = "None"; - SPRINTF("Serial Number: %s\n", string); + seq_printf(m, "Serial Number: %s\n", string); /* show the protocol and transport */ - SPRINTF(" Protocol: %s\n", us->protocol_name); - SPRINTF("Transport: %s\n", us->transport_name); + seq_printf(m, " Protocol: %s\n", us->protocol_name); + seq_printf(m, "Transport: %s\n", us->transport_name); /* show the device flags */ - SPRINTF(" Quirks:"); + seq_printf(m, " Quirks:"); #define US_FLAG(name, value) \ if (us->fflags & value) seq_printf(m, " " #name); -- 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
[PATCH] usb: core: add usb3 lpm sysfs
Some usb3 devices may not support usb3 lpm well. The patch adds a sysfs to enable/disable u1 or u2 of the port.The settings apply to both before and after device enumeration. Supported values are "0" - u1 and u2 are disabled, "u1" - only u1 is enabled, "u2" - only u2 is enabled, "u1_u2" - u1 and u2 are enabled. The interface is useful for testing some USB3 devices during development, and provides a way to disable usb3 lpm if the issues can not be fixed in final products. Signed-off-by: Zhuang Jin Can --- Documentation/ABI/testing/sysfs-bus-usb | 10 drivers/usb/core/hub.c | 16 +- drivers/usb/core/hub.h |4 ++ drivers/usb/core/port.c | 89 ++- 4 files changed, 116 insertions(+), 3 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index e5cc763..32fc689 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb @@ -179,3 +179,13 @@ Description: Supported values are 0 - 15. More information on how besl values map to microseconds can be found in USB 2.0 ECN Errata for Link Power Management, section 4.10) + +What: /sys/bus/usb/devices/.../(hub interface)/portX/usb3_lpm +Date: March 2015 +Contact: Zhuang Jin Can +Description: + Some USB3.0 devices may not support usb3 lpm well. + usb3_lpm attribute allows enabling/disabling usb3 lpm of the port. + It takes effect both before and after a usb device is enumerated. + Supported values are "0" if u1 and u2 are disabled, "u1" if only u1 is + enabled, "u2" if only u2 is enabled, "u1_u2" if u1 and u2 are enabled. diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index d7c3d5a..7732a41 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3996,6 +3996,8 @@ EXPORT_SYMBOL_GPL(usb_unlocked_disable_lpm); void usb_enable_lpm(struct usb_device *udev) { struct usb_hcd *hcd; + struct usb_hub *hub; + struct usb_port *port_dev; if (!udev || !udev->parent || udev->speed != USB_SPEED_SUPER || @@ -4015,8 +4017,18 @@ void usb_enable_lpm(struct usb_device *udev) if (udev->lpm_disable_count > 0) return; - usb_enable_link_state(hcd, udev, USB3_LPM_U1); - usb_enable_link_state(hcd, udev, USB3_LPM_U2); + hub = usb_hub_to_struct_hub(udev->parent); + if (!hub) { + dev_err(&udev->dev, "can't enable lpm, usb_hub is null.\n"); + return; + } + port_dev = hub->ports[udev->portnum - 1]; + + if (port_dev->u1_is_enabled) + usb_enable_link_state(hcd, udev, USB3_LPM_U1); + + if (port_dev->u2_is_enabled) + usb_enable_link_state(hcd, udev, USB3_LPM_U2); } EXPORT_SYMBOL_GPL(usb_enable_lpm); diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 688817f..1ae060e 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -92,6 +92,8 @@ struct usb_hub { * @status_lock: synchronize port_event() vs usb_port_{suspend|resume} * @portnum: port index num based one * @is_superspeed cache super-speed status + * @u1_is_enabled: whether u1 should be enabled. + * @u2_is_enabled: whether u2 should be enabled. */ struct usb_port { struct usb_device *child; @@ -104,6 +106,8 @@ struct usb_port { struct mutex status_lock; u8 portnum; unsigned int is_superspeed:1; + unsigned int u1_is_enabled:1; + unsigned int u2_is_enabled:1; }; #define to_usb_port(_dev) \ diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 2106183..7f4e6c7 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -50,6 +50,72 @@ static ssize_t connect_type_show(struct device *dev, } static DEVICE_ATTR_RO(connect_type); +static ssize_t usb3_lpm_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct usb_port *port_dev = to_usb_port(dev); + const char *p; + + if (port_dev->u1_is_enabled) { + if (port_dev->u2_is_enabled) + p = "u1_u2"; + else + p = "u1"; + } else { + if (port_dev->u2_is_enabled) + p = "u2"; + else + p = "0"; + } + + return sprintf(buf, "%s\n", p); +} + +static ssize_t usb3_lpm_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct usb_port *port_dev = to_usb_port(dev); + struct usb_device *udev = port_dev->child; + struct usb_hcd *hcd; + + if (!strncmp(buf, "u1_u2", 5)) { + port_dev->u1_is_enabled = 1; +