Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4468905ybx; Mon, 4 Nov 2019 13:57:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxVyQe2h1Z/DvGJDxxEFOJtlHAZPKtEiebZCfG6bxDKiD6t1/uV288e195jMSK51oyidXcr X-Received: by 2002:aa7:db52:: with SMTP id n18mr23942292edt.169.1572904642287; Mon, 04 Nov 2019 13:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572904642; cv=none; d=google.com; s=arc-20160816; b=JLmAl0uPC2eEreQWqQUyMOS0yKM0INa04zc+BCLZhWNl6WYvURN4pFgdPEvgO7xXZp ldQTnkVVAISB5Mhu+kNhxJYMw/AOdCTDwTZQRLsC6miqERLJDRAKXNyDBvy7KBFs+IYz dM0T1BmB5iQuOmA+Urb2Wkwr9J0lt4Gl+LhSi/h8aAulVcTfuYaXAv4TEjWLnJFSucaL KQ4QZc7z43Jv4wZ93CoT+usRi6XUHtjUph13QaSRtGLP3Qta0aJSeUMXBd5Ve80Oxnq8 fZl6prIhugyL/TK+6mBcVV1+GupN4JzohU8V5EfdJ5JNbiyvRPcdr42aBki2ua0uyzuy 1BPA== 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=hHR/9UQtqQ0m6efS1ZD1VG2A+UbQiHv5AEG8QAYiq6i08l4FSo5aGzrkPVNKpKRM9n BqVXUK1/W3ko4Rjru2OmKjEmUXOOICbAJ5nKJFbHdChA+GsofRfJjskd10tNTO8gNMFX SJesGZpHRe7QWj2edFYPCP08sdjH3ZOF1exRiY9cXhZjr16MAxbJeqjhvlvSR7vR8Ss7 3AELT3qk4FEfoqr0VG4emqO1LoURJCYfD75yH5tD84HeiYdrfbgohal0H/SveoAlgxu9 nOfl14YEeL9K7snyVa1MFNMsnxe+V/rtzYVOo5lYYmrfB5Qu+I8qKCW4rzYFjklG/RNI BOgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Yiq/1jte"; 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 b18si7435079eda.307.2019.11.04.13.56.59; Mon, 04 Nov 2019 13:57:22 -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="Yiq/1jte"; 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 S2388101AbfKDVzI (ORCPT + 99 others); Mon, 4 Nov 2019 16:55:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:50236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388075AbfKDVzH (ORCPT ); Mon, 4 Nov 2019 16:55:07 -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 DF1202053B; Mon, 4 Nov 2019 21:55:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572904506; bh=LnGi7vpMOb2KTMoHwxwbdgrQYvKnyn69x6Zgufgo/bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yiq/1jteNcD5Dw60VzUqOX0Ql/700E94z7I6Ncqr82UEMQ9sFAg/nrHErF7eSXXR2 rhQ30Bv4XoxFI3AjNQgFY5eqJ73KgEUeBtfvdq7uFajNEJhMWJlHzgq+MYXmhy4R9F E+D3lbt1FfFHwyrsuQz7r5ukGqwvxFZ7QHJxMFaU= 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.14 69/95] usb-storage: Revert commit 747668dbc061 ("usb-storage: Set virt_boundary_mask to avoid SG overflows") Date: Mon, 4 Nov 2019 22:45:07 +0100 Message-Id: <20191104212112.714673656@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212038.056365853@linuxfoundation.org> References: <20191104212038.056365853@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. */