From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A35AC64E8A for ; Mon, 30 Nov 2020 09:50:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6554208FE for ; Mon, 30 Nov 2020 09:50:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C+wJ0kQv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728649AbgK3JuN (ORCPT ); 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-Google-Smtp-Source: ABdhPJwdlAzbk5hlkROC5+9ochugF0OWYYO091mqBJkAEk4CCgyNyUe0/uBeXhDUaExIqPmKu1O1ZQ== 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; > >