Hang with DWC3 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Felipe,

I'm running into a hang with the mass-storage gadget with later
versions of the dwc3 driver. I see this with the version from your
master branch from Feb 1, and also with the latest version from
today.

I see it with both Linux and Windows hosts, while doing my simple
file corruption test. It goes like this:

- Connect the device at SuperSpeed.
- Copy a large (~750MB) file from the host to the device.
- "Safely remove" the device and disconnect it.
- Reconnect the device.
- Rename the file on the device.
- Copy the file back to the host.
- "Safely remove" the device and disconnect it.
- Compare the two files (this step is not important, you can skip it).
- Reconnect the device.
- Delete the file from the device.
- Copy the original file from the host to the device again.

Here, the file transfer hangs. Using a USB analyzer, I see that after
the first few packets of a 16KB transfer, the device has sent an NRDY,
and it never sends an ERDY, so the transfer hangs.

The last few lines of the dmesg look like this:

dwc3 dwc3.0: request ffff8801361cf5c0 from ep1out-bulk completed 16384/16384 ===> 0
dwc3 dwc3.0: ep1in-bulk: Transfer Not Ready
dwc3 dwc3.0: ep1in-bulk: reason Transfer Not Active
dwc3 dwc3.0: queing request ffff8801361cf2c0 to ep1in-bulk length 13
dwc3 dwc3.0: ep1in-bulk: req ffff8801361cf2c0 dma be053000 length 13 last
dwc3 dwc3.0: ep1in-bulk: cmd 'Start Transfer' params 00000000 37ae3000 00000000
dwc3 dwc3.0: Command Complete --> 0
dwc3 dwc3.0: queing request ffff8801361cf5c0 to ep1out-bulk length 1024
dwc3 dwc3.0: ep1in-bulk: Transfer Complete
dwc3 dwc3.0: request ffff8801361cf2c0 from ep1in-bulk completed 13/13 ===> 0
dwc3 dwc3.0: ep1out-bulk: Transfer Not Ready
dwc3 dwc3.0: ep1out-bulk: reason Transfer Not Active
dwc3 dwc3.0: ep1out-bulk: req ffff8801361cf5c0 dma be053800 length 1024 last
dwc3 dwc3.0: ep1out-bulk: cmd 'Start Transfer' params 00000000 3b9151e0 00000000
dwc3 dwc3.0: Command Complete --> 0
dwc3 dwc3.0: ep1out-bulk: Transfer Complete
dwc3 dwc3.0: request ffff8801361cf5c0 from ep1out-bulk completed 31/1024 ===> 0
dwc3 dwc3.0: queing request ffff8801361cf5c0 to ep1out-bulk length 16384
dwc3 dwc3.0: queing request ffff8801361ce600 to ep1out-bulk length 16384
dwc3 dwc3.0: ep1out-bulk: Transfer Not Ready
dwc3 dwc3.0: ep1out-bulk: reason Transfer Not Active
dwc3 dwc3.0: ep1out-bulk: req ffff8801361cf5c0 dma be054000 length 16384
dwc3 dwc3.0: ep1out-bulk: req ffff8801361ce600 dma be058000 length 16384 last
dwc3 dwc3.0: ep1out-bulk: cmd 'Start Transfer' params 00000000 3b9151f0 00000000
dwc3 dwc3.0: Command Complete --> 0
dwc3 dwc3.0: ep1out-bulk: Transfer Not Ready
dwc3 dwc3.0: ep1out-bulk: reason Transfer Active
dwc3 dwc3.0: ep1out-bulk: endpoint busy

and after that no more messages appear in the dmesg.

The "Transfer Not Ready" / "reason Transfer Active" only appears that
one time in the dmesg (there's only a few seconds worth of messages
in the buffer though).

After hacking around in the driver, I came up with the following
workaround:

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 6d64351..184f2dd 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -898,7 +898,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
 				last_one = 1;
 
 			dwc3_prepare_one_trb(dep, req, dma, length,
-					last_one, false);
+					true, false);
 
 			if (last_one)
 				break;

Obviously that's not the correct fix, but it does make the mass-storage
gadget work again.

Any ideas? Anything I can try to narrow it down?

-- 
Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux