Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp900227ybl; Thu, 23 Jan 2020 09:47:16 -0800 (PST) X-Google-Smtp-Source: APXvYqwpX4f5M3R7FGpB3zOyM8mElFGQcry4v4HXNj6KJRy7Up6AS5xftvCXttJIeDi0EmXQPMsL X-Received: by 2002:a05:6830:2053:: with SMTP id f19mr11931432otp.193.1579801636196; Thu, 23 Jan 2020 09:47:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579801636; cv=none; d=google.com; s=arc-20160816; b=teC6nJB829oFFWIbplb6j3Bu4y5RJH/zlss4egn+xjWzcrRGvbwjFDl9L1RmlkI9Q4 3BZiO8b7roARzcKQV6YCcOKy6i4f2oc29bJ+6oOQev10kMBxxBVbzTW/9bF/s5G20zVT LcnAjlAN53wJ/TfuZInLiyMJ26J9vD09CLPzjXXvyuPU4fLp3dvbmiv8uhWoFFQR9xeA ByhwmqU6fZF5yhYsHzwvAaI2vh/MQ8EeGFRCwN69xjMJ/X72xln9ck1AXP+K6/XUV7/s at057XUcXA9LJgwc8Le9NXAqWir87Kbrd2mdKgLNVDy6g5/w9LNnFUvB3YuXTcVvQouD jAlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=9SUGR8QdPMNh7QLWat7AGgDe3jaF2rbpW1KxZ9s3AOs=; b=zl5wjEwLkYsRlpSTtuu9ymYaq6yDDXxs6XZUBgdT8BifOAY0rQcpHu/vjW83bqx/zN SrEWU9isFbMnGS71aGlw5+maqfDdJRChzS4WIiwwg3UW6f7hGC7ru0U+dA8+JUbo076r IhzA6jaiUjunB0BN6DRamWYSP19K5l/0ivLNIrcMA9F7W055ydyoLWfcJpArVHF0bGpW acOKR3zd7BoG2zk5UFaOGZ6xIxrKK+XvaAjuE9HpYGb6dZ8Na8YbAMCi+YjdAFZkZaa8 Kbdy6ApcoNrwgsr6PxPBoD2Gm4Psq36JMiQxkH1mfuA7y3+TX321Rl2tMbheBMp0HH0C 9HJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=sbFxacSf; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si1122247oih.206.2020.01.23.09.47.03; Thu, 23 Jan 2020 09:47:16 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=sbFxacSf; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728925AbgAWRqG (ORCPT + 99 others); Thu, 23 Jan 2020 12:46:06 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:41733 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727022AbgAWRqG (ORCPT ); Thu, 23 Jan 2020 12:46:06 -0500 Received: by mail-lf1-f67.google.com with SMTP id m30so2958559lfp.8; Thu, 23 Jan 2020 09:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=9SUGR8QdPMNh7QLWat7AGgDe3jaF2rbpW1KxZ9s3AOs=; b=sbFxacSfBCAGBU7s2TQJY0DzNNQymStUoOtlfwJBSEBZcT6Z/Mj9byWnE1Za5HXWkB HHwxRj5HnyQLx0JTKC4L1ghcKf8AgKcqkc0Mu1b3SgdH3LMU04PsjcLonuH3Zfl5M3G9 6NQIneG0d0c6MgKlDpopQtJsg1qegmt59z8gBdm9BZpq1CaZNJoXQwCBrmGd8Fe15rxu D2YrNynapEEOiHCGsaeWp/u0+6G+N/JmhB9+x1g0kzrNyYxKT11DedfTf4m+q4oSgv+t KPkmLkX+JhNE+2xMdYCHXC+g2G5NN+FZJTf5cmsBCMXqE2RXSYPnWNeh5xQf+pmZJ5zT 6s6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :date:message-id:mime-version; bh=9SUGR8QdPMNh7QLWat7AGgDe3jaF2rbpW1KxZ9s3AOs=; b=acUccFWUpfaY+2pX5apMWCetRGDrBrGKyZd440RRxbLbGGAC+qh1T12R2T678qHkPH vsyx7n/CMw7C/lyGpDzUFeXKDkiEm+ZHGKnt2isGLbDhjcmXTolQyss3BNqWSkp/lu56 EhoT3fDZia8+Nap48+AFGlV8vDPG+81hkVP23myBnHGBv9KL/HQsds9loBMp9TEEANPz kIy2WerDSgDgwEDZs7wPflxZhIONlNr0YultupEGBKfg0e6WWnKmO/BSpa/J4jgDPcpx /vODQO1IFdtaSOrUj6enwE/blg2SMnWBSpUiaFXKsG+dXuAdYw26dUqhjnAJTMk7skrL vO+g== X-Gm-Message-State: APjAAAXpqRJpW6mw3xr2kzQHTwYx1xPcjQh5ALL42Lqv1X7nMTV2OWGG UhBTHYZXaiDTOqYWqAobmRls03iykySScw== X-Received: by 2002:ac2:4a91:: with SMTP id l17mr5353742lfp.75.1579801563345; Thu, 23 Jan 2020 09:46:03 -0800 (PST) Received: from saruman (88-113-215-33.elisa-laajakaista.fi. [88.113.215.33]) by smtp.gmail.com with ESMTPSA id r2sm1668668lff.63.2020.01.23.09.46.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Jan 2020 09:46:02 -0800 (PST) From: Felipe Balbi To: "Yang\, Fei" , Andrzej Pietrasiewicz , John Stultz , lkml Cc: Felipe Balbi , Thinh Nguyen , Tejas Joglekar , Jack Pham , Todd Kjos , Greg KH , Linux USB List , stable Subject: RE: [RFC][PATCH 0/2] Avoiding DWC3 transfer stalls/hangs when using adb over f_fs In-Reply-To: <02E7334B1630744CBDC55DA8586225837F9EE335@ORSMSX102.amr.corp.intel.com> References: <20200122222645.38805-1-john.stultz@linaro.org> <02E7334B1630744CBDC55DA8586225837F9EE280@ORSMSX102.amr.corp.intel.com> <87o8uu3wqd.fsf@kernel.org> <02E7334B1630744CBDC55DA8586225837F9EE335@ORSMSX102.amr.corp.intel.com> Date: Thu, 23 Jan 2020 19:46:51 +0200 Message-ID: <87lfpy3w1g.fsf@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, "Yang, Fei" writes: >>>>> Hey all, >>>>> I wanted to send these out for comment and thoughts. >>>>>=20 >>>>> Since ~4.20, when the functionfs gadget enabled scatter-gather=20 >>>>> support, we have seen problems with adb connections stalling and=20 >>>>> stopping to function on hardware with dwc3 usb controllers. >>>>> Specifically, HiKey960, Dragonboard 845c, and Pixel3 devices. >>>> >>>> Any chance this: >>>>=20 >>>> https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git/commit/ >>>> ?h=3Dtesting/next&id=3Df63333e8e4fd63d8d8ae83b89d2c38cf21d64801 >>> This is a different issue. I have tried initializing num_sgs when debug= ging this adb stall problem, but it didn't help. >> >> So multiple folks have run through this problem, but not *one* has trace= points collected from the issue? C'mon guys. Can someone, please, collect t= racepoints so we can figure out what's actually going on? >> >> I'm pretty sure this should be solved at the DMA API level, just want to= confirm. > > I have sent you the tracepoints long time ago. Also my analysis of the > problem (BTW, I don't think the tracepoints helped much). It's > basically a logic problem in function dwc3_gadget_ep_reclaim_trb_sg(). AFAICT, this is caused by DMA API merging pages together when map an sglist for DMA. While doing that, it does *not* move the SG_END flag which sg_is_last() checks. I consider that an overlook on the DMA API, wouldn't you? Why should DMA API users care if pages were merged or not while mapping the sglist? We have for_each_sg() and sg_is_last() for a reason. > I can try dig into my old emails and resend, but that is a bit hard to fi= nd. Don't bother, I'm still not convinced we should fix at the driver level when sg_is_last() should be working here, unless we should iterate over num_sgs instead of num_mapped_sgs, though I don't think that's the case since in that case we would have to chain buffers of size zero. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAl4p3AsACgkQzL64meEa mQaTdA/+PpmXuec0fjzp1yy6MejaVnnPEOFDVaOYvpaYkbH9C/UhwT42e5ZuaVg1 abC2wFsKPer2Xbtb9rmJflvqiD+smblgDpkLyFHEwZRC0a7o+c6CkFYMPNNM9+w/ sNWVwM3sfLGQ9Wcx0hQueLmhksBbvGcAqnph/MwFJcz81k77/BEYFqo/8n7c6o7K YBJrySxFqi6y/jCv0u+FDG449XOdh2Udydp/7UPCXrOZis6D2nxiiU8H7taKGZuO jluTVDFsFQK9CA8GVLMocciLUPSQlSDlac3cUH4lQnVqDGNGfjSN37AkFzeUKSNL HgOJA0E4ewtZFe3EM1JKQU968a3OrPYkdzZi0pvwnDxfJ8pyo1/jqQInz518etwq SHqM2r/Pwwtem+wwbi6Z+WKmfwHI445Jht3DoC1dSnREXSG5VzXJzyIWVrAvtexN kWDaqp4tBVQqVbsmOIQVBio46kBe/yNlhFgycnaXGSlz7JLJXvfMqhA4xSAbr6Vt rob9DoX879dS0JS3YN6tOHQeP0eVZjq/xUwTjhVDA1l/XNb7WM4lx//5o8hqn1VW XMP9VBC4W0NZoRmhi4pcp7zXHxTal68rLJkYL78yi8R9N3ERuo3XylA40jAOaR0E najiMxtEwxPalArWq9qbWI/EcMEMMiom03pZnFnHAiTsj7alMhE= =ZK9D -----END PGP SIGNATURE----- --=-=-=--