From: Paolo Abeni <pabeni@redhat.com>
To: Jijie Shao <shaojijie@huawei.com>, netdev-bot+sashiko@kernel.org
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
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 15:31:57 +0100 [thread overview]
Message-ID: <3766f988-9ea9-4ead-870f-fab0549e15b6@redhat.com> (raw)
In-Reply-To: <a727a596-2718-4aaa-8baf-69b1aee9df43@huawei.com>
On 11/23/26 08:33, Jijie Shao wrote:
> on 2026/11/22 21:24, netdev-bot+sashiko@kernel.org wrote:
>>> @@ -4489,10 +4519,15 @@ int hns3_clean_rx_ring(struct hns3_enet_ring *ring, int budget,
>>> * FBD number with head pointer
>>> */
>>> if (unused_count > 0)
>>> - failure = failure ||
>>> - hns3_nic_alloc_rx_buffers(ring, unused_count);
>>> + failure |= hns3_nic_alloc_rx_buffers(ring, unused_count);
>>> +
>>> + if (unlikely(failure))
>>> + hns3_ring_set_oom_state(ring);
>> [Severity: Medium]
>> Can rx_oom_cnt be incremented twice in a single NAPI poll here?
>>
>> The commit message says the counter is "incremented for each NAPI poll
>> that hits an RX allocation failure". When the fraglist napi_alloc_skb()
>> fails in hns3_add_frag(), the path looks like this:
>>
>> hns3_clean_rx_ring()
>> hns3_handle_rx_bd()
>> hns3_add_frag()
>> hns3_ring_set_oom_state(ring); /* rx_oom_cnt++ */
>> return -ENXIO;
>> goto out;
>> failure |= hns3_nic_alloc_rx_buffers(ring, unused_count);
>> if (unlikely(failure))
>> hns3_ring_set_oom_state(ring); /* rx_oom_cnt++ again */
>>
>> -ENXIO doesn't match the new err == -ENOMEM check. But failure can still
>> be true, either from a failed exit refill or from an earlier failed
>> in-loop refill. Under the memory pressure that caused the fraglist
>> failure, the refill is likely to fail too.
>>
>> hns3_ring_set_oom_state() has no per-poll dedup, so in this case the
>> counter goes up by two for one poll.
>
> The second increment only happens when a second allocation actually
> failed. hns3_add_frag() counts its failed napi_alloc_skb() and returns
> -ENXIO, which doesn't set `failure`, so the exit refill still runs and
> bumps the counter again only if it fails too. Two increments mean two
> failures. I agree "for each NAPI poll" can read as at most once per
> poll, that's just imprecise wording.
I agree another repost is not needed here. However patch 1, 2 and 4
are net-next material and only patch 3 is borderline net material.
To avoid a repost and splitting, I would apply everything to net-next.
/P
next prev parent reply other threads:[~2026-11-25 14:32 UTC|newest]
Thread overview: 14+ 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 [this message]
2026-11-25 10:38 ` Simon Horman
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
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=3766f988-9ea9-4ead-870f-fab0549e15b6@redhat.com \
--to=pabeni@redhat.com \
--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-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ningwei15@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®