Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4497962ybx; Mon, 4 Nov 2019 14:24:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxI2m2Wy/5CDJPeEENYezpntxpzPjYxKHMeDo9sHg6HghVn3fHz9QuIji4gBy+ux97RGZHG X-Received: by 2002:aa7:d2cf:: with SMTP id k15mr14639012edr.267.1572906243303; Mon, 04 Nov 2019 14:24:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572906243; cv=none; d=google.com; s=arc-20160816; b=OyTl12aY7/E3HpWB6hOTyHLItBzUoAB0yd3GpP8Hfim0Bv2NtfkqjZf3E2BMcf1zLn YhKeb4QHkTMHeeqKN18IBs6TmehMpvQOg9ADlF3WGLb2dC/O9d1Mq7S3fESA3IX3Dwoh R/D5PKeE/LhfIcbRJSdABiUWcz88PR9yVRIG5TP1xt3Y484KjbOrpKnt5ZvwzM4HrbGJ ZeXN2DejdUDBUNAcDnYgu9OHti1vec1SJzrjtJAYSVdqAieiwJvoGDiVQtr+Mof77f0k rf8uoOawigOFL0CA3aOEIRPTgTc+nfb2Ej8v6hRbz+2cT01bjHf1EZDXPowtCC/4eMfM B0ug== 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=5k6emONwf7csWECSdt1lTvWCA+gebC8fCYvAXD8s35g=; b=EVKJZFkyN+wVLNbVY+ENfI7uulHjkEE4wPRoFWubbi1WoLfckovQietO7gHvOAU6lc UfZ4UH5Ludwmxg2x9DUj2oxZwmfhObOh6ycKD9yJwBkZfWxY+0UFI2uHb23np0m0MeqA AlS1bNi5mEv+b3BMu5S+hS3zw+d34ify2ByehnpqohulwWd2DMCgARl23OUR8QrBw2oI x2Gt3cdlA/ikZd2UAhqKZOaUz+/JoNr4jE4OrTzJANzE+TRZUHudz9EaSxg5qZebc1AQ t5R9Bj7gsIorO1OlnaHszC8vZBRmo2YSQUDWJ6sE+M3C8PYf46THWAnINWJFS30RfuDe WgDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SZcIbRK7; 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 n5si12262202ejb.67.2019.11.04.14.23.39; Mon, 04 Nov 2019 14:24:03 -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=SZcIbRK7; 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 S2388080AbfKDVzE (ORCPT + 99 others); Mon, 4 Nov 2019 16:55:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:50090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388066AbfKDVzB (ORCPT ); Mon, 4 Nov 2019 16:55: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 2B369217F4; Mon, 4 Nov 2019 21:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572904500; bh=jMAEKlxyC3ermhSxITfVSGgBVe4mb/AT5OiGWW7wYCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SZcIbRK7+SwZAgt1T6C69OYmHC3R/rv4OWlVOOgRCLW0iEDm07PsiXRip14CiFR6P Gaw0qashHWgpUiGNadCWax9zdNP/kyyUEbtV1baLDl3ARZPd2x3QdBAsjyaoDGG7H9 D3//Jiaxr5MWXYBMKeutot+I/uXvOHQ/HzE4gtsY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Oliver Neukum , Christoph Hellwig Subject: [PATCH 4.14 67/95] UAS: Revert commit 3ae62a42090f ("UAS: fix alignment of scatter/gather segments") Date: Mon, 4 Nov 2019 22:45:05 +0100 Message-Id: <20191104212111.409017128@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 1186f86a71130a7635a20843e355bb880c7349b2 upstream. Commit 3ae62a42090f ("UAS: fix alignment of scatter/gather segments"), copying a similar commit for usb-storage, 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 the analogous change in usb-storage interacted 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 in the uas driver. 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 head off potential problems similar to those affecting usb-storage, this patch reverts commit 3ae62a42090f. Signed-off-by: Alan Stern CC: Oliver Neukum CC: Acked-by: Christoph Hellwig Fixes: 3ae62a42090f ("UAS: fix alignment of scatter/gather segments") Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.1910231132470.1878-100000@iolanthe.rowland.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/uas.c | 20 -------------------- 1 file changed, 20 deletions(-) --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -796,30 +796,10 @@ static int uas_slave_alloc(struct scsi_d { struct uas_dev_info *devinfo = (struct uas_dev_info *)sdev->host->hostdata; - int maxp; sdev->hostdata = devinfo; /* - * We have two requirements here. We must satisfy the requirements - * of the physical HC and the demands of the protocol, as we - * definitely want no additional memory allocation in this path - * ruling out using bounce buffers. - * - * For a transmission on USB to continue we must never send - * a package that is smaller than maxpacket. Hence the length of each - * scatterlist element except the last must be divisible by the - * Bulk maxpacket value. - * If the HC does not ensure that through SG, - * the upper layer must do that. We must assume nothing - * about the capabilities off the HC, so we use the most - * pessimistic requirement. - */ - - maxp = usb_maxpacket(devinfo->udev, devinfo->data_in_pipe, 0); - blk_queue_virt_boundary(sdev->request_queue, maxp - 1); - - /* * The protocol has no requirements on alignment in the strict sense. * Controllers may or may not have alignment restrictions. * As this is not exported, we use an extremely conservative guess.