Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1547095ybj; Fri, 20 Sep 2019 12:14:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOCrFrwRkHaFByU1wdkBp0doIhvt5fe2dF+6nL0TX9sb1LrxwcEOSobCiWcFHJSbKPjgEy X-Received: by 2002:a17:906:8246:: with SMTP id f6mr8787319ejx.179.1569006890657; Fri, 20 Sep 2019 12:14:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569006890; cv=none; d=google.com; s=arc-20160816; b=MG9jemPxQcojnVVsOturVyGBEhbBwkZghMfhGBT3NH8yS/S3KYqoA68L/XD3bfju3L xOk0TKsgJjXQJeHX77Qsw6RyA14qqyfjyA/Ckg4AGLttChAbC6D/TzA8hLSC/C2BdPdC q/QLfeomyNR71CrVzj6oPbzn+IEGUN63ggZ1vgC7PfMDpHwO5XQ4ROMKVSEex9l6F0MC 9v1MMo1L5prI/uBnByLt/cI4ZCcQLOw5aafsnj6MOPrLKoeQYzG/UiFOkOI00Xq1XNW6 nhjDgoS1IexUUXsOnDmbcOP834ZBdRgmf8+BD/CUQOs2htCTjRSjz3ngafo9AZ0aRl6y 6iEA== 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=hSjWCKvMuZvPz27J02nblVmTuP37YVI+TznJxz9A7sk=; b=zZz/SUTq/1UYZ9hHVYWYlGchf9m+Uw3t1mTgMd6u7fXpoWv1hw8j0eebRU7mBiAz9O pgpUGakRPeGLjAI28KJarZtGcfJ5dVCvT7CeiN4qHDOd3xdUF/shAvMwp3FCfDpmH4ud rMbXFEQwduNfgkOAO4wzLIz2IDSNWTrtFupwYkCJmTc51pz2gGQQRxp39bvSPSq+gud2 GB3YlUBju51LeoeoavGzbptdvkf77SghwOiDY6gU8DzqW1Pze8IZw/sgrSd+k1iwq3Nt KN8yJr2DhUh8cx6DmQAR9hxURQ2viHXBr67eALNHYX+DbbKLGCG6cPfDFiAf3E7TCxT0 Uyww== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f19si2031889edb.385.2019.09.20.12.14.27; Fri, 20 Sep 2019 12:14:50 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393433AbfITLUy (ORCPT + 99 others); Fri, 20 Sep 2019 07:20:54 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:57778 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392160AbfITLUx (ORCPT ); Fri, 20 Sep 2019 07:20:53 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 0657D80E74; Fri, 20 Sep 2019 13:20:36 +0200 (CEST) Date: Fri, 20 Sep 2019 13:20:51 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Igor Russkikh , Dmitry Bogdanov , "David S. Miller" , Sasha Levin Subject: Re: [PATCH 4.19 65/79] net: aquantia: fix out of memory condition on rx side Message-ID: <20190920112051.GA7865@amd> References: <20190919214807.612593061@linuxfoundation.org> <20190919214813.375849733@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k+w/mQv8wyuph6w0" Content-Disposition: inline In-Reply-To: <20190919214813.375849733@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > [ Upstream commit be6cef69ba570ebb327eba1ef6438f7af49aaf86 ] >=20 > On embedded environments with hard memory limits it is a normal although > rare case when skb can't be allocated on rx part under high traffic. >=20 > In such OOM cases napi_complete_done() was not called. > So the napi object became in an invalid state like it is "scheduled". > Kernel do not re-schedules the poll of that napi object. >=20 > Consequently, kernel can not remove that object the system hangs on > `ifconfig down` waiting for a poll. >=20 > We are fixing this by gracefully closing napi poll routine with correct > invocation of napi_complete_done. >=20 > This was reproduced with artificially failing the allocation of skb to > simulate an "out of memory" error case and check that traffic does > not get stuck. > --- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c > +++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c > @@ -89,6 +89,7 @@ static int aq_vec_poll(struct napi_struct *napi, int bu= dget) > } > } > =20 > +err_exit: > if (!was_tx_cleaned) > work_done =3D budget; > =20 This results in some... really "interesting" code that could use some refactoring. First, "goto err_exit" is now same as break. Second, if (!self) now sets variable that is never used. "if (!self) return 0;" would be more readable and would allow for less confusing indentation. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --k+w/mQv8wyuph6w0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl2EthMACgkQMOfwapXb+vJiLgCgvR/dsXLl7RIL25aTTMbMnIcm mesAnRrHpjtVksxLg5V+89Mhlzx77MkC =wJAn -----END PGP SIGNATURE----- --k+w/mQv8wyuph6w0--