Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7473150ybl; Wed, 15 Jan 2020 23:46:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzwTLE4kcDpn3c+IkdCPqKPDbUVhyXDde/AwCqhwgM5hqJHe1VSCrPrL7VoKVY2dHmJlPPW X-Received: by 2002:a05:6808:3d9:: with SMTP id o25mr3324237oie.126.1579160786994; Wed, 15 Jan 2020 23:46:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579160786; cv=none; d=google.com; s=arc-20160816; b=nW1Yzzx9856qxAV5akftMcpyQ4bpVZAk10tH+zaa5ZygTV5rjnuqU9GMBZRptUDKfY N7LfbLdwC0HdINZBEPj0AO3eB0xUUo6rUP8GdNwEzFh+ft8E/hzfyyEWY7tUHvzj96Ov NCUSj+PDbWLifdn/V1QHBwbSZhJsgU+/kUJFlGmZ2PrO6vtkMbtZK7Lf8rC89uibYLp2 8CR9z2+7GXpK3i4JpJ0sZsvOo62f/fLTYVnOa0bb/qBLrqvKhHbGUjkm+9ijnDzXpDgk cpryHG2b0yJbHPDTh5ZyycDijtIXvg6R1ka8yFHkg9VbMm2niRq74kfNjBUF9BFitk5S DZAg== 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:subject:cc :to:from; bh=YbrPvdbXaUwboh9xwRFMy2k6BPa3F5VK+gCPSK0gA/g=; b=iNQU/RJrkIEwEX7QBj2VowoIfVWUz6mkq14ptv34mbkvCWISHz3TuUXj1bF7/R5nIB a/cuWjdd+vG97I3MZHAdA5pI2Pj39q0IM1+TOWREelNpmsE2WH4Aed1S/bG7pDrfYlHd KWlW5zBJ4AGfPvUqwpe7UQRqvX2ftKfaII1hIXdtGTglMPAx3E0kJpQ9zs9eljEAMWpW +E2kl0kEP9wy64UIMUBjdxIH4i80C+xiyDjbmkBCeN/CNWJVeVqAcnblmSKy4lGJwuxH 5SIXymxgCpTyy/DOzImlhag7gZ/TpjtPf0Oo8nJ9465LK+ukRfxKd4CKCTYKItU2UII5 5Xbg== 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 b11si11443595oie.152.2020.01.15.23.46.13; Wed, 15 Jan 2020 23:46:26 -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; 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 S1729149AbgAPHpQ (ORCPT + 99 others); Thu, 16 Jan 2020 02:45:16 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8742 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726653AbgAPHpP (ORCPT ); Thu, 16 Jan 2020 02:45:15 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A64F24145302815F6FFA; Thu, 16 Jan 2020 15:45:13 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Thu, 16 Jan 2020 15:45:03 +0800 From: Yonglong Liu To: CC: , , , , Subject: [PATCH net] net: hns: fix soft lockup when there is not enough memory Date: Thu, 16 Jan 2020 15:41:17 +0800 Message-ID: <1579160477-31030-1-git-send-email-liuyonglong@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 14ab204..eb69e5c 100644 --- 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 hns_nic_ring_data *ring_data, 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 napi_struct *napi, int budget) 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 @@ static int hns_nic_common_poll(struct napi_struct *napi, int budget) napi_complete(napi); ring->q->handle->dev->ops->toggle_ring_irq(ring, 0); } else { - goto try_again; + return budget; } } -- 2.8.1