Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4484508ybx; Mon, 4 Nov 2019 14:11:48 -0800 (PST) X-Google-Smtp-Source: APXvYqz+I6e+K0TKIfAhb5pT/NGklsgGZOjClPw99+LTJTBy2lcDTCYNk18FysWSyLvURt6/Qe6Z X-Received: by 2002:a17:906:2584:: with SMTP id m4mr26865948ejb.287.1572905508630; Mon, 04 Nov 2019 14:11:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905508; cv=none; d=google.com; s=arc-20160816; b=RbOKNPBHScpisLCjc0qZkrnFgBTRvhkJa9Dd4b5DpJIHigpGpVZ1FYNuKdjCRYyDcv dTu9jFY5ZvO/EDaKE+7VCySA+mMCjSwD0nZCdJvMqvXD7dFkS0tl/GpoKLSGrNh8o4SE GM4c3Zk5eclDD3H9clvdeDaMd9fIcAktPBDOzyRZbhKmgEO9nNNXbR4k1WkG/gx5O1KW Xz/xBERzawrxZ82F4DuAazuJRymrSewwKPg+ShBBjz65qear6jFTd2vOwMjVlIDPD6F2 ljOEQC+G+1bmgrWq4UDd92STQvEJT/bc7+utT9ieaGGoB5PZaYAPaoCpxRgl73cl9Jfw BFsw== 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=1XETVsSFByfxUrxt1aItPTtAHA+b5Fkt25SpsFNpa4Y=; b=z3Xwz/pGIGO/splaEqU3jmQYurr8DYPw+C1yKLBnleAOdSTj3s7m6AD7cGT4oQDHrY CtTJap8/Mndese4tdaU+JluhBC61BmcZt7bgatIbg0EPMWaUEGEJMoxGJ17b/wmcYIFD +8BvFpVdGuEH0DE2fH73Nmpja32/oD+PHRGm8KIvBXI2/9cHcO7rIUZxiMZhweqyOuCz +gTHAHRmWPg5FCkccu4lZQsAObp8EhB4OkK1EvdmIhQokcPlYek3XfvrxsTw0QokJMz3 l+Cwl4j4eM/J3JXAh3nFpOf7inJ0bhZqKKVu6BPurki0vGRGP8w93FvuM7+ty8q72D7t NLJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ODm0FTzO; 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 jx16si1274854ejb.353.2019.11.04.14.11.25; Mon, 04 Nov 2019 14:11:48 -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=ODm0FTzO; 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 S2389375AbfKDWIl (ORCPT + 99 others); Mon, 4 Nov 2019 17:08:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:41540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388621AbfKDWIj (ORCPT ); Mon, 4 Nov 2019 17:08:39 -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 9090020650; Mon, 4 Nov 2019 22:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905318; bh=lW4LCjKE30TWvQxPbJ+rchvYligfqkR3FDNxQC9o2W4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODm0FTzOZe7EWR4VyHJfDpz2D95rCqDpECpYprgQfEUkA5uXiPbqAiEDTs3jaPSCp jWd//oy8lCymxBc8sah73IQy3aXh5JbMXlOVJiXzOu96cZNiLKfDOqW1DiQoWAadog T+E9+0J+6QFDfGT9RPY3SiyKX5d4q6Vq0ELpgTnI= 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 5.3 105/163] usb-storage: Revert commit 747668dbc061 ("usb-storage: Set virt_boundary_mask to avoid SG overflows") Date: Mon, 4 Nov 2019 22:44:55 +0100 Message-Id: <20191104212147.688803646@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@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 @@ -67,7 +67,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 @@ -77,15 +76,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. */