Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2707408imj; Mon, 18 Feb 2019 10:38:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IZzI3s2bgttlulrMB+0d1+mHMQawjOEl+xbwbfCOKqKJCuURCBk62u6ZzWdpVydDmjqQWuB X-Received: by 2002:a17:902:7d92:: with SMTP id a18mr9796546plm.215.1550515086757; Mon, 18 Feb 2019 10:38:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550515086; cv=none; d=google.com; s=arc-20160816; b=LZbo8S1TR/wnawztw45PPoQSKMyDB69xyUXsxzvsiJnew71otZfK+EU9+LGJITWZ/p UUAyg8LDIo8x0j57RwG/t+YDBBvog+rUJXeZwKzO9HZRcpjforAcMDkWjsUhHHTZtZ5A u7yg/8omVnYRYBDlO8tjCJiFGDqGwWPjl2aJflEEItgLgF1H+/ZdjG2QppzuScaTv5qM dYn3B+ly0ma2SRUQ8SkKjI0Z4ZhhBbqkFGiKU7T1wLjJ6yzLXdBUYKLJiEdtKsw0QzJc 82w5M60tFMOWtJL5lekfK9CN51PYmIJodNm85Lawq88WynCjHy9u9dcXeaJ87V7KWaqU mDQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=UHPpJT5oiNNLod+IJDRGWkaQD0QAk6ppGoNG+v3R+44=; b=qtFYj2stWxnLBphe3VdKBI6wFOG/NpmT6U7gmd/JW1VuWtCKb34yhYSlzfmtOoVIaL 6qSXiSkW1+yAFpT68AJ31OAZNzSLA4z8WnxvuvBdjv3NnpLrUdeH5PnF6fm4RU/t10q7 lxGkF70aTr8kBGivkFiv/kiHcElGijlOphdNFB1XYVA2R/g2tYexFxLLNZrVW9NlV93k mjCYLnC7N7278r9ZI0ULPt0c5LPswIqnc4J94Xxm9NyU7I5Ez9wsMcfu46iI6Il1czih pYBLPkgCoyQ99p0wI+I8YEvqUXgQlRnNFNeOHf8nZxVYA1XjH2pCD/WW+e9xdI3QIBg0 2hzQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si13399922pgm.129.2019.02.18.10.37.50; Mon, 18 Feb 2019 10:38:06 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731316AbfBRPP2 (ORCPT + 99 others); Mon, 18 Feb 2019 10:15:28 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55352 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730214AbfBRPP2 (ORCPT ); Mon, 18 Feb 2019 10:15:28 -0500 Received: by mail-wm1-f67.google.com with SMTP id q187so5441863wme.5 for ; Mon, 18 Feb 2019 07:15:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UHPpJT5oiNNLod+IJDRGWkaQD0QAk6ppGoNG+v3R+44=; b=Pp0Lwk1KLUuJ+S7wqUR3cx7E/sVZ20vOLvLCSfOcjnixH/99SS9Tqi+e7ia6+MbaVn roPEHbpmW22Nl8xeh8PCXKRPh+m3XgQ8SjYz+IRPGJuIsB230f3P2vQr+zgB9NZkXd6S RU5Ys7NaAqWlApHKZC2oMMi52vk8d19o7PnpzgUJjuESNjuxhgWcoxlMmSDg3uB+LqWm li/sn/EnDwe2aipHHvZDnGAREfSZ06dYJw5Pef5RHLwoavYKAJi3Fl2BXXt6F+aUjDqX u1exRRsdpd6XfrENhZBtCM8leRNnz5+pfXJkQCSjuNAh5iNhJlPa/Pe3HuqxZPXgDLrz +9rg== X-Gm-Message-State: AHQUAuZILcXk2mBpPPggzWgS3vp+kjjPNB9zWu4DTswm3DATWmB4MVmk SqCcCpKWrj6tqkU2q03hU3amRw== X-Received: by 2002:a1c:80c4:: with SMTP id b187mr15261442wmd.23.1550502925478; Mon, 18 Feb 2019 07:15:25 -0800 (PST) Received: from localhost.localdomain (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id c18sm16373689wre.32.2019.02.18.07.15.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Feb 2019 07:15:24 -0800 (PST) Date: Mon, 18 Feb 2019 16:15:22 +0100 From: Lorenzo Bianconi To: Stanislaw Gruszka Cc: Rosen Penev , linux-wireless , Samuel Sieb , Alexander Duyck , iommu@lists.linux-foundation.org, Joerg Roedel , linux-kernel@vger.kernel.org Subject: Re: MT76x2U crashes XHCI driver on AMD Ryzen system Message-ID: <20190218151521.GB9283@localhost.localdomain> References: <83A1D243-9073-48D1-9F26-5A2581DCB829@gmail.com> <1547404075.1582.0@smtp.gmail.com> <20190114091841.GA23045@localhost.localdomain> <20190115090400.GA2267@localhost.localdomain> <20190218143742.GA11872@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190218143742.GA11872@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > (cc: IOMMU & page_frag_alloc maintainers) > > On Tue, Jan 15, 2019 at 10:04:01AM +0100, Lorenzo Bianconi wrote: > > > On Mon, Jan 14, 2019 at 1:18 AM Lorenzo Bianconi > > > wrote: > > > > > > > > > On Sun, Jan 13, 2019 at 11:00 AM Lorenzo Bianconi > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > On Sun, Jan 13, 2019 at 5:33 AM, Lorenzo Bianconi wrote: > > > > > > > > > > > > > > Direct. No VM used. This is the only peripheral causing this issue. > > > > > > > > > > > > > > Is the device connected to a usb3.0 port? If so, could you please try to connect the dongle to a 2.0 one? > > > > > > > > > > > > > > I tried through a USB 2.0 port. Shouldn't make a difference as they both use the xhci driver. > > > > > > > > > > > > > > > > > > > mt76x2u supports scatter-gather on usb 3.0 (not on 2.0) > > > > > Tried a USB 3 port. Same result. > > > > > > > > > > > > > Could you please double check if IOMMU is enabled? > > > > > > > > > > > > > > > > > > > Have you tried to disable it? Does it make any difference? > > > > > No idea how. UEFI doesn't seem to show anything similar. > > > > > > > > > > Similar bug report: https://bugzilla.kernel.org/show_bug.cgi?id=202241 > > FWIW: I provided some patches in the bugzilla, which were reported to > solve the problem. But I looking for confirmation if both are needed: > > 0001-mt76x02u-use-usb_bulk_msg-to-upload-firmware.patch > 0002-mt76usb-do-not-use-compound-head-page-for-SG-I-O.patch > > Or problem can be solved by just one of it (either first or second). > > Additionally I'm not 100% sure if > > 0002-mt76usb-do-not-use-compound-head-page-for-SG-I-O.patch > > is correct. So perhaps some IOMMU maintainer could look at it. > > > > > You should be able to disable iommu using GRUB_CMDLINE_LINUX in > > > > /etc/default/grub (I guess setting iommu=off and reinstalling grub) > > > > https://wiki.gentoo.org/wiki/IOMMU_SWIOTLB > > > Yep. Working great now. I wonder what mt76 is doing to cause the crash though... > > > > Thanks for bisecting the issue. > > Lorenzo, what you mean by 'bisecting' here ? Someone did 'git bisect' > on this issue? > Hi Stanislaw, I was meaning 'help bisecting' the issue > > I think amd iommu does not support well usb scatter-gather > > (used by default in mt76u). I am working on a series in order to add the possibility to > > disable it. > > Even if that true that AMD IOMMU does not support 'well' SG (what I think > is not true) disabling SG in mt76 driver is not right solution. Right > solution would be propagate the issue to AMD IOMMU maintainers > (already CCed). I meant that AMD iommu seems to have different constraints respect to Intel one. Regards, Lorenzo > > One problem in mt76 is page_frag_alloc() usage with different sizes. > page_frag_alloc() unlike like other allocators do not assure alignment > and relay on callers to provide buffers sizes that are aligned. > Unaligned buffer might then not be appropriate for DMA. > > Another issue is that dma_map_sg() & dma_map_page() may require some > constraints. I'm not sure about that and I want to clarify that with > CCed mm maintainers. I think DMA drivers may expect sg->offset < PAGE_SIZE > for both dma_map_sg() and dma_map_page(). Additionally dma_map_page() > maight expect that offset & length specify buffer within one page. > > Stanislaw