Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4503781ybx; Mon, 4 Nov 2019 14:29:24 -0800 (PST) X-Google-Smtp-Source: APXvYqx5on8qq5ECQwcVWYjl0A71T+YgHAhGXqODWrqv+3rxqyxcSi2QgIl+X0qCgvpzxZNMTzek X-Received: by 2002:a50:fd03:: with SMTP id i3mr32627271eds.70.1572906564552; Mon, 04 Nov 2019 14:29:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572906564; cv=none; d=google.com; s=arc-20160816; b=bA6UbcdvOzpNSgSFJ5dEGdJCfnr+ifXqqUuSpJnOiRmhBjwSSX5qp2lwnCu/I8uVGQ FSt2q/G/zX80BbdcciXxjUsu8leIGwP7BXfUPChERVC+fwTP+fQqzVwFYbO4Sz/pvQnr tFhnAcZfIxXgovDsODO1NJRkDwKG0mMpeXg32lTHDz0Hu+WZVDl7kBa/bRRjNep/zA1A YD1P8pTEbfnQtxWdQRkwnn/nAyy0+f6d9E/ogeqKimvvB29RSj8opHgx6nDEjCYZpK5Y zW72tpmZpaOof/VD2JGHm842LS2yqdnd1Y5UC2KKsxaI0O+R1WVnhowMJ52ImWjV3ye0 wvIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zkvqbEiFWf8/aot/vGaK0QE6YPKH87FOcr5Nqt7I2xM=; b=aoySOxocEhalzvDo4gsJDYyHSGF+LrX2iSS/ZlQrTgKNKSRH4o8LMZWoTmVcodkWLh KG1P7uW96dOXxBoNGglbEvuslxMKxf6+jOAqDQJa/d3SmviFR4If0XdoBRFe6r3odCzc 7Du2z6udyfk5cakKhsO28i08FgmEe9eUr4plZjOuLYzWXv+7kG2qCb2aPxNcxCyxlGWW hOhNFtN6vX/Gn5NlqWlexGZ6X5/RjH4FcM03Ugf32yaKHX691+p0CSGpX/aRJgtC+GeJ r+XAqe9GCpZjAITKvku0CZGHGjQXO6RSZBfBQ8mQKsM+XAAKXag+eEmyJeWuiKtiDEQW GnKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=asijqcrb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17si12526254ejg.44.2019.11.04.14.29.01; Mon, 04 Nov 2019 14:29:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=asijqcrb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730378AbfKDVu7 (ORCPT + 99 others); Mon, 4 Nov 2019 16:50:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:43546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729880AbfKDVu4 (ORCPT ); Mon, 4 Nov 2019 16:50:56 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 98BF82184C; Mon, 4 Nov 2019 21:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572904255; bh=LnGi7vpMOb2KTMoHwxwbdgrQYvKnyn69x6Zgufgo/bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asijqcrbr+DkxTSbDAMUpaQwzcrP8YF39OHLQZeR0b5qmO6xANjHRspXTgErXKI+Z 1vMmRhL3DXwnkfr4YBUH9KfHZksTPqNcq8IelcQPMkO3jjWUQbXAy9vTFpl59E10op +K8C343JJ9x3jm8qImJvMxDynocoLDeR7voO1URU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Seth Bollinger , Christoph Hellwig , Piergiorgio Sartor Subject: [PATCH 4.9 39/62] usb-storage: Revert commit 747668dbc061 ("usb-storage: Set virt_boundary_mask to avoid SG overflows") Date: Mon, 4 Nov 2019 22:45:01 +0100 Message-Id: <20191104211941.905036206@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104211901.387893698@linuxfoundation.org> References: <20191104211901.387893698@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alan Stern commit 9a976949613132977098fc49510b46fa8678d864 upstream. Commit 747668dbc061 ("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 09324d32d2a0 ("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 ea44d190764b ("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 747668dbc061. Reported-and-tested-by: Piergiorgio Sartor Link: https://marc.info/?l=linux-usb&m=157134199501202&w=2 Signed-off-by: Alan Stern CC: Seth Bollinger CC: Fixes: 747668dbc061 ("usb-storage: Set virt_boundary_mask to avoid SG overflows") Acked-by: Christoph Hellwig Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.1910211145520.1673-100000@iolanthe.rowland.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/scsiglue.c | 10 ---------- 1 file changed, 10 deletions(-) --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -81,7 +81,6 @@ static const char* host_info(struct Scsi static int slave_alloc (struct scsi_device *sdev) { struct us_data *us = host_to_us(sdev->host); - int maxp; /* * Set the INQUIRY transfer length to 36. We don't use any of @@ -91,15 +90,6 @@ static int slave_alloc (struct scsi_devi sdev->inquiry_len = 36; /* - * USB has unusual scatter-gather requirements: the length of each - * scatterlist element except the last must be divisible by the - * Bulk maxpacket value. Fortunately this value is always a - * power of 2. Inform the block layer about this requirement. - */ - maxp = usb_maxpacket(us->pusb_dev, us->recv_bulk_pipe, 0); - blk_queue_virt_boundary(sdev->request_queue, maxp - 1); - - /* * Some host controllers may have alignment requirements. * We'll play it safe by requiring 512-byte alignment always. */