Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lorenzo Bianconi" <lorenzo@kernel.org>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH net-next v8 02/10] net: airoha: Introduce airoha_gdm_dev struct
Date: Wed, 20 May 2026 08:59:32 +0000	[thread overview]
Message-ID: <20260520085932.9473C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260519-airoha-eth-multi-serdes-v8-2-6bd70e329df6@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Potential deadlock in `airoha_update_hw_stats()` due to using `spin_lock()` instead of `spin_lock_bh()`.
--

commit 6823c137925a562390270eb1ce7967caaa011b7b
Author: Lorenzo Bianconi <lorenzo@kernel.org>

net: airoha: Introduce airoha_gdm_dev struct

This commit introduces the airoha_gdm_dev struct to collect net_device related
info, accommodating future support for connecting multiple external SerDes to
GDM3 or GDM4 ports via a hardware arbiter.

> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> index 5a027cc7ffcb1..5335271ea8654 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.c
> +++ b/drivers/net/ethernet/airoha/airoha_eth.c

[ ... ]

> @@ -1877,10 +1888,11 @@ static int airoha_dev_init(struct net_device *dev)
>  	return 0;
>  }
>  
> -static void airoha_dev_get_stats64(struct net_device *dev,
> +static void airoha_dev_get_stats64(struct net_device *netdev,
>  				   struct rtnl_link_stats64 *storage)
>  {
> -	struct airoha_gdm_port *port = netdev_priv(dev);
> +	struct airoha_gdm_dev *dev = netdev_priv(netdev);
> +	struct airoha_gdm_port *port = dev->port;
>  	unsigned int start;
>  
>  	airoha_update_hw_stats(port);

This isn't a bug introduced by this patch, but could this lead to a deadlock?

Because airoha_dev_get_stats64() is registered as the ndo_get_stats64 callback,
it can be called from both process context (e.g., via user-space netlink dumps)
and software interrupt context (BH) (e.g., via bonding or teaming drivers).

Looking at airoha_update_hw_stats(), it uses spin_lock() to protect the
hardware statistics update:

drivers/net/ethernet/airoha/airoha_eth.c:airoha_update_hw_stats() {
	...
	spin_lock(&port->stats.lock);
	u64_stats_update_begin(&port->stats.syncp);
	...
}

Because spin_lock() disables preemption but not softirqs, if a process context
call is interrupted by a BH call on the same CPU, the BH handler will attempt
to acquire the already-held lock.

Should this be upgraded to spin_lock_bh() to prevent a potential deadlock?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260519-airoha-eth-multi-serdes-v8-0-6bd70e329df6@kernel.org?part=2

  reply	other threads:[~2026-05-20  8:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  8:57 [PATCH net-next v8 00/10] net: airoha: Support multiple net_devices connected to the same GDM port Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 01/10] dt-bindings: net: airoha: Add GDM port ethernet child node Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 02/10] net: airoha: Introduce airoha_gdm_dev struct Lorenzo Bianconi
2026-05-20  8:59   ` sashiko-bot [this message]
2026-05-20 12:25     ` Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 03/10] net: airoha: Move airoha_qdma pointer in " Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 04/10] net: airoha: Rely on airoha_gdm_dev pointer in airoha_is_lan_gdm_port() Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 05/10] net: airoha: Move qos_sq_bmap in airoha_gdm_dev struct Lorenzo Bianconi
2026-05-20  8:59   ` sashiko-bot
2026-05-20 12:24     ` Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 06/10] net: airoha: Move {cpu,fwd}_tx_packets " Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 07/10] net: airoha: Support multiple net_devices for a single FE GDM port Lorenzo Bianconi
2026-05-20  8:59   ` sashiko-bot
2026-05-20 12:28     ` Lorenzo Bianconi
2026-05-20 12:33     ` Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 08/10] net: airoha: Do not stop GDM port if it is shared Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 09/10] net: airoha: Introduce WAN device flag Lorenzo Bianconi
2026-05-20  8:59   ` sashiko-bot
2026-05-20 12:46     ` Lorenzo Bianconi
2026-05-19  8:57 ` [PATCH net-next v8 10/10] net: airoha: Support multiple LAN/WAN interfaces for hw MAC address configuration Lorenzo Bianconi
2026-05-20  8:59   ` sashiko-bot
2026-05-20 12:49     ` 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=20260520085932.9473C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lorenzo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox