Probably I found the root cause of this problem. After enabling the HIGHMEM and VMSPLIT_3G, the urb sent to the driver of dwc_otg maybe allocated in the highmem, if it is in the highmem, the usb core will not set the urb->transfer_buffer and call hcd->urb_enquenue().
With other hcd drivers, they could handle the situation of urb->transfer_buffer to be NULL, but for dwc_otg hcd driver, it returns an error unconditionally if the urb->transfer_buffer is NULL. I check the code, the dwc_otg driver could handle the situation that the urb buffer is in highmem (urb->tansfer_buffer is NULL). Maybe we could fix this issue with a simple patch, I will post my found to the upstream bug https://github.com/raspberrypi/linux/issues/3332 hwang4@hwang4-Vostro-5390:~/work/mainline/raspi/linux-32$ git diff diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c index 08a3e41038a3..5d04adfc58c0 100644 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c @@ -821,10 +821,10 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, dump_urb_info(urb, "dwc_otg_urb_enqueue"); } #endif - +#if 0 if (!urb->transfer_buffer && urb->transfer_buffer_length) return -EINVAL; - +#endif if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) || (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { if (!dwc_otg_hcd_is_bandwidth_allocated -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux-raspi2 in Ubuntu. https://bugs.launchpad.net/bugs/1852510 Title: IO errors when writing large amounts of data to USB storage in eoan on RPI Status in linux-raspi2 package in Ubuntu: New Status in linux-raspi2 source package in Eoan: In Progress Bug description: Kernel tested: Linux ubuntu 5.3.0-1012-raspi2 #14-Ubuntu SMP Mon Nov 11 10:08:39 UTC 2019 armv7l armv7l armv7l GNU/Linux I've only been able to reproduce this with the armhf kernel and on the following devices: RPI3B+ RPI3B RPI2 At the moment, it does not appear that arm64 is affected, nor are RPI3A+ and RPI4 (at least not the 2GB version) Steps to reproduce: - Insert and mount a USB storage device - cp a large file to it (300-600MB recommended - smaller files will sometimes not trigger it) - sync After running the sync, a lot of IO errors will show up in dmesg like: [ 176.129299] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK [ 176.129326] sd 0:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 00 2e 24 b0 00 00 f0 00 [ 176.129349] blk_update_request: I/O error, dev sda, sector 3024048 op 0x1:(WRITE) flags 0x4000 phys_seg 15 prio class 0 [ 176.883968] usb 1-1.1.2: reset high-speed USB device number 8 using dwc_otg [ 177.079960] usb 1-1.1.2: reset high-speed USB device number 8 using dwc_otg It eventually finishes, and if you unmount/remount the device, the checksum will be different from the original file. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux-raspi2/+bug/1852510/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp