All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next v7 03/10] net: airoha: Move airoha_qdma pointer in airoha_gdm_dev struct
Date: Tue, 19 May 2026 10:21:10 +0200	[thread overview]
Message-ID: <agwddqW7CZQfYaPn@lore-desk> (raw)
In-Reply-To: <20260517055811.39179C2BCB0@smtp.kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2364 bytes --]

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Deadlock risk due to using `spin_lock` instead of `spin_lock_bh` in `airoha_update_hw_stats`.
> --
> 
> commit af5b93ea60b28ce8a1ab1016b0911418480e766a
> Author: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> net: airoha: Move airoha_qdma pointer in airoha_gdm_dev struct
> 
> This commit moves the airoha_qdma pointer from the airoha_gdm_port
> struct to airoha_gdm_dev, since the QDMA block depends on the net_device
> configuration. This is a preliminary patch to support multiple
> net_devices connected to the same port via an external hardware arbiter.
> 
> > diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> > index 3ca0dbd19275a..6c9f4b289dba7 100644
> > --- a/drivers/net/ethernet/airoha/airoha_eth.c
> > +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> [ ... ]
> > @@ -1560,9 +1564,10 @@ static void airoha_qdma_stop_napi(struct airoha_qdma *qdma)
> >  	}
> >  }
> >  
> > -static void airoha_update_hw_stats(struct airoha_gdm_port *port)
> > +static void airoha_update_hw_stats(struct airoha_gdm_dev *dev)
> >  {
> > -	struct airoha_eth *eth = port->qdma->eth;
> > +	struct airoha_gdm_port *port = dev->port;
> > +	struct airoha_eth *eth = dev->eth;
> >  	u32 val, i = 0;
> >  
> >  	spin_lock(&port->stats.lock);
> 
> This isn't a regression introduced by this patch, but does this spin_lock()
> need to use the _bh variant to prevent a deadlock?
> 
> This function is called from ethtool paths like airoha_ethtool_get_mac_stats()
> and airoha_ethtool_get_rmon_stats(), which run in process context. It is also
> called from airoha_dev_get_stats64() via ndo_get_stats64, which can be invoked
> from softirq context when queried by a bridging or bonding master or qdisc in
> the TX/RX paths.
> 
> If a process-context ethtool operation is preempted by a softirq on the same
> CPU that then invokes dev_get_stats(), could the softirq attempt to acquire
> the already-held port->stats.lock and cause a deadlock?

according to my understanding ndo_get_stats64() can't be invoked from softirq
context.

Regards,
Lorenzo

> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260516-airoha-eth-multi-serdes-v7-0-99e0093303e2@kernel.org?part=3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-05-19  8:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-16  5:57 [PATCH net-next v7 00/10] net: airoha: Support multiple net_devices connected to the same GDM port Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 01/10] dt-bindings: net: airoha: Add EN7581 ethernet-ports properties Lorenzo Bianconi
2026-05-17  5:58   ` sashiko-bot
2026-05-18 20:39     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 02/10] net: airoha: Introduce airoha_gdm_dev struct Lorenzo Bianconi
2026-05-17  5:58   ` sashiko-bot
2026-05-18 20:59     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 03/10] net: airoha: Move airoha_qdma pointer in " Lorenzo Bianconi
2026-05-17  5:58   ` sashiko-bot
2026-05-19  8:21     ` Lorenzo Bianconi [this message]
2026-05-16  5:57 ` [PATCH net-next v7 04/10] net: airoha: Rely on airoha_gdm_dev pointer in airoha_is_lan_gdm_port() Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 05/10] net: airoha: Move qos_sq_bmap in airoha_gdm_dev struct Lorenzo Bianconi
2026-05-17  5:58   ` sashiko-bot
2026-05-19  8:23     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 06/10] net: airoha: Move {cpu,fwd}_tx_packets " Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 07/10] net: airoha: Support multiple net_devices for a single FE GDM port Lorenzo Bianconi
2026-05-17  5:58   ` sashiko-bot
2026-05-18 21:28     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 08/10] net: airoha: Do not stop GDM port if it is shared Lorenzo Bianconi
2026-05-17  5:58   ` sashiko-bot
2026-05-18 22:12     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 09/10] net: airoha: Introduce WAN device flag Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 10/10] net: airoha: Support multiple LAN/WAN interfaces for hw MAC address configuration Lorenzo Bianconi
2026-05-17  5:58   ` sashiko-bot
2026-05-19  8:37     ` Lorenzo Bianconi

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=agwddqW7CZQfYaPn@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.