From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Eddie Phillips <eddiephillips@google.com>
Cc: Harshitha Ramamurthy <hramamurthy@google.com>,
<joshwash@google.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <willemb@google.com>,
<jordanrhee@google.com>, <netdev@vger.kernel.org>,
<nktgrg@google.com>, <maolson@google.com>, <thostet@google.com>,
<csully@google.com>, <bcf@google.com>,
<maciej.fijalkowski@intel.com>, <linux-kernel@vger.kernel.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH net v2] gve: fix Rx queue stall on alloc failure
Date: Sat, 11 Jul 2026 06:11:28 +0200 [thread overview]
Message-ID: <26632d35-15bd-4ac6-ae47-b39278fb47ef@intel.com> (raw)
In-Reply-To: <CAPBb8HkwGTC_A1RVVHUVmtbhUxfUXn5VNYxdD-RTsSkN=dHi6g@mail.gmail.com>
On 7/10/26 19:23, Eddie Phillips wrote:
> On Fri, Jul 10, 2026 at 7:24 AM Przemek Kitszel
> <przemyslaw.kitszel@intel.com> wrote:
>>
>>
>>> @@ -400,6 +414,26 @@ void gve_rx_post_buffers_dqo(struct gve_rx_ring *rx)
>>> }
>>>
>>> rx->fill_cnt += num_posted;
>>> +
>>> + /* If the queue has fewer than GVE_RX_BUF_THRESH_DQO descriptors
>>> + * visible to the hardware, the hardware is in danger of starving
>>> + * and cannot trigger interrupts.
>>> + *
>>> + * We use a threshold of 32 because a single maximum-sized RSC
>>> + * packet can consume up to 19 descriptors in the Rx path. Lower
>>> + * thresholds (e.g., 8 or 16) would be unsafe as they could cause
>>> + * the device to drop/stall on a maximum-sized RSC packet.
>>> + *
>>> + * Start the timer to periodically reschedule NAPI and recover.
>>> + */
>>> + num_bufs_avail_to_hw =
>>> + ((bufq->tail & ~(GVE_RX_BUF_THRESH_DQO - 1)) -
>>> + bufq->head) & bufq->mask;
>>> +
>>> + if (num_bufs_avail_to_hw < GVE_RX_BUF_THRESH_DQO) {
>>
>> nice bit-arith tricks, but perhaps a simpler condiion like:
>> if (num_avail_slots + num_posted < GVE_RX_BUF_THRESH_DQO)
>> would be sufficient?
>>
>
> Descriptors are only committed to the hardware in batches matching the
> doorbell notification stride. Masking is necessary because `num_avail_slots
> + num_posted` falsely includes buffers that are written to the ring but not yet
> doorbelled. We don't want the driver to overestimate the hardware's active
> buffer count, fail to arm the watchdog timer, and trigger a silent rx deadlock
> under memory pressure.
OK, makes sense, thank you for explanation.
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>
>>> + mod_timer(&rx->starvation_timer,
>>> + jiffies + msecs_to_jiffies(GVE_RX_NAPI_RESCHED_MS));
>>> + }
>>> }
prev parent reply other threads:[~2026-07-11 4:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 21:19 [PATCH net v2] gve: fix Rx queue stall on alloc failure Harshitha Ramamurthy
2026-07-10 10:13 ` Maciej Fijalkowski
2026-07-10 14:24 ` Przemek Kitszel
2026-07-10 17:23 ` Eddie Phillips
2026-07-11 4:11 ` Przemek Kitszel [this message]
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=26632d35-15bd-4ac6-ae47-b39278fb47ef@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=bcf@google.com \
--cc=csully@google.com \
--cc=davem@davemloft.net \
--cc=eddiephillips@google.com \
--cc=edumazet@google.com \
--cc=hramamurthy@google.com \
--cc=jordanrhee@google.com \
--cc=joshwash@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=maolson@google.com \
--cc=netdev@vger.kernel.org \
--cc=nktgrg@google.com \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=thostet@google.com \
--cc=willemb@google.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