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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 09475C3A5A6 for ; Thu, 19 Sep 2019 22:11:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D09BE21907 for ; Thu, 19 Sep 2019 22:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931088; bh=HaJIQUt1q4yjUOn3fBZcxEDzdsuOckbpaxjgOjv2+7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=g7MYNmHgMrcDB4AaZIuoAokYi20hxBU0WLI866rvuEsflrHVngnrwgiFEWvn7rFCY Y2Xi/djYBFMn6002Z1Cll4J1RIHOORcuvkhtRZ3DCZYUtShKcNT0plPBOas9RQLgOH h8PCjVcHC7WQ0Z3YRvoQCnXDVwKjIt9X+EcB2kLw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405854AbfISWL1 (ORCPT ); Thu, 19 Sep 2019 18:11:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:50094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393587AbfISWLZ (ORCPT ); Thu, 19 Sep 2019 18:11:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6D5BA21907; Thu, 19 Sep 2019 22:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931084; bh=HaJIQUt1q4yjUOn3fBZcxEDzdsuOckbpaxjgOjv2+7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQTUqJb1ys9BOABweHm2WY89EHZpVgZfnQkgU2kyf2mN3Z9hp13zloI42CZQ/zhwa kZT9ICgT9FQeEE3k0pd4NTlInonOQatwXjkVYdN5FCdK7jmkHakznS2li+5B/LKO0Z a67O85HOy/wieQCKkKZRJ5Jre6ffOvw64wIia1wc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Igor Russkikh , Dmitry Bogdanov , "David S. Miller" , Sasha Levin Subject: [PATCH 5.2 105/124] net: aquantia: fix out of memory condition on rx side Date: Fri, 20 Sep 2019 00:03:13 +0200 Message-Id: <20190919214823.020732439@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214819.198419517@linuxfoundation.org> References: <20190919214819.198419517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Bogdanov [ Upstream commit be6cef69ba570ebb327eba1ef6438f7af49aaf86 ] 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. 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. Consequently, kernel can not remove that object the system hangs on `ifconfig down` waiting for a poll. We are fixing this by gracefully closing napi poll routine with correct invocation of napi_complete_done. 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. Fixes: 970a2e9864b0 ("net: ethernet: aquantia: Vector operations") Signed-off-by: Igor Russkikh Signed-off-by: Dmitry Bogdanov Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c index 715685aa48c39..28892b8acd0e1 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c @@ -86,6 +86,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget) } } +err_exit: if (!was_tx_cleaned) work_done = budget; @@ -95,7 +96,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget) 1U << self->aq_ring_param.vec_idx); } } -err_exit: + return work_done; } -- 2.20.1