All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Jakub Kicinski" <kuba@kernel.org>
Cc: <netdev-bot+sashiko@kernel.org>, <conor.dooley@microchip.com>,
	<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <pabeni@redhat.com>, <horms@kernel.org>,
	<nicolas.ferre@microchip.com>, <sean.anderson@linux.dev>,
	<atenart@kernel.org>, <linux@armlinux.org.uk>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<nb@tipi-net.de>, <vladimir.kondratiev@mobileye.com>,
	<gregory.clement@bootlin.com>, <tawfik.bayouk@mobileye.com>,
	<thomas.petazzoni@bootlin.com>, <maxime.chevallier@bootlin.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH net 1/3] net: macb: never give hardware a NULL RX buffer
Date: Thu, 24 Sep 2026 18:30:52 +0200	[thread overview]
Message-ID: <DLNOUHOHFIAT.2CM5NXJLGRM4H@bootlin.com> (raw)
In-Reply-To: <20260924084104.25099f60@kernel.org>

On Thu Sep 24, 2026 at 5:41 PM CEST, Jakub Kicinski wrote:
> On Thu, 24 Sep 2026 17:13:58 +0200 Théo Lebrun wrote:
>> > If the AI interprets the rx poll side correctly these seem like a major
>> > flaw in setting the USED bit :(  
>> 
>> Yes the AI is correct (unsurprisingly). But two things:
>
> If it's correct then patch needs to be changed.
> Please don't write puzzles for me to solve.
>
>>  - before this patch what happened was that HW read the NULL descriptor,
>>    so not much better
>>  - we can detect in gem_rx() using our ring buffer cursors that tell us
>>    what we've managed to allocate, that we gem_rx() doesn't iterate
>>    over descriptors that haven't been allocated
>
> Grammatically dubious puzzles at that.

Sorry for the fuzzy message.
Yes, Sashiko is correct and, yes, the patch will change.

To explain more in detail: gem_rx() iterates over descriptors using
RX_USED as signal that a descriptor was filled by the hardware. The
risk is to reach a descriptor where allocation failed (and we used
RX_USED as signal for the hardware to not fill it up). We can avoid
that using our cursors (queue->rx_tail and queue->rx_prepared_head)
that tell us the range of allocated descriptors.

In concrete terms, we stop iterating in gem_rx() if

	queue->rx_tail == queue->rx_prepared_head

or if

	desc->addr & MACB_BIT(RX_USED)

Thanks,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2026-09-24 16:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 20:35 [PATCH net 0/3] net: macb: fix close races (and RX refill error handling) Théo Lebrun
2026-09-18 20:35 ` [PATCH net 1/3] net: macb: never give hardware a NULL RX buffer Théo Lebrun
2026-09-22 20:37   ` netdev-bot+sashiko
2026-09-24  1:47     ` Jakub Kicinski
2026-09-24 15:13       ` Théo Lebrun
2026-09-24 15:41         ` Jakub Kicinski
2026-09-24 16:30           ` Théo Lebrun [this message]
2026-09-24 15:11     ` Théo Lebrun
2026-09-18 20:35 ` [PATCH net 2/3] net: macb: propagate RX ring refill errors Théo Lebrun
2026-09-22 20:37   ` netdev-bot+sashiko
2026-09-24 15:23     ` Théo Lebrun
2026-09-18 20:35 ` [PATCH net 3/3] net: macb: quiesce IRQs and drain BH on interface close Théo Lebrun
2026-09-22 20:37   ` netdev-bot+sashiko
2026-09-24 16:02     ` Théo Lebrun

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=DLNOUHOHFIAT.2CM5NXJLGRM4H@bootlin.com \
    --to=theo.lebrun@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=atenart@kernel.org \
    --cc=conor.dooley@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gregory.clement@bootlin.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=nb@tipi-net.de \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=sean.anderson@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=tawfik.bayouk@mobileye.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.kondratiev@mobileye.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.