From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Subject: [BUG] mt76x0u: Probing issues on Raspberry Pi 3 B+ From: Stanislaw Gruszka Message-Id: <20190211074455.GA6292@redhat.com> Date: Mon, 11 Feb 2019 08:44:56 +0100 To: Lorenzo Bianconi Cc: Stefan Wahren , Felix Fietkau , Doug Anderson , Minas Harutyunyan , linux-wireless , linux-usb@vger.kernel.org List-ID: T24gU3VuLCBGZWIgMTAsIDIwMTkgYXQgMTE6MjI6MjVBTSArMDEwMCwgTG9yZW56byBCaWFuY29u aSB3cm90ZToKPiA+IE9uIFNhdCwgRmViIDA5LCAyMDE5IGF0IDA5OjI5OjA1UE0gKzAxMDAsIFN0 ZWZhbiBXYWhyZW4gd3JvdGU6Cj4gPiA+ID4gY291bGQgeW91IHBsZWFzZSB0ZXN0IHRoZSBmb2xs b3dpbmcgc2VyaWVzOgo+ID4gPiA+IGh0dHBzOi8vcGF0Y2h3b3JrLmtlcm5lbC5vcmcvY292ZXIv MTA3NjQ0NTMvCj4gPiA+Cj4gPiA+IHllYWggdGhpcyBmaXhlZCB0aGUgcHJvYmluZyB0aW1lb3V0 IGFuZCB0aGUgZHJpdmVyIHdpbGwgcHJvYmUgc3VjY2Vzc2Z1bC4gQUZBSUsgdGhlIGR3YzIgaG9z dCBtb2RlIGRvZXNuJ3Qgc3VwcG9ydCBzY2F0dGVyLWdhdGhlciB5ZXQuCj4gPgo+ID4gU28gdGhp cyBpcyBlaXRoZXIgZHdjMiBzY2F0dGVyLWdhdGhlciBwcm9ibGVtIHdoaWNoIHNob3VsZCBiZSBh ZGRyZXNzZWQgaW4KPiA+IHRoaXMgZHJpdmVyIG9yIG10NzZ4MHUgZG9lcyBzb21ldGhpbmcgd3Jv bmcgd2hlbiBjb25maWd1cmluZyBTRy4KPiA+Cj4gPiBEaXNhYmxpbmcgU0cgaXMganVzdCB3b3Jr YXJvdW5kLCB3aGljaCB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iBiZSBpbiBtdDc2IGRyaXZlciB0YWtp bmcgdGhhdCBwcm9ibGVtcwpoYXBwZW5lZCBvbiBkaWZmZXJlbnQgcGxhdGZvcm1zIChycGkgYW5k IEFNRCBJT01NVSksIGkuZS4gd2UgZG8gbm90CmNvcnJlY3RseSBzZXQgdXJiLT5udWJfc2VnIG9y IGxlbmd0aCBvciBkbyBzb21lIG90aGVyIHRoaW5nIHdyb25nLgoKU3RhbmlzbGF3Cg== 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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham 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 D3393C169C4 for ; Mon, 11 Feb 2019 07:45:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAFE120811 for ; Mon, 11 Feb 2019 07:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726751AbfBKHpD (ORCPT ); Mon, 11 Feb 2019 02:45:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51232 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725931AbfBKHpD (ORCPT ); Mon, 11 Feb 2019 02:45:03 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D55D47F6CE; Mon, 11 Feb 2019 07:45:02 +0000 (UTC) Received: from localhost (ovpn-204-174.brq.redhat.com [10.40.204.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CBF162662; Mon, 11 Feb 2019 07:44:57 +0000 (UTC) Date: Mon, 11 Feb 2019 08:44:56 +0100 From: Stanislaw Gruszka To: Lorenzo Bianconi Cc: Stefan Wahren , Felix Fietkau , Doug Anderson , Minas Harutyunyan , linux-wireless , linux-usb@vger.kernel.org Subject: Re: [BUG] mt76x0u: Probing issues on Raspberry Pi 3 B+ Message-ID: <20190211074455.GA6292@redhat.com> References: <2003727085.234456.1549714119945@email.ionos.de> <165515185.283024.1549744145982@email.ionos.de> <20190210094123.GB2913@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 11 Feb 2019 07:45:03 +0000 (UTC) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Sun, Feb 10, 2019 at 11:22:25AM +0100, Lorenzo Bianconi wrote: > > On Sat, Feb 09, 2019 at 09:29:05PM +0100, Stefan Wahren wrote: > > > > could you please test the following series: > > > > https://patchwork.kernel.org/cover/10764453/ > > > > > > yeah this fixed the probing timeout and the driver will probe successful. AFAIK the dwc2 host mode doesn't support scatter-gather yet. > > > > So this is either dwc2 scatter-gather problem which should be addressed in > > this driver or mt76x0u does something wrong when configuring SG. > > > > Disabling SG is just workaround, which do not address actual problem. > > > > I think I found mt76x0u issue that could cause this USB probe error > > (and possibly also address AMD IOMMU issue). We seems do not correctly > > set URB transfer length smaller than sg buffer length. Attached patch > > should correct that. > > Hi Stanislaw, > > I think 'sg[0].length' is already set in mt76u_fill_rx_sg(). It is, buf->len and sg[0].length are initialized to the same value for 1 segment. But then buf->len (assigned to urb->buffer_transfer_length) change to smaller value , but sg[0].length stay the same. What I think can be problem for usb host driver. > Moreover applying this patch I got the following crash (rpi-5.0.y): Ok, so with patch probe fail instantly and trigger yet another bug(s) on error path. You seems to address that already. > Moreover for mt76x0u SG is 'already' disabled since we use just one > buffer so from performance point of view I do not see any difference > of using a standard usb buffer. > This patch has been tested in multiple scenarios and seems to fix > reported issues (for usb2.0). Ok, so passing buffer via urb->transfer_buffer works. But why urb->sg does not work for 1 segment ? > Are you concerned about increasing code complexity? That's one of my concerns. Another, more important one, is that changing to urb->transfer_buffer just hide the problems. And they will pop up when someone will start to use SG (BTW how this can be tested for more than one fragment, IOW how multiple fragments skb's can be generated ? ). And now I think the bugs can be in mt76 driver taking that problems happened on different platforms (rpi and AMD IOMMU), i.e. we do not correctly set urb->nub_seg or length or do some other thing wrong. Stanislaw