linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Alexander Beregalov <a.beregalov@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-next@vger.kernel.org, netdev@vger.kernel.org,
	David Miller <davem@davemloft.net>
Subject: [PATCH net-next] net: fix lockdep warning in qdisc_lock_tree()
Date: Thu, 10 Jul 2008 20:14:16 +0200	[thread overview]
Message-ID: <20080710181416.GA8265@ami.dom.local> (raw)
In-Reply-To: <a4423d670807100204kf269814ncd649bf02312311b@mail.gmail.com>

Alexander Beregalov wrote, On 07/10/2008 11:04 AM:
...
> [    0.426638] =============================================
> [    0.426638] [ INFO: possible recursive locking detected ]
> [    0.426638] 2.6.26-rc9-next-20080710 #5
> [    0.426638] ---------------------------------------------
> [    0.426638] swapper/1 is trying to acquire lock:
> [    0.426638]  (&queue->lock){-...}, at: [<ffffffff8041c3d0>]
> qdisc_lock_tree+0x27/0x2c
> [    0.426638]
> [    0.426638] but task is already holding lock:
> [    0.426638]  (&queue->lock){-...}, at: [<ffffffff8041c3c8>]
> qdisc_lock_tree+0x1f/0x2c
> [    0.426638]
> [    0.426638] other info that might help us debug this:
> [    0.426638] 3 locks held by swapper/1:
> [    0.426638]  #0:  (net_mutex){--..}, at: [<ffffffff8040b827>]
> register_pernet_device+0x1a/0x5a
> [    0.426638]  #1:  (rtnl_mutex){--..}, at: [<ffffffff80417179>]
> rtnl_lock+0x12/0x14
> [    0.426638]  #2:  (&queue->lock){-...}, at: [<ffffffff8041c3c8>]
> qdisc_lock_tree+0x1f/0x2c
> [    0.426638]
> [    0.426638] stack backtrace:
> [    0.426638] Pid: 1, comm: swapper Not tainted 2.6.26-rc9-next-20080710 #5
> [    0.426638]
> [    0.426638] Call Trace:
> [    0.426638]  [<ffffffff8024f95a>] __lock_acquire+0xba9/0xf12
> [    0.426638]  [<ffffffff8041c3d0>] ? qdisc_lock_tree+0x27/0x2c
> [    0.426638]  [<ffffffff8024fd48>] lock_acquire+0x85/0xa9
> [    0.426638]  [<ffffffff8041c3d0>] ? qdisc_lock_tree+0x27/0x2c
> [    0.426638]  [<ffffffff80476794>] _spin_lock+0x25/0x31
> [    0.426638]  [<ffffffff8041c3d0>] qdisc_lock_tree+0x27/0x2c
> [    0.426638]  [<ffffffff8041c412>] dev_init_scheduler+0x11/0x94
> [    0.426638]  [<ffffffff8040f3be>] register_netdevice+0x296/0x3f0
> [    0.426638]  [<ffffffff8040f552>] register_netdev+0x3a/0x48
> [    0.426638]  [<ffffffff805fc274>] loopback_net_init+0x40/0x7a
> [    0.426638]  [<ffffffff805fc222>] ? loopback_init+0x0/0x12
...

lockdep needs separate lock init to distinguish rx and tx queue locks.
(There is no real lockup danger.)

Reported-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>

---

 net/core/dev.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index a29a359..157b683 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4090,17 +4090,25 @@ static struct net_device_stats *internal_stats(struct net_device *dev)
 	return &dev->stats;
 }
 
-static void netdev_init_one_queue(struct net_device *dev,
-				  struct netdev_queue *queue)
+static void netdev_init_rx_queue(struct net_device *dev,
+				  struct netdev_queue *rx_queue)
 {
-	spin_lock_init(&queue->lock);
-	queue->dev = dev;
+	spin_lock_init(&rx_queue->lock);
+	rx_queue->dev = dev;
+}
+
+/* lockdep needs separate init to distinguish these locks */
+static void netdev_init_tx_queue(struct net_device *dev,
+				  struct netdev_queue *tx_queue)
+{
+	spin_lock_init(&tx_queue->lock);
+	tx_queue->dev = dev;
 }
 
 static void netdev_init_queues(struct net_device *dev)
 {
-	netdev_init_one_queue(dev, &dev->rx_queue);
-	netdev_init_one_queue(dev, &dev->tx_queue);
+	netdev_init_rx_queue(dev, &dev->rx_queue);
+	netdev_init_tx_queue(dev, &dev->tx_queue);
 }
 
 /**

      reply	other threads:[~2008-07-10 18:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10  9:04 next-20080710: possible recursive locking detected at qdisc_lock_tree Alexander Beregalov
2008-07-10 18:14 ` Jarek Poplawski [this message]

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=20080710181416.GA8265@ami.dom.local \
    --to=jarkao2@gmail.com \
    --cc=a.beregalov@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).