From patchwork Mon Feb 10 19:42:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 319041 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B9EA32C0096 for ; Tue, 11 Feb 2014 07:15:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755457AbaBJUPe (ORCPT ); Mon, 10 Feb 2014 15:15:34 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:38793 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753284AbaBJTmi (ORCPT ); Mon, 10 Feb 2014 14:42:38 -0500 Received: by mail-pa0-f51.google.com with SMTP id ld10so6642399pab.38 for ; Mon, 10 Feb 2014 11:42:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:content-transfer-encoding:mime-version; bh=iUbiL/BnZJFUpwApCPOIZp6yjQZaUYahW0PNFZMKLok=; b=yGZXxo9NtsZwxJd1yHZCVnt0hUpJINvL13lb0UD6V7WZlrFp5kooY0h4VG4py8MT4n Vtn7hZ/SMiQLhKalGMMtob4wDU4sbrmUMUW6hnJzs0kMzN8e44PBKmnzm71o4t6WhWnu CeXjbJ4qWvIWK4SF4Xzz8BGit50+SjfwfGISFjovU48f/xlqiR2LY4A2qwMw/iNL5qXz f+0NwELpSuspIf+F4yoiLxCYE4Vv4ak1eWFdF1NSHEW8kxrdJ1vaurvgci3cUbDlwu8P puUTQg+j6stxzsclbLpJs5FW2LNXixiw+pwgrixFjgvqe/ozjdGAN28fbuYM8/ESZCvl vPQA== X-Received: by 10.69.2.2 with SMTP id bk2mr39403618pbd.75.1392061357550; Mon, 10 Feb 2014 11:42:37 -0800 (PST) Received: from [172.19.240.108] ([172.19.240.108]) by mx.google.com with ESMTPSA id ac5sm45125195pbc.37.2014.02.10.11.42.35 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Mon, 10 Feb 2014 11:42:37 -0800 (PST) Message-ID: <1392061355.6615.52.camel@edumazet-glaptop2.roam.corp.google.com> Subject: [PATCH] 6lowpan: fix lockdep splats From: Eric Dumazet To: Alexander Aring , David Miller Cc: netdev Date: Mon, 10 Feb 2014 11:42:35 -0800 In-Reply-To: <1391949707.10160.130.camel@edumazet-glaptop2.roam.corp.google.com> References: <20140209102047.GA14770@omega> <1391949707.10160.130.camel@edumazet-glaptop2.roam.corp.google.com> X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet When a device ndo_start_xmit() calls again dev_queue_xmit(), lockdep can complain because dev_queue_xmit() is re-entered and the spinlocks protecting tx queues share a common lockdep class. Same issue was fixed for bonding/l2tp/ppp in commits 0daa2303028a6 ("[PATCH] bonding: lockdep annotation") 49ee49202b4ac ("bonding: set qdisc_tx_busylock to avoid LOCKDEP splat") 23d3b8bfb8eb2 ("net: qdisc busylock needs lockdep annotations ") 303c07db487be ("ppp: set qdisc_tx_busylock to avoid LOCKDEP splat ") Reported-by: Alexander Aring Signed-off-by: Eric Dumazet Tested-by: Alexander Aring --- net/ieee802154/6lowpan.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 8bfb40153fe7..8edfea5da572 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c @@ -530,7 +530,27 @@ static struct header_ops lowpan_header_ops = { .create = lowpan_header_create, }; +static struct lock_class_key lowpan_tx_busylock; +static struct lock_class_key lowpan_netdev_xmit_lock_key; + +static void lowpan_set_lockdep_class_one(struct net_device *dev, + struct netdev_queue *txq, + void *_unused) +{ + lockdep_set_class(&txq->_xmit_lock, + &lowpan_netdev_xmit_lock_key); +} + + +static int lowpan_dev_init(struct net_device *dev) +{ + netdev_for_each_tx_queue(dev, lowpan_set_lockdep_class_one, NULL); + dev->qdisc_tx_busylock = &lowpan_tx_busylock; + return 0; +} + static const struct net_device_ops lowpan_netdev_ops = { + .ndo_init = lowpan_dev_init, .ndo_start_xmit = lowpan_xmit, .ndo_set_mac_address = lowpan_set_address, };