All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: <netdev-bot+sashiko@kernel.org>
Cc: <conor.dooley@microchip.com>, <andrew+netdev@lunn.ch>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<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 17:11:43 +0200	[thread overview]
Message-ID: <DLNN5W7M505X.TWFOK1HD0CQL@bootlin.com> (raw)
In-Reply-To: <179010942002.2160803.8691011751847108495@kernel.org>

Hello netdev-bot+sashiko,

On Tue Sep 22, 2026 at 10:37 PM CEST,  wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
>
> Critical: 0 · High: 2 · Medium: 0 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [High] gem_init_rx_ring()
>   (drivers/net/ethernet/cadence/macb_main.c:2793) now sets…
> - [High] gem_init_rx_ring() now publishes MACB_BIT(RX_USED) on every RX
>   descriptor of a queue, resets queue->rx_tail/rx_prepared_head and then…
>
> --
>
> net: macb: never give hardware a NULL RX buffer
>
> This makes gem_init_rx_ring() set the RX_USED bit on every RX descriptor
> before calling gem_rx_refill(), so that a refill that fails part way
> through does not leave descriptors owned by hardware while their skb
> pointers are still NULL.  The change affects macb_open(), macb_resume(),
> the HRESP error recovery path and set_ringparam().
>
>> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
>> index b8234ac4b602..751fa9e68099 100644
>> --- a/drivers/net/ethernet/cadence/macb_main.c
>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>> @@ -2785,9 +2785,14 @@ static int macb_alloc(struct macb *bp)
>>  
>>  static void gem_init_rx_ring(struct macb_queue *queue)
>>  {
>> +	unsigned int i;
>> +
>>  	queue->rx_tail = 0;
>>  	queue->rx_prepared_head = 0;
>>  
>> +	for (i = 0; i < queue->bp->rx_ring_size; i++)
>> +		macb_rx_desc(queue, i)->addr |= MACB_BIT(RX_USED);
>> +
>
> [Severity: High]
>
> Does RX_USED now carry two different meanings that the RX consume path
> cannot tell apart?
>
> gem_rx() uses RX_USED at queue->rx_tail as the only indication that
> hardware delivered a frame, and it has no bound against
> queue->rx_prepared_head:

Yes that is correct! We can fix that using our cursors
rx_tail/rx_prepared_head that tell us which descriptors were
reallocated properly.

IE in gem_rx() we stop once `queue->rx_tail == queue->rx_prepared_head`.

[...]

> [Severity: High]
>
> Is any exclusion against a running RX poll needed here now that the whole
> ring is published as RX_USED?
>
> macb_hresp_error_task() runs from system_bh_wq, masks queue interrupts,
> clears RE/TE, and then calls mog_init_rings() with no napi_disable(), no
> napi_synchronize() and no lock:

This is a known race, but we won't fix it in this series. And in
particular it is completely unrelated to this first patch.

It is semi-related to the last patch that puts in place the mechanisms
that could be reused to fix macb_hresp_error_task(). But again, not
here, not today.

[...]

Thanks,

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


  parent reply	other threads:[~2026-09-24 15:11 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
2026-09-24 15:11     ` Théo Lebrun [this message]
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=DLNN5W7M505X.TWFOK1HD0CQL@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.