From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F10B1C43381 for ; Fri, 22 Feb 2019 17:49:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9AD120700 for ; Fri, 22 Feb 2019 17:49:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="EvXplySa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727039AbfBVRtB (ORCPT ); Fri, 22 Feb 2019 12:49:01 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:39872 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbfBVRtB (ORCPT ); Fri, 22 Feb 2019 12:49:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=o453UaZ4KcVh0UtPXK2cD2oauOVDMSVAOZwhfPGjxKo=; b=EvXplySaegR30QFNcUZnb7P0j 3srn3OgHug1KRlEliG1/+uCAPSeju1tdz08khv8zPHwdTDTswq/oJF50PcFLsf2CKCEEuWaEUlB0e OQ64hyFSrAFh6JjWArOeBwYWKpKHXclckISOvMPEI/AOuMV3fH5atn1AHQAeK29/CV2rZqk1OD/Q2 XcCjcXwv+AHhc4/3tNK6WTitN0RCNTOBYlZSLKmOoZyAKb0UlyjSuzw6Vba5o9CmVx97q4/jFkjcY 5i6WjtLTY0/eRtzn6msp95vOG+vnhKcpG2UO1lREHW7ZpFxT3ZjhbuwDdKqCZVpyRkZLClYE7gB23 mlOeWInuQ==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:54708) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gxEwT-0003RQ-RM; Fri, 22 Feb 2019 17:48:57 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.89) (envelope-from ) id 1gxEwS-0002Op-I1; Fri, 22 Feb 2019 17:48:56 +0000 Date: Fri, 22 Feb 2019 17:48:56 +0000 From: Russell King - ARM Linux admin To: Andrew Lunn Cc: netdev , Vivien Didelot Subject: Re: [PATCH] net: dsa: mv88e6xxx: Add lockdep classes to fix false positive splat Message-ID: <20190222174856.tmisqn7ih3ea3xvz@shell.armlinux.org.uk> References: <20190217181143.14817-1-andrew@lunn.ch> <20190217195524.rhc4rsvzsalptyua@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190217195524.rhc4rsvzsalptyua@shell.armlinux.org.uk> User-Agent: NeoMutt/20170113 (1.7.2) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sun, Feb 17, 2019 at 07:55:24PM +0000, Russell King - ARM Linux admin wrote: > On Sun, Feb 17, 2019 at 07:11:43PM +0100, Andrew Lunn wrote: > > The following false positive lockdep splat has been observed. > > > > ====================================================== > > WARNING: possible circular locking dependency detected > > 4.20.0+ #302 Not tainted > > ------------------------------------------------------ > > systemd-udevd/160 is trying to acquire lock: > > edea6080 (&chip->reg_lock){+.+.}, at: __setup_irq+0x640/0x704 > > > > but task is already holding lock: > > edff0340 (&desc->request_mutex){+.+.}, at: __setup_irq+0xa0/0x704 > > > > which lock already depends on the new lock. > > > > the existing dependency chain (in reverse order) is: > > > > -> #1 (&desc->request_mutex){+.+.}: > > mutex_lock_nested+0x1c/0x24 > > __setup_irq+0xa0/0x704 > > request_threaded_irq+0xd0/0x150 > > mv88e6xxx_probe+0x41c/0x694 [mv88e6xxx] > > mdio_probe+0x2c/0x54 > > really_probe+0x200/0x2c4 > > driver_probe_device+0x5c/0x174 > > __driver_attach+0xd8/0xdc > > bus_for_each_dev+0x58/0x7c > > bus_add_driver+0xe4/0x1f0 > > driver_register+0x7c/0x110 > > mdio_driver_register+0x24/0x58 > > do_one_initcall+0x74/0x2e8 > > do_init_module+0x60/0x1d0 > > load_module+0x1968/0x1ff4 > > sys_finit_module+0x8c/0x98 > > ret_fast_syscall+0x0/0x28 > > 0xbedf2ae8 > > > > -> #0 (&chip->reg_lock){+.+.}: > > __mutex_lock+0x50/0x8b8 > > mutex_lock_nested+0x1c/0x24 > > __setup_irq+0x640/0x704 > > request_threaded_irq+0xd0/0x150 > > mv88e6xxx_g2_irq_setup+0xcc/0x1b4 [mv88e6xxx] > > mv88e6xxx_probe+0x44c/0x694 [mv88e6xxx] > > mdio_probe+0x2c/0x54 > > really_probe+0x200/0x2c4 > > driver_probe_device+0x5c/0x174 > > __driver_attach+0xd8/0xdc > > bus_for_each_dev+0x58/0x7c > > bus_add_driver+0xe4/0x1f0 > > driver_register+0x7c/0x110 > > mdio_driver_register+0x24/0x58 > > do_one_initcall+0x74/0x2e8 > > do_init_module+0x60/0x1d0 > > load_module+0x1968/0x1ff4 > > sys_finit_module+0x8c/0x98 > > ret_fast_syscall+0x0/0x28 > > 0xbedf2ae8 > > > > other info that might help us debug this: > > > > Possible unsafe locking scenario: > > > > CPU0 CPU1 > > ---- ---- > > lock(&desc->request_mutex); > > lock(&chip->reg_lock); > > lock(&desc->request_mutex); > > lock(&chip->reg_lock); > > > > &desc->request_mutex refer to two different mutex. #1 is the GPIO for > > the chip interrupt. #2 is the chained interrupt between global 1 and > > global 2. > > > > Add lockdep classes to the GPIO interrupt to avoid this. > > > > Reported-by: Russell King > > Signed-off-by: Andrew Lunn > > --- > > > > Hi Russell > > > > Does this fix it for you on Clearfog? > > Yes, that also fixes the problem, but I do think this is just papering > over mv88e6xxx needlessly holding locks when it doesn't need to do so. Hi Andrew, Do we have a way forward for this issue? Thanks. > > > > > drivers/net/dsa/mv88e6xxx/chip.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c > > index 32e7af5caa69..936d53a92144 100644 > > --- a/drivers/net/dsa/mv88e6xxx/chip.c > > +++ b/drivers/net/dsa/mv88e6xxx/chip.c > > @@ -442,12 +442,20 @@ static int mv88e6xxx_g1_irq_setup_common(struct mv88e6xxx_chip *chip) > > > > static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip) > > { > > + static struct lock_class_key lock_key; > > + static struct lock_class_key request_key; > > int err; > > > > err = mv88e6xxx_g1_irq_setup_common(chip); > > if (err) > > return err; > > > > + /* These lock classes tells lockdep that global 1 irqs are in > > + * a different category than their parent GPIO, so it won't > > + * report false recursion. > > + */ > > + irq_set_lockdep_class(chip->irq, &lock_key, &request_key); > > + > > err = request_threaded_irq(chip->irq, NULL, > > mv88e6xxx_g1_irq_thread_fn, > > IRQF_ONESHOT | IRQF_SHARED, > > -- > > 2.20.1 > > > > > > -- > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up > According to speedtest.net: 11.9Mbps down 500kbps up -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up