Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4494747ybx; Mon, 4 Nov 2019 14:21:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzA9PkdkDbWOFimlsnLEiFAVJvQ7bWv2VwLZ6na33JbV2C+U9bG+Xto/i5Rn4Bep0ouL17l X-Received: by 2002:a17:906:f1d0:: with SMTP id gx16mr26064879ejb.62.1572906070468; Mon, 04 Nov 2019 14:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572906070; cv=none; d=google.com; s=arc-20160816; b=kf4L2EXVxBulrMx6QLwEaD9qD/oLclQWmfju1p3/bdMMh7Go8T3AX1cH92JjUEQkro gbm09MNEDow1a5Mn/4dCOjt926jo04n19tCjPrMUO7iKOHZ8taqStUZgv0HQDyJUt1w+ DwtHG9yW8cc5ix7793UqX8zKVGNGV2pGAVwf6DooCY2nM5Jms3jAOQaXZ9XpmGqoDVu1 iqg7LaU8XPvehrN2S2xX6zHhnQIKBPOYW1J8znqB1lb9qFQ+N0imBI/93ZzzDMnFx19g lAmwaEV/8LT0HaRQivdI7N76HnqvmLdIU8ps+obviwWPvkWnTpV1izzs3/GngI3fL8ci glpQ== 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=cY4TaFKigp1FuWcZnyVHpfu5wHfw9yOJORnA0nORg08=; b=0OHigpB9bz3HIvyRU1mPK/Y3WvRHkUFypPzX0uHn9T5w8Kd0EGIFwaYQBb+rxM/cnM PV75c4eoPig8502rCkji6jeUNZ+Xpn9Oy5aIhgOIP4pR+S/UeJfOiTZSCF+CcsA36XRn 2n/GaiQ9sUE+cKxCCg5m8JhTB8+zYK0+26q7YWi/40L6toE3En08feH/HKn8SEy2ODwO 7iojPRa219CKpvvjjXNKdbJkNYjE9S/ot33C3wFdS51zfQyAErKs4dfeaynRFOKkmt6D 6LWIsDbc4RM/XvCFFu3xRqs5pz+irCJZl4ebBcRF0JVc9sqoP+8hFu3DIscO2rlnnYE0 eNlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n2bs2C6t; 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 v20si7996496edm.254.2019.11.04.14.20.47; Mon, 04 Nov 2019 14:21:10 -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=n2bs2C6t; 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 S2389748AbfKDWSU (ORCPT + 99 others); Mon, 4 Nov 2019 17:18:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:60310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388613AbfKDWCB (ORCPT ); Mon, 4 Nov 2019 17:02:01 -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 5E5C620650; Mon, 4 Nov 2019 22:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572904920; bh=dbfnmF4MTitvESuoiUp5eiYv2w4XZsqdp7uk+45n8Lk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n2bs2C6tL5g5Z2tdCRHTSaMSEgD2MsIsVTmPnRZXL6q8RHFg0wsAnzvyoxtVo8WR4 egnAbKJsQe2/edfluTH1Y8SqdRiPAWhGvWqYVHjN0tBD4YcIpIz2MK6O+G/XSuIT6N a/U0ZZ5Ir4FqEqKSBDGlvc4WRUElKAaVz7u3WR/8= 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.19 116/149] usb-storage: Revert commit 747668dbc061 ("usb-storage: Set virt_boundary_mask to avoid SG overflows") Date: Mon, 4 Nov 2019 22:45:09 +0100 Message-Id: <20191104212144.459583669@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212126.090054740@linuxfoundation.org> References: <20191104212126.090054740@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 @@ -65,7 +65,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 @@ -75,15 +74,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. */