fastboot: Use asynchronous operations to send data
The fastboot command currently uses USBDEVFS_BULK to transfer data (including image data) to the target. On the kernel side it looks like this: 1. Allocate a contiguous memory region and copy the user data into the memory region (which may involve accessing storage). 2. Instruct the driver to start a DMA operation. 3. Wait for the DMA to finish. This is suboptimal because it misses out on a pipelining opportunity. We could be doing 3 for the current operation in parallel with 1 for the next operation, so that the next DMA is ready to go as soon as the current DMA finishes. The kernel supports asynchronous operations on usbdevfs file descriptors (USBDEVFS_SUBMITURB and USBDEVFS_REAPURB), so we can implement this like so: 1. Submit URB 0 2. Submit URB 1 3. Wait for URB 0 4. Submit URB 2 5. Wait for URB 1 and so on. That is what this CL implements. On my machine it increases transfer speed from 125 MB/s to 160 MB/s using a USB 3.0 connection to the target (Pixel 8). Bug: 324107907 Change-Id: I20db7ea14af85db48f6494091c8279ef7a21033d
Loading
Please register or sign in to comment