From: Lukasz Majewski <lukma@denx.de>
To: Paolo Abeni <pabeni@redhat.com>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
davem@davemloft.net, "Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Richard Cochran" <richardcochran@gmail.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
"Stefan Wahren" <wahrenst@gmx.net>,
"Simon Horman" <horms@kernel.org>,
"Łukasz Majewski" <lukasz.majewski@mailbox.org>
Subject: Re: [net-next v13 06/11] net: mtip: Add mtip_switch_{rx|tx} functions to the L2 switch driver
Date: Mon, 30 Jun 2025 13:34:36 +0200 [thread overview]
Message-ID: <20250630133436.71238a65@wsk> (raw)
In-Reply-To: <0de412ee-c9ce-463b-92ef-58a33fd132d1@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2101 bytes --]
Hi Paolo,
> > static void mtip_switch_tx(struct net_device *dev)
> > {
> > + struct mtip_ndev_priv *priv = netdev_priv(dev);
> > + struct switch_enet_private *fep = priv->fep;
> > + unsigned short status;
> > + struct sk_buff *skb;
> > + unsigned long flags;
> > + struct cbd_t *bdp;
> > +
> > + spin_lock_irqsave(&fep->hw_lock, flags);
>
> This is called from napi (bh) context, and every other caller
> is/should be BH, too. You should use
>
> spin_lock_bh()
I've double check the spin locking in the driver - I've also consult
the fec_main.c.
It looks like the mtip_switch_rx() and fec_enet_rx() are not using
explicit locks and rely on NAPI locking.
On the other hand - the fec_enet_tx (and corresponding MTIP variant)
use spin_lock(), not the _bh() variant.
>
> Also please test your patches with CONFIG_LOCKDEP and
> CONFIG_DEBUG_SPINLOCK enabled, thet will help finding this king of
> issues.
This was enabled by default. By changing all locks to _bh() there were
deadlocks observed.
On the MTIP driver (due to this HW IP block) there are some locks which
must disable interrupts:
1. One is when mtip_adjust_link() is called - as it is the same for
both switch ports. Moreover, at some use cases it is required that the
switch IP block is reset.
2. The mtip_atable_dynamicms_learn_migration() - it changes the content
of dynamic switching table. IRQ from switch shall not be possible at
this time as it can be called from mtip_switch_rx() (from NAPI) and
from timer/kthread (at specified period).
To sum up:
I'm going to prepare the v14 with changes around the timer / kthread
running mtip_atable_dynamicms_learn_migration() and use time stamps
extracted from jiffies.
Locks will be optimized and following paradigm used with fec_main.c
driver.
>
> /P
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2025-06-30 11:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-22 9:37 [net-next v13 00/11] net: mtip: Add support for MTIP imx287 L2 switch driver Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 01/11] dt-bindings: net: Add MTIP L2 switch description Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 02/11] ARM: dts: nxp: mxs: Adjust the imx28.dtsi " Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 03/11] ARM: dts: nxp: mxs: Adjust XEA board's DTS to support L2 switch Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 04/11] net: mtip: The L2 switch driver for imx287 Lukasz Majewski
2025-06-24 13:24 ` Paolo Abeni
2025-06-24 21:04 ` Lukasz Majewski
2025-06-25 7:13 ` Paolo Abeni
2025-06-26 6:28 ` Lukasz Majewski
2025-06-24 13:37 ` Paolo Abeni
2025-06-24 21:22 ` Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 05/11] net: mtip: Add net_device_ops functions to the L2 switch driver Lukasz Majewski
2025-06-24 13:42 ` Paolo Abeni
2025-06-24 21:33 ` Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 06/11] net: mtip: Add mtip_switch_{rx|tx} " Lukasz Majewski
2025-06-24 13:58 ` Paolo Abeni
2025-06-24 21:54 ` Lukasz Majewski
2025-06-30 11:34 ` Lukasz Majewski [this message]
2025-06-22 9:37 ` [net-next v13 07/11] net: mtip: Extend the L2 switch driver with management operations Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 08/11] net: mtip: Extend the L2 switch driver for imx287 with bridge operations Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 09/11] ARM: mxs_defconfig: Enable CONFIG_NFS_FSCACHE Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 10/11] ARM: mxs_defconfig: Update mxs_defconfig to 6.16-rc1 Lukasz Majewski
2025-06-22 9:37 ` [net-next v13 11/11] ARM: mxs_defconfig: Enable CONFIG_FEC_MTIP_L2SW to support MTIP L2 switch Lukasz Majewski
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=20250630133436.71238a65@wsk \
--to=lukma@denx.de \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=horms@kernel.org \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukasz.majewski@mailbox.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=wahrenst@gmx.net \
/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