Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760247AbYGJSOr (ORCPT ); Thu, 10 Jul 2008 14:14:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757999AbYGJSOf (ORCPT ); Thu, 10 Jul 2008 14:14:35 -0400 Received: from yx-out-2324.google.com ([74.125.44.28]:39926 "EHLO yx-out-2324.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756361AbYGJSOe (ORCPT ); Thu, 10 Jul 2008 14:14:34 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:in-reply-to:user-agent; b=TADuBq9ICv1ulkCntUuc0G08jLnpSfLDZjKu7KoT5CiEL3l2Co26nYj124Zd26qp1x 00Rr1C2EAsT/7AABKGiJ0IUHdVuoqLBrYebkug5D+UhPL6MFonuYcpJO8HyZP7wBfL2u VTYhJUcysjZPbpVFi0A0UsENiTtXrmj7lN99s= Date: Thu, 10 Jul 2008 20:14:16 +0200 From: Jarek Poplawski To: Alexander Beregalov Cc: Linux Kernel Mailing List , linux-next@vger.kernel.org, netdev@vger.kernel.org, David Miller Subject: [PATCH net-next] net: fix lockdep warning in qdisc_lock_tree() Message-ID: <20080710181416.GA8265@ami.dom.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3492 Lines: 92 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: [] > qdisc_lock_tree+0x27/0x2c > [ 0.426638] > [ 0.426638] but task is already holding lock: > [ 0.426638] (&queue->lock){-...}, at: [] > 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: [] > register_pernet_device+0x1a/0x5a > [ 0.426638] #1: (rtnl_mutex){--..}, at: [] > rtnl_lock+0x12/0x14 > [ 0.426638] #2: (&queue->lock){-...}, at: [] > 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] [] __lock_acquire+0xba9/0xf12 > [ 0.426638] [] ? qdisc_lock_tree+0x27/0x2c > [ 0.426638] [] lock_acquire+0x85/0xa9 > [ 0.426638] [] ? qdisc_lock_tree+0x27/0x2c > [ 0.426638] [] _spin_lock+0x25/0x31 > [ 0.426638] [] qdisc_lock_tree+0x27/0x2c > [ 0.426638] [] dev_init_scheduler+0x11/0x94 > [ 0.426638] [] register_netdevice+0x296/0x3f0 > [ 0.426638] [] register_netdev+0x3a/0x48 > [ 0.426638] [] loopback_net_init+0x40/0x7a > [ 0.426638] [] ? 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 Signed-off-by: Jarek Poplawski --- 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); } /** -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/