🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22461

Re: [PATCH v5 net 3/4] net: hns3: fix interface stuck after OOM with full hardware rx queue

#22461
From: Simon Horman
Date: Wed, 25 Nov 2026 10:38
52 lines
10583 bytes
On Wed, Nov 18, 2026 at 09:03:29PM +0800, Jijie Shao wrote:
> NAPI polling on hns3 is driven by hardware RX interrupts. Under
> memory pressure, RX skb and frag allocations fail, packets are no
> longer reaped from the hardware rx ring. Once the ring fills, the
> hardware stops generating RX interrupts and NAPI is never scheduled
> again -- even after memory becomes available, leaving the interface
> deadlocked.
> 
> Break the deadlock by adding a software recovery path that re-arms
> NAPI via a 250ms delayed_work, independent of hardware interrupts.
> A per-ring bitmap tracks which RX rings are in OOM state; the work
> function schedules NAPI for the vector backing each affected ring.
> OOM state is marked when an RX allocation failure is detected in the
> poll path and cleared when the delayed_work fires.
> 
> This supersedes the busy-poll recovery from commit 68752b24f51a
> ("net: hns3: schedule the polling again when allocation fails"),
> which returned budget on allocation failure to keep NAPI polling
> and caused CPU spinning under prolonged memory pressure. Now
> hns3_clean_rx_ring() returns recv_pkts instead of budget on
> allocation failure, letting NAPI exit and the delayed_work take
> over. The exit refill is still attempted for the descriptors
> accumulated since the last refill, so the head pointer is written as
> before; descriptors from earlier iterations are not re-armed when an
> allocation failure short-circuits the in-loop refill.
> 
> Add a per-ring rx_oom_cnt ethtool counter, incremented for each NAPI
> poll that hits an RX allocation failure. It is a diagnostic counter
> for this recovery path, not the standard rx-alloc-fail qstat.
> 
> The bitmap is allocated in hns3_init_all_ring() and freed in
> hns3_uninit_all_ring(). It is allocated after every ring is set up,
> so a failure inside hns3_init_all_ring() leaves nothing behind, and
> it is reused because hns3_set_ringparam() calls hns3_init_all_ring()
> without hns3_uninit_all_ring(). The delayed_work is cancelled in
> hns3_uninit_all_ring() before the rings and the bitmap are released,
> and also in hns3_nic_uninit_vector_data() before the NAPI instances
> are torn down.
> 
> hns3_nic_net_down() does not cancel the work, so a pending work may
> still run after the interface goes down. If it runs while DOWN is
> set, it clears the per-ring bits without scheduling NAPI. If the
> interface is brought back up within the 250ms window, it sees the
> stale bits with DOWN cleared and schedules NAPI for those rings once,
> ending in a single extra poll round with no packet to clean. Both
> outcomes are harmless.
> 
> Fixes: 68752b24f51a ("net: hns3: schedule the polling again when allocation fails")
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>

Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID: <20261125103849.GQ31322@horms.kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371236-linux-kernel-netdev=dewy.ru
References: <20261118130330.3026625-1-shaojijie@huawei.com> <20261118130330.3026625-4-shaojijie@huawei.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371236-linux-kernel-netdev=dewy.ru
From: horms@kernel.org (Simon Horman)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v5 net 3/4] net: hns3: fix interface stuck after OOM with
 full hardware rx queue
Date: Wed, 25 Nov 2026 10:38:49 +0000
Organization: Usenet Network
Message-ID: <20261125103849.GQ31322@horms.kernel.org>
References: <20261118130330.3026625-1-shaojijie@huawei.com>
 <20261118130330.3026625-4-shaojijie@huawei.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="183725"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ybPXhOn7ezSoYLOIQUuvvxZiSI4= sha256:/5kUa0fcxC7ArgSDXvNcOIeWxmPxc5toMq9NTPKKPZw=
	sha1:h6FUO6ti8f557qKadHuD/ySiUSc= sha256:+5mb4HLRyNxmE1fPtaofcKkRUestbfL4bxxClgwxdQw=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 27207125E55; Wed, 25 Nov 2026 13:39:16 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Tdht83M9XkRe;
	Wed, 25 Nov 2026 13:39:13 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371236-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 0F554125E54; Wed, 25 Nov 2026 13:39:05 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 381353E39E; Wed, 25 Nov 2026 10:39:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795603140;
	b=BHIqZfgST4Rj/rybShffZPyQpGJ4xgOapsFZb16blON8hHBmMBPaE5Vd//pDyKzalkNs
	 NUHVefuu26uQIfUgDMNyED/K9cmtXFciW6D7qCT6tzzCFSrUAi62zmN9KAsU38J90wvDl
	 cAXC2LvHxS771Yu3DRrLlwuSvw+eC6EYIW+lxMlaz4xRULlNIUgeI1HFYVk5+rsaxCRFW
	 jUc/PbcYV+6kNP84RoER//YHFN8W3uiibuRECZXaHanv1MyohOuYpHlkIg1dghy1df1zR
	 PQlau/xqkk8hebebysdaxTLKqG1uR75GWI3WgOOYg939JrY5Z39FvXzutIVicb8Fn8w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795603140;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=9y7XH+PLern6auh6Gbq/rf63+INrrfk86Hf/UHK5e4U=;
	b=XKjzQDSoNGFPTgDSYVrG1u1qEeD1brodg1yeeyxl8Hakds5ksgNWKXzRt2WowBUm4Hyy
	 G7o7qGstQR9WSd27tH7Ulten0wE/5qb5nTEm7x9FpHIglrQdX4JxYLoGh+4rQQIHMC9Kz
	 /L0sFTpODshHqejKyObEmN9qXSbLpydpkG3GtYWwYMpqFNAyy7Zbt5tUATf3Fd63GzuzP
	 DA4YXEWcxgwWIKy7W9XR+jv0Kgx/EwaN54k6ysFKv2PXpw7iubdxqosyMK3R3HL3qROeF
	 PNCuCgO2M8JeKsHTpTJiHWgYe5qWahVkfmj6JvZazPQYImEu0U64JLxRCjAL+Wg34Ww==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lfZDXLZx;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 10A85606A32E;
	Wed, 25 Nov 2026 10:39:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lfZDXLZx
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795603134;
	b=iWqzwHn+e9JG9hPYRVRwTmnrR66qSnccnQ0Ftd8TV5/QwmFtxn0oeb5q8Xbpx83FWenA
	 jJeOHhNtYLr+6MIAZsWqSipwhjn4oP7IcGjKxrOI/rpFQQkTVoKcvLNaqDcQHBIF/W5LY
	 hkWdS4NRcvDhxRSHymxNYAXttzkYs1Un3sTOCKopcLPBhbswGP/L9uzbS32wi93LxhaH3
	 3Xt5vzStBYjAcPeWOaZJmCaQmZvhc2skW9gIbhzHSs3W/E8gAHiYTdpCj7gNPufVxI+X4
	 RK1I8X8zKa7WvNXt21cPIkEcI03bzUzjBuGiDzSHDq9ZinBQhOb76VVaFzDXfYTP1xg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795603134;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=9y7XH+PLern6auh6Gbq/rf63+INrrfk86Hf/UHK5e4U=;
	b=vzAsqwRu3zEF0Op8wZMH/T2FKQW7EIhWqskERPga7xVHFH0ZN0WSaR5zzvq1W33Y2vnn
	 SoaCdilfee0wSLchH642E6lKmYDELDvN4GcdIRm1rMwmPSBqtskH+ptfrw0V9es+tad7j
	 rXUKxptOLmkpcth4duJz2h/I3MQrOZ5k71GG2qYRqH/lpMhMfQI1kDobSncBmePesGobl
	 ArLSq6cYmu/sNv0JsCQ0FtCAiyKPGtLR/OtUX+sIHkOwMPVeJwhZboA4Wiczbc8CHGbrY
	 JbM+6HSvMyrgRLze3lf6A38lS0c/c9gttFOgBeVh6YiwPjiGf9RQaPmSb4/+4kKpKoA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lfZDXLZx;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3081F606A323;
	Wed, 25 Nov 2026 10:38:54 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35A281F000D1;
	Wed, 25 Nov 2026 10:38:51 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795603133;
	bh=9y7XH+PLern6auh6Gbq/rf63+INrrfk86Hf/UHK5e4U=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=lfZDXLZx/EchyFSyjJiLa54bfLNyLXwJ+6PHF0mZ0g3aOTh65AJ8bmVwThTr6s005
	 w2iV8ERkYVL0OcXStlrpSUNotdo4HWZ4RVu1WGV1Ebsv3sLZBfZOey5MQySFoNiLqP
	 ziTLy8G2u7+z8ptMXG+JRNGCgXCRjVMU4sCoVJfKu3Ay5xniYFgyEF0JGtTGiXtIJe
	 c9YG7Ax1/eE6abmaRLr+uMBO8hxuvdaI7W5OYl+CuMqBKjv1k7dYhaIdac6vfa4oWf
	 YAOuZGy7nkZxf38rz69VAmxFVL6UGhRqY2IX6UrEqjhop9JSjWGpmlxwAD5HGlcAxK
	 tBtcICA4sGIqA==
X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, andrew+netdev@lunn.ch, shenjian15@huawei.com,
	liuyonglong@huawei.com, chenhao418@huawei.com,
	yangshuaisong@h-partners.com, ningwei15@huawei.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261118130330.3026625-4-shaojijie@huawei.com>