From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Clark Williams <clrkwllms@kernel.org>,
linux-rt-devel@lists.linux.dev,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: possible circular locking dependency backtrace seen when enabling PREEMPT_RT
Date: Wed, 12 Feb 2025 17:56:12 +0100 [thread overview]
Message-ID: <20250212165612.ogWjReMW@linutronix.de> (raw)
In-Reply-To: <d9480845-7e81-46a2-8bbd-bd0ebdbc6a5f@roeck-us.net>
On 2025-02-12 07:56:44 [-0800], Guenter Roeck wrote:
> Hi,
Hi,
> when enabling PREEMPT_RT together with lock debugging, I see the attached
> "possible circular locking dependency" warning when instantiating the pcnet32
> Ethernet adapter with qemu.
I may buy you a virtio adapter :)
What about this in the meantime:
diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
index c6bd803f5b0c1..c7648045917a6 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -754,6 +754,7 @@ static int pcnet32_set_link_ksettings(struct net_device *dev,
int r = -EOPNOTSUPP;
int suspended, bcr2, bcr9, csr15;
+ local_bh_disable();
spin_lock_irqsave(&lp->lock, flags);
if (lp->mii) {
r = mii_ethtool_set_link_ksettings(&lp->mii_if, cmd);
@@ -789,6 +790,7 @@ static int pcnet32_set_link_ksettings(struct net_device *dev,
r = 0;
}
spin_unlock_irqrestore(&lp->lock, flags);
+ local_bh_enable();
return r;
}
@@ -890,6 +892,7 @@ static int pcnet32_set_ringparam(struct net_device *dev,
pcnet32_netif_stop(dev);
netdev_lock(dev);
+ local_bh_disable();
spin_lock_irqsave(&lp->lock, flags);
lp->a->write_csr(ioaddr, CSR0, CSR0_STOP); /* stop the chip */
@@ -921,6 +924,7 @@ static int pcnet32_set_ringparam(struct net_device *dev,
}
spin_unlock_irqrestore(&lp->lock, flags);
+ local_bh_enable();
netdev_unlock(dev);
netif_info(lp, drv, dev, "Ring Param Settings: RX: %d, TX: %d\n",
@@ -988,6 +992,7 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1)
pcnet32_netif_stop(dev);
netdev_lock(dev);
+ local_bh_disable();
spin_lock_irqsave(&lp->lock, flags);
lp->a->write_csr(ioaddr, CSR0, CSR0_STOP); /* stop the chip */
@@ -1065,7 +1070,9 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1)
rmb();
while ((lp->rx_ring[x].status & teststatus) && (ticks < 200)) {
spin_unlock_irqrestore(&lp->lock, flags);
+ local_bh_enable();
msleep(1);
+ local_bh_disable();
spin_lock_irqsave(&lp->lock, flags);
rmb();
ticks++;
@@ -1125,6 +1132,7 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1)
lp->a->write_bcr(ioaddr, 20, 4); /* return to 16bit mode */
}
spin_unlock_irqrestore(&lp->lock, flags);
+ local_bh_enable();
netdev_unlock(dev);
return rc;
@@ -2106,6 +2114,7 @@ static int pcnet32_open(struct net_device *dev)
}
netdev_lock(dev);
+ local_bh_disable();
spin_lock_irqsave(&lp->lock, flags);
/* Check for a valid station address */
if (!is_valid_ether_addr(dev->dev_addr)) {
@@ -2305,6 +2314,7 @@ static int pcnet32_open(struct net_device *dev)
lp->a->read_csr(ioaddr, CSR0));
spin_unlock_irqrestore(&lp->lock, flags);
+ local_bh_enable();
netdev_unlock(dev);
return 0; /* Always succeed */
@@ -2321,6 +2331,7 @@ static int pcnet32_open(struct net_device *dev)
err_free_irq:
spin_unlock_irqrestore(&lp->lock, flags);
+ local_bh_enable();
netdev_unlock(dev);
free_irq(dev->irq, dev);
return rc;
Sebastian
next prev parent reply other threads:[~2025-02-12 16:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 15:56 possible circular locking dependency backtrace seen when enabling PREEMPT_RT Guenter Roeck
2025-02-12 16:45 ` Steven Rostedt
2025-02-12 16:59 ` Sebastian Andrzej Siewior
2025-02-12 17:03 ` Steven Rostedt
2025-02-12 17:07 ` Steven Rostedt
2025-02-12 17:21 ` Sebastian Andrzej Siewior
2025-02-12 17:09 ` Sebastian Andrzej Siewior
2025-02-12 17:18 ` Steven Rostedt
2025-02-12 17:24 ` Sebastian Andrzej Siewior
2025-02-12 17:33 ` Steven Rostedt
2025-02-13 8:38 ` Sebastian Andrzej Siewior
2025-02-12 17:54 ` Guenter Roeck
2025-02-12 18:17 ` Steven Rostedt
2025-02-12 16:56 ` Sebastian Andrzej Siewior [this message]
2025-02-12 18:36 ` Guenter Roeck
2025-02-13 8:28 ` Sebastian Andrzej Siewior
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=20250212165612.ogWjReMW@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=linux@roeck-us.net \
--cc=rostedt@goodmis.org \
/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.