Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4831525ybl; Wed, 22 Jan 2020 05:33:17 -0800 (PST) X-Google-Smtp-Source: APXvYqwwMPWkd+FqPjho3sT7169w12mwtHG7BxCrozUFL+ERqeSsIL/6nGkoC9MZizGTr1MEVqAL X-Received: by 2002:aca:4ad5:: with SMTP id x204mr6559783oia.162.1579699996960; Wed, 22 Jan 2020 05:33:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699996; cv=none; d=google.com; s=arc-20160816; b=nZf11ZhPA5fWOduf9GhG0wftoKZSEqQycu17GMD+E5fxNSUmbTxjfQBkQhLAVibArK FegzkG4ssRX2gPyy3BvN8KKy5ZG9XCTJLyZt7ZxgWzFYqfV58uVoQSkec1iSi5W2dewX 0rgDnN7fNNmXF8G1BzkJpfXfNYDN/bO7RF0bUcd7aX9zTC0Ame8M7LS0z0NuKjtoo+Nd GH9gZ8q1ntgAndHKch6oIUW43aNCqkvT3tx5ABt2lO0nK9IRQ/G5ZKN+/Fs1liVNkQO6 NZ6aD+ZkXnSDB5NlzDKM2jH8+jB8bl5splthAf35LwcWubnY8Y0cOnSWJEYEx4mcBh9J 4bdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZQBJ3dQZpjW+fNtZ7JVX415l0P7x3CAjx/aX/D/U1Kc=; b=Hyg7gEsRLBz/q2KNtiDYJ1ErykuWDr2zG1NKuBNcGVVV1VVQ6tgxKBrq882tYUbMpR 75SSdfTzQytCHR0XX5Flso3/oww4ADxomEI9BLORVEkXQVy69vuKmMXFArTJFgni7L88 ailUQB/YXSU1VsGO0wb7fR0g9cI1MySPJCii+D8Y0cgzaa5FfMYmLjiF757+niEpLpun 7ZXEQtpR1FB/H30TtISr9VLHcw1Fh1+1gmMKiXiRkN9ZMwa77VtjCjiT0d6cXJt44rAr FocIWT57c7yadyOtkjG+slO1SkyEEIdmEbm7SSuhYoylGXD5/Gz8inR1mxmV/Wg5IFvr 1GEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="RJ/KP5AY"; 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 l26si22443912oti.152.2020.01.22.05.33.03; Wed, 22 Jan 2020 05:33: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=pass header.i=@kernel.org header.s=default header.b="RJ/KP5AY"; 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 S1730613AbgAVNXz (ORCPT + 99 others); Wed, 22 Jan 2020 08:23:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:42334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730009AbgAVNXv (ORCPT ); Wed, 22 Jan 2020 08:23:51 -0500 Received: from localhost (unknown [84.241.205.26]) (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 056F72467B; Wed, 22 Jan 2020 13:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699430; bh=htLogQ1exQb6Tbgh6oLLzXYdn/pzCzc2t9ke4pJ0jzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJ/KP5AYCVfPCTyHmznibJOcveCSzO2OXntBeQ3ihkGsgUZ13ORnpDPXPx01uBKgc BwJCVOr7ujdnW4ziZcQrHgaO+34/s2YgF1p3HVYQZ64vk+1Eg+SUZgxgqbmIPDB2cY x1CFhtDKJdjeCQ7XlGMw8SCoAQF0N41h5FF4hGSg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yonglong Liu , "David S. Miller" Subject: [PATCH 5.4 141/222] net: hns: fix soft lockup when there is not enough memory Date: Wed, 22 Jan 2020 10:28:47 +0100 Message-Id: <20200122092843.829070021@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@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: Yonglong Liu [ Upstream commit 49edd6a2c456150870ddcef5b7ed11b21d849e13 ] When there is not enough memory and napi_alloc_skb() return NULL, the HNS driver will print error message, and than try again, if the memory is not enough for a while, huge error message and the retry operation will cause soft lockup. When napi_alloc_skb() return NULL because of no memory, we can get a warn_alloc() call trace, so this patch deletes the error message. We already use polling mode to handle irq, but the retry operation will render the polling weight inactive, this patch just return budget when the rx is not completed to avoid dead loop. Fixes: 36eedfde1a36 ("net: hns: Optimize hns_nic_common_poll for better performance") Fixes: b5996f11ea54 ("net: add Hisilicon Network Subsystem basic ethernet support") Signed-off-by: Yonglong Liu Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -565,7 +565,6 @@ static int hns_nic_poll_rx_skb(struct hn skb = *out_skb = napi_alloc_skb(&ring_data->napi, HNS_RX_HEAD_SIZE); if (unlikely(!skb)) { - netdev_err(ndev, "alloc rx skb fail\n"); ring->stats.sw_err_cnt++; return -ENOMEM; } @@ -1056,7 +1055,6 @@ static int hns_nic_common_poll(struct na container_of(napi, struct hns_nic_ring_data, napi); struct hnae_ring *ring = ring_data->ring; -try_again: clean_complete += ring_data->poll_one( ring_data, budget - clean_complete, ring_data->ex_process); @@ -1066,7 +1064,7 @@ try_again: napi_complete(napi); ring->q->handle->dev->ops->toggle_ring_irq(ring, 0); } else { - goto try_again; + return budget; } }