All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Jijie Shao <shaojijie@huawei.com>
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
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	[thread overview]
Message-ID: <20261125103849.GQ31322@horms.kernel.org> (raw)
In-Reply-To: <20261118130330.3026625-4-shaojijie@huawei.com>

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>


  parent reply	other threads:[~2026-11-25 10:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 13:03 [PATCH net v5 0/4] net: hns3: fix multiple bugs in reset/error paths Jijie Shao
2026-11-18 13:03 ` [PATCH v5 net 1/4] net: hns3: fix vector resource leak in hns3_nic_alloc_vector_data Jijie Shao
2026-11-25 10:38   ` Simon Horman
2026-11-18 13:03 ` [PATCH v5 net 2/4] net: hns3: fix page_pool leak in hns3_alloc_ring_memory error path Jijie Shao
2026-11-25 10:38   ` Simon Horman
2026-11-18 13:03 ` [PATCH v5 net 3/4] net: hns3: fix interface stuck after OOM with full hardware rx queue Jijie Shao
2026-11-22 13:24   ` netdev-bot+sashiko
2026-11-23  7:33     ` Jijie Shao
2026-11-25 14:31       ` Paolo Abeni
2026-11-26  3:58         ` Jijie Shao
2026-11-25 10:38   ` Simon Horman [this message]
2026-11-18 13:03 ` [PATCH v5 net 4/4] net: hns3: fix use-after-free in debugfs read during reset/unload Jijie Shao
2026-11-22 13:24   ` netdev-bot+sashiko
2026-11-23  7:43     ` Jijie Shao
2026-11-25 10:39   ` Simon Horman
2026-11-26  9:10 ` [PATCH net v5 0/4] net: hns3: fix multiple bugs in reset/error paths patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125103849.GQ31322@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=chenhao418@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=ningwei15@huawei.com \
    --cc=pabeni@redhat.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=yangshuaisong@h-partners.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.