Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3389899pxu; Mon, 30 Nov 2020 01:52:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhRnjfe3grXoBO0NApkcPb4/Jzl8Wpn4AGIZRGIKybvO5b6Ko+pbwZSVeOMxDdUFrIisj2 X-Received: by 2002:a17:906:17d1:: with SMTP id u17mr20198980eje.229.1606729927267; Mon, 30 Nov 2020 01:52:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606729927; cv=none; d=google.com; s=arc-20160816; b=qwsgRvLBJHXk8f8alEVbKyDyia+adQ6iIpW2XIRMtBF3y69w19QhMr9er8sqXpwp+y gT77HmYu4os4dCIPH0t9BqfPX95fWCVOV0/FOPr14Ii+a1yIhz/spnfS6uiHeqHa4SgN namLlr5uojEeRQWl57HpJaOTzJgfS3xrV32BDEiYjYyAXciCUNRUgE3AX6rkukj7Rijq O1tyLb2C2pPJI7lWRZf6SDHhsiRCb6TFnaEeO4M40gzdIqA3ryOWda6a3ZEDUNGA0HBY n2OuQ/hckoFmDkRCtgqZYvhwXAsiu6nBHV3kCh4+jTFix4ruIWPBUdUiT/N0gi7PI+HZ O7XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=tPvt5Fze9oePySh23BCqzPG4KjGI8dK/uioZmRf36R0=; b=TKX8wbYJf10YfNR83XCXNYB7w2xiTX+whqp7CRSun+ZWW8/cfLp67oVGf85yMXIq4P +g770f/jYB8f+8GYFhLyC5xDS4sVbwtCFp+YZ7zSBZbWQLHyBD/hwkAn4ACpg/zNh0gC BM1kbWEJBIA4G9MhkYM2rr+169m0+dVr3SxPPhLPYatbAgkUYExTZVzBD3P8ZjAFDDya kHKlTF6f5JYop9iwbRtnlUgyy3+HXENHAds9wk/Y4Mnkh/yDx0HSwl+yGI4hcqBlkqX9 cPdpW18QdEfzPEEZgI9klBYdoUeSC0+4RUCXjvcdZyN3/fH8hw0mc99CjowB/Afv3IQT 5dhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C+wJ0kQv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ng3si6118213ejb.344.2020.11.30.01.51.43; Mon, 30 Nov 2020 01:52:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C+wJ0kQv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725976AbgK3JuN (ORCPT + 99 others); Mon, 30 Nov 2020 04:50:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43275 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725972AbgK3JuM (ORCPT ); Mon, 30 Nov 2020 04:50:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606729725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tPvt5Fze9oePySh23BCqzPG4KjGI8dK/uioZmRf36R0=; b=C+wJ0kQvjtVCvjR20IEZGBKE10DAE4HaAqieHw9sX4bTkJ/CxPCdTWCIT9e8TbIq3sPZjf nbMPWIch7mTmZzSHcqYoX9rNek9Mjxzxur/SGDwyRVte4xf22vIeDCcKR1dLpgn5FvCygz HKYeRgsl9ckQIoJKk91tpv20bYQfZ9s= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-160-kidLLTOrOjW7jhvrzqc-wg-1; Mon, 30 Nov 2020 04:48:44 -0500 X-MC-Unique: kidLLTOrOjW7jhvrzqc-wg-1 Received: by mail-ed1-f72.google.com with SMTP id dc6so4282069edb.14 for ; Mon, 30 Nov 2020 01:48:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tPvt5Fze9oePySh23BCqzPG4KjGI8dK/uioZmRf36R0=; b=kWzwoxfy4oMWYfFrpZvly1+LPPIS8vc08d7DKZMRAAhyyDuT7fVoMIrZJ3yPrAXgvW 8+y/K7VOcbrhbZvViVRRqLDwFZ5RgngHg675+64uXgKegMcFknKyLlhuFSfVfOVnC18k QOHObUuGfAOqBPZl8jNMH8pdpi8RSuGwv2vMRZZWkwfRVn7UM2IZ6Ws4/6c+Cj5O+Mtm zh8fcivMILGpkRQahjj2fvCP/Z0WWPL8YhlqbIAUskoIMfSQSU+LWPaYGqNOrZHllCZk m8XTmdjQFgmpAH7c6uJ/R9Q153ud8F+0iYhrKIl7GdBfStZGo+PF04Falb/ErOU/U+lP MBww== X-Gm-Message-State: AOAM533eITOrgEe520I/EKZ6kCHNFZMfua2pkJC1qIkXcBtw350J2uce ZWFt0gk9gN4+InvlOmUMF135ymdxhpbt8wwhvJ7jcPYecE/B3OY2iGgIhntNWYlu9qfKw+G1Yxc HGUTQj0zZnrnRHZgctcZ5EuGX X-Received: by 2002:a17:906:470a:: with SMTP id y10mr17599175ejq.180.1606729722710; Mon, 30 Nov 2020 01:48:42 -0800 (PST) X-Received: by 2002:a17:906:470a:: with SMTP id y10mr17599165ejq.180.1606729722558; Mon, 30 Nov 2020 01:48:42 -0800 (PST) Received: from x1.localdomain (2001-1c00-0c0c-fe00-d2ea-f29d-118b-24dc.cable.dynamic.v6.ziggo.nl. [2001:1c00:c0c:fe00:d2ea:f29d:118b:24dc]) by smtp.gmail.com with ESMTPSA id k11sm8850492edh.72.2020.11.30.01.48.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2020 01:48:41 -0800 (PST) Subject: Re: [PATCH 1/2] uas: revert from scsi_add_host_with_dma() to scsi_add_host() To: Tom Yan , hch@lst.de, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org Cc: mathias.nyman@intel.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, baolu.lu@linux.intel.com References: <09992cec-65e4-2757-aae6-8fb02a42f961@redhat.com> <20201128154849.3193-1-tom.ty89@gmail.com> From: Hans de Goede Message-ID: <62e0d5ea-e665-b913-5482-a75db0ac1368@redhat.com> Date: Mon, 30 Nov 2020 10:48:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201128154849.3193-1-tom.ty89@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/28/20 4:48 PM, Tom Yan wrote: > Apparently the former (with the chosen dma_dev) may cause problem in certain > case (e.g. where thunderbolt dock and intel iommu are involved). The error > observed was: > > XHCI swiotlb buffer is full / DMAR: Device bounce map failed > > For now we retain the clamp for hw_max_sectors against the dma_max_mapping_size. > Since the device/size for the clamp that is applied when the scsi request queue > is initialized/allocated is different than the one used here, we invalidate the > early clamping by making a fallback blk_queue_max_hw_sectors() call. > > Signed-off-by: Tom Yan I can confirm that this fixes the network performance on a Lenovo Thunderbolt dock generation 2, which uses an USB attach NIC. With this patch added on top of 5.10-rc5 scp performance to another machine on the local gbit LAN goes back from the regressed 1 MB/s to its original 100MB/s as it should be: Tested-by: Hans de Goede Regards, Hans > --- > drivers/usb/storage/uas.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c > index c8a577309e8f..5db1325cea20 100644 > --- a/drivers/usb/storage/uas.c > +++ b/drivers/usb/storage/uas.c > @@ -843,18 +843,21 @@ static int uas_slave_alloc(struct scsi_device *sdev) > static int uas_slave_configure(struct scsi_device *sdev) > { > struct uas_dev_info *devinfo = sdev->hostdata; > - struct device *dev = sdev->host->dma_dev; > + struct usb_device *udev = devinfo->udev; > > if (devinfo->flags & US_FL_MAX_SECTORS_64) > blk_queue_max_hw_sectors(sdev->request_queue, 64); > else if (devinfo->flags & US_FL_MAX_SECTORS_240) > blk_queue_max_hw_sectors(sdev->request_queue, 240); > - else if (devinfo->udev->speed >= USB_SPEED_SUPER) > + else if (udev->speed >= USB_SPEED_SUPER) > blk_queue_max_hw_sectors(sdev->request_queue, 2048); > + else > + blk_queue_max_hw_sectors(sdev->request_queue, > + SCSI_DEFAULT_MAX_SECTORS); > > blk_queue_max_hw_sectors(sdev->request_queue, > min_t(size_t, queue_max_hw_sectors(sdev->request_queue), > - dma_max_mapping_size(dev) >> SECTOR_SHIFT)); > + dma_max_mapping_size(udev->bus->sysdev) >> SECTOR_SHIFT)); > > if (devinfo->flags & US_FL_NO_REPORT_OPCODES) > sdev->no_report_opcodes = 1; > @@ -1040,7 +1043,7 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) > shost->can_queue = devinfo->qdepth - 2; > > usb_set_intfdata(intf, shost); > - result = scsi_add_host_with_dma(shost, &intf->dev, udev->bus->sysdev); > + result = scsi_add_host(shost, &intf->dev); > if (result) > goto free_streams; > >