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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 77B7FC3E8C5 for ; Fri, 27 Nov 2020 16:19:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47F9421534 for ; Fri, 27 Nov 2020 16:19:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731448AbgK0QTE (ORCPT ); Fri, 27 Nov 2020 11:19:04 -0500 Received: from verein.lst.de ([213.95.11.211]:38050 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731437AbgK0QTE (ORCPT ); Fri, 27 Nov 2020 11:19:04 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 3D1E668B05; Fri, 27 Nov 2020 17:19:00 +0100 (CET) Date: Fri, 27 Nov 2020 17:19:00 +0100 From: Christoph Hellwig To: Hans de Goede Cc: Christoph Hellwig , Tom Yan , Mathias Nyman , Greg Kroah-Hartman , linux-usb , Linux Kernel Mailing List , linux-pci@vger.kernel.org, Lu Baolu Subject: Re: 5.10 regression caused by: "uas: fix sdev->host->dma_dev": many XHCI swiotlb buffer is full / DMAR: Device bounce map failed errors on thunderbolt connected XHCI controller Message-ID: <20201127161900.GA10986@lst.de> References: <20201124102715.GA16983@lst.de> <8a52e868-0ca1-55b7-5ad2-ddb0cbb5e45d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8a52e868-0ca1-55b7-5ad2-ddb0cbb5e45d@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Fri, Nov 27, 2020 at 01:32:16PM +0100, Hans de Goede wrote: > I ran some more tests, I can confirm that reverting: > > 5df7ef7d32fe "uas: bump hw_max_sectors to 2048 blocks for SS or faster drives" > 558033c2828f "uas: fix sdev->host->dma_dev" > > Makes the problem go away while running a 5.10 kernel. I also tried doubling > the swiotlb size by adding: swiotlb=65536 to the kernel commandline but that > does not help. > > Some more observations: > > 1. The usb-storage driver does not cause this issue, even though it has a > very similar change. > > 2. The problem does not happen until I plug an UAS decvice into the dock. > > 3. The problem continues to happen even after I unplug the UAS device and > rmmod the uas module > > 3. made me take a bit closer look to the troublesome commit, it passes: > udev->bus->sysdev, which I assume is the XHCI controller itself as device > to scsi_add_host_with_dma, which in turn seems to cause permanent changes > to the dma settings for the XHCI controller. I'm not all that familiar with > the DMA APIs but I'm getting the feeling that passing the actual XHCI-controller's > device as dma-device to scsi_add_host_with_dma is simply the wrong thing to > do; and that the intended effects (honor XHCI dma limits, but do not cause > any changes the XHCI dma settings) should be achieved differently. > > Note that if this is indeed wrong, the matching usb-storage change should > likely also be dropped. One problem in this area is that the clamping of the DMA size through dma_max_mapping_size mentioned in the commit log doesn't work when swiotlb is called from intel-iommu. I think we need to wire up those calls there as well.