Skip to content

Commit 9a97694

Browse files
AlanSterngregkh
authored andcommitted
usb-storage: Revert commit 747668d ("usb-storage: Set virt_boundary_mask to avoid SG overflows")
Commit 747668d ("usb-storage: Set virt_boundary_mask to avoid SG overflows") attempted to solve a problem involving scatter-gather I/O and USB/IP by setting the virt_boundary_mask for mass-storage devices. However, it now turns out that this interacts badly with commit 09324d3 ("block: force an unlimited segment size on queues with a virt boundary"), which was added later. A typical error message is: ehci-pci 0000:00:13.2: swiotlb buffer is full (sz: 327680 bytes), total 32768 (slots), used 97 (slots) There is no longer any reason to keep the virt_boundary_mask setting for usb-storage. It was needed in the first place only for handling devices with a block size smaller than the maxpacket size and where the host controller was not capable of fully general scatter-gather operation (that is, able to merge two SG segments into a single USB packet). But: High-speed or slower connections never use a bulk maxpacket value larger than 512; The SCSI layer does not handle block devices with a block size smaller than 512 bytes; All the host controllers capable of SuperSpeed operation can handle fully general SG; Since commit ea44d19 ("usbip: Implement SG support to vhci-hcd and stub driver") was merged, the USB/IP driver can also handle SG. Therefore all supported device/controller combinations should be okay with no need for any special virt_boundary_mask. So in order to fix the swiotlb problem, this patch reverts commit 747668d. Reported-and-tested-by: Piergiorgio Sartor <[email protected]> Link: https://marc.info/?l=linux-usb&m=157134199501202&w=2 Signed-off-by: Alan Stern <[email protected]> CC: Seth Bollinger <[email protected]> CC: <[email protected]> Fixes: 747668d ("usb-storage: Set virt_boundary_mask to avoid SG overflows") Acked-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d4d8257 commit 9a97694

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

drivers/usb/storage/scsiglue.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ static const char* host_info(struct Scsi_Host *host)
6868
static int slave_alloc (struct scsi_device *sdev)
6969
{
7070
struct us_data *us = host_to_us(sdev->host);
71-
int maxp;
7271

7372
/*
7473
* Set the INQUIRY transfer length to 36. We don't use any of
@@ -77,15 +76,6 @@ static int slave_alloc (struct scsi_device *sdev)
7776
*/
7877
sdev->inquiry_len = 36;
7978

80-
/*
81-
* USB has unusual scatter-gather requirements: the length of each
82-
* scatterlist element except the last must be divisible by the
83-
* Bulk maxpacket value. Fortunately this value is always a
84-
* power of 2. Inform the block layer about this requirement.
85-
*/
86-
maxp = usb_maxpacket(us->pusb_dev, us->recv_bulk_pipe, 0);
87-
blk_queue_virt_boundary(sdev->request_queue, maxp - 1);
88-
8979
/*
9080
* Some host controllers may have alignment requirements.
9181
* We'll play it safe by requiring 512-byte alignment always.

0 commit comments

Comments
 (0)