mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: netdev-bot+sashiko@kernel.org
Cc: andrew+netdev@lunn.ch, kuba@kernel.org, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
	mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
	linux@armlinux.org.uk, lorenzo.bianconi@oss.qualcomm.com,
	nb@tipi-net.de, magnusleatti@kernelriot.com,
	thomas.petazzoni@bootlin.com, alexis.lothore@bootlin.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net v3] net: stmmac: Clear DMA errors for multi-channel interrupts
Date: Tue, 17 Nov 2026 09:48:41 +0100	[thread overview]
Message-ID: <9a17822b-3e7b-4338-8663-7007d27daac6@bootlin.com> (raw)
In-Reply-To: <179482516756.3136.16592047633231652675@kernel.org>

Hi,

On 11/16/26 11:32, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
> 
> Critical: 0 · High: 0 (1) · Medium: 1 (1) · Low: 1 (1)
> 
> 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).
> 
> - [Medium] In multi-MSI (INTM=1) mode the patch makes the MAC vector
>   responsible for fatal bus errors.
> - [Low] stmmac_dma_err_interrupt(), called from the MAC hardirq for every
>   channel, adds another unserialized writer of the plain `unsigned long`…
> 
> Pre-existing issues:
> - [High] This problem wasn't introduced by this patch, but the patch adds
>   a new hardirq source that arms it.
> - [Medium] This problem wasn't introduced by this patch, but it concerns
>   how dwmac4_dma_interrupt() acknowledges status.
> - [Low] This problem wasn't introduced by this patch, but Loongson is not
>   covered by it.
> 
> --
> 
> net: stmmac: Clear DMA errors for multi-channel interrupts
> 
> This adds a DMA_DIR_ERR direction and a DMA_CHAN_STATUS_MSK_ERR mask for
> dwmac4. On GMAC4 cores, the multi-MSI MAC interrupt handler now calls a new
> stmmac_dma_err_interrupt(). That helper acks AIS/FBE/RPS/RBU on every
> channel and calls stmmac_global_err() on fatal bus errors. The goal is to
> stop the RBU/RPS interrupt storms seen on dwmac-motorcomm.
> 
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
>> index 43b036d4e95bd..a7caac3c98e6c 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
>> @@ -173,6 +173,11 @@ static inline u32 dma_chanx_base_addr(const struct dwmac4_addrs *addrs,
>>  					 DMA_CHAN_STATUS_TI | \
>>  					 DMA_CHAN_STATUS_MSK_COMMON)
>>  
>> +#define DMA_CHAN_STATUS_MSK_ERR		(DMA_CHAN_STATUS_AIS | \
> 
> [Severity: Medium]
> 
> This is a pre-existing issue, but does putting DMA_CHAN_STATUS_AIS in this
> mask actually clear AIS on 4.00 cores?

Pre-existing, this should be addressed separately
[...]

> 
> [Severity: Low]
> 
> Can one hardware event now be counted twice in the abnormal counters?
> 
> stmmac_dma_err_interrupt() runs this path from the MAC hardirq for every
> channel. The per-channel RX/TX MSI handlers process the same bits:
> DMA_CHAN_STATUS_MSK_RX contains RBU, RPS, AIS and FBE, and
> DMA_CHAN_STATUS_MSK_TX contains AIS and FBE.
> 
> The counters are plain unsigned long increments:
> 
> 		if (unlikely(intr_status & DMA_CHAN_STATUS_RBU))
> 			x->rx_buf_unav_irq++;
> 		if (unlikely(intr_status & DMA_CHAN_STATUS_RPS))
> 			x->rx_process_stopped_irq++;
> 		...
> 			x->fatal_bus_error_irq++;
> 
> Suppose RBU, RPS or FBE arrives together with RI or TI on a channel. Both
> vectors can then read the bit before either one writes it back. Could
> rx_buf_unav_irq, rx_process_stopped_irq and fatal_bus_error_irq in
> ethtool -S then count the event twice? The concurrent read-modify-write
> could also lose increments.

I'd say, this is both unlikely and acceptable for these counters

> 
> [ ... ]
> 
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index 25894771e9e9f..0bcbf837d9cc8 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -3145,6 +3145,22 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan, u32 dir)
>>  	return status;
>>  }
>>  
>> +static void stmmac_dma_err_interrupt(struct stmmac_priv *priv)
>> +{
>> +	u8 channels_to_check = max(priv->plat->rx_queues_to_use,
>> +				   priv->plat->tx_queues_to_use);
>> +	int status;
>> +	u8 chan;
>> +
>> +	for (chan = 0; chan < channels_to_check; chan++) {
>> +		status = stmmac_dma_interrupt_status(priv, priv->ioaddr,
>> +						     &priv->xstats, chan,
>> +						     DMA_DIR_ERR);
>> +		if (unlikely(status & tx_hard_error))
>> +			stmmac_global_err(priv);
> 
> [Severity: Medium]
> 
> Can the per-channel MSI handlers consume the fatal bus error before this
> loop sees it?

This is also pre-existing for multi-MSI handling then.

[...]

> [Severity: Low]
> 
> This isn't a bug introduced by this patch, but Loongson multi-MSI is left
> out here. loongson_default_data() sets:
> 
> 	plat->core_type = DWMAC_CORE_GMAC;

Yeah I mentionned it in the commit log... The only loognson board I have (2k0300)
uses dwmac-generic and not the loogson glue, so I can't test that one, let's
see if anyone sees that hang on the affected platforms.

Maxime


  reply	other threads:[~2026-11-17  8:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 10:32 Maxime Chevallier
2026-11-16 10:32 ` netdev-bot+sashiko
2026-11-17  8:48   ` Maxime Chevallier [this message]
2026-11-18  1:20 ` 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=9a17822b-3e7b-4338-8663-7007d27daac6@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alexis.lothore@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=magnusleatti@kernelriot.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nb@tipi-net.de \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=thomas.petazzoni@bootlin.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®