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=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 74DECC433DF for ; Fri, 3 Jul 2020 08:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57C4A207DA for ; Fri, 3 Jul 2020 08:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbgGCI7A (ORCPT ); Fri, 3 Jul 2020 04:59:00 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:39501 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726482AbgGCI7A (ORCPT ); Fri, 3 Jul 2020 04:59:00 -0400 X-Originating-IP: 86.202.118.225 Received: from localhost (lfbn-lyo-1-23-225.w86-202.abo.wanadoo.fr [86.202.118.225]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id E9876E0012; Fri, 3 Jul 2020 08:58:55 +0000 (UTC) Date: Fri, 3 Jul 2020 10:58:55 +0200 From: Alexandre Belloni To: Ahmad Fatoum Cc: Nicolas Ferre , Ludovic Desroches , Stephen Boyd , kernel@pengutronix.de, Michael Turquette , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: at91: fix possible dead lock in new drivers Message-ID: <20200703085855.GD6538@piout.net> References: <20200703073236.23923-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200703073236.23923-1-a.fatoum@pengutronix.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/2020 09:32:35+0200, Ahmad Fatoum wrote: > syscon_node_to_regmap() will make the created regmap get and enable the > first clock it can parse from the device tree. This clock is not needed to > access the registers and should not be enabled at that time. > > Use device_node_to_regmap to resolve this as it looks up the regmap in > the same list but doesn't care about the clocks. This issue is detected > by lockdep when booting the sama5d3 with a device tree containing the > new clk bindings. > > This fix already happened in 6956eb33abb5 ("clk: at91: fix possible > deadlock") for the drivers that had been migrated to the new clk binding > back then. This does the same for the new drivers as well. > > Fixes: 01e2113de9a5 ("clk: at91: add sam9x60 pmc driver") > Signed-off-by: Ahmad Fatoum Acked-by: Alexandre Belloni > --- > Only boot tested on the sama5d3. > --- > drivers/clk/at91/at91sam9g45.c | 2 +- > drivers/clk/at91/at91sam9n12.c | 2 +- > drivers/clk/at91/sam9x60.c | 2 +- > drivers/clk/at91/sama5d3.c | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c > index 9873b583c260..fe9d391adeba 100644 > --- a/drivers/clk/at91/at91sam9g45.c > +++ b/drivers/clk/at91/at91sam9g45.c > @@ -111,7 +111,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) > return; > mainxtal_name = of_clk_get_parent_name(np, i); > > - regmap = syscon_node_to_regmap(np); > + regmap = device_node_to_regmap(np); > if (IS_ERR(regmap)) > return; > > diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c > index 630dc5d87171..4aa97e672bd6 100644 > --- a/drivers/clk/at91/at91sam9n12.c > +++ b/drivers/clk/at91/at91sam9n12.c > @@ -124,7 +124,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) > return; > mainxtal_name = of_clk_get_parent_name(np, i); > > - regmap = syscon_node_to_regmap(np); > + regmap = device_node_to_regmap(np); > if (IS_ERR(regmap)) > return; > > diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c > index 3e20aa68259f..2b4c67485eee 100644 > --- a/drivers/clk/at91/sam9x60.c > +++ b/drivers/clk/at91/sam9x60.c > @@ -178,7 +178,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) > return; > mainxtal_name = of_clk_get_parent_name(np, i); > > - regmap = syscon_node_to_regmap(np); > + regmap = device_node_to_regmap(np); > if (IS_ERR(regmap)) > return; > > diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c > index 5e4e44dd4c37..5609b04e6565 100644 > --- a/drivers/clk/at91/sama5d3.c > +++ b/drivers/clk/at91/sama5d3.c > @@ -121,7 +121,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) > return; > mainxtal_name = of_clk_get_parent_name(np, i); > > - regmap = syscon_node_to_regmap(np); > + regmap = device_node_to_regmap(np); > if (IS_ERR(regmap)) > return; > > -- > 2.27.0 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com 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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 473A5C433DF for ; Fri, 3 Jul 2020 09:00:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1671B20674 for ; Fri, 3 Jul 2020 09:00:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l+vk+otr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1671B20674 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AXrdSyl0RtZM1LULFK5AT2V+fRD1hon3c+io56YSS2o=; b=l+vk+otrlh0cJ824RJvGtSh0y FlZVQw3PnLmJX4GF597TmOPtHtTj5K8k4BLE5sY71oHBAw08MkMUdWpS6heY4En7S+FiOcuqi0K4N YVuFBVb1ptnWsO8EnYbkgmVeLu8u6hQ5scanF2bqT/dMHJP07R/SoDAaDS0NAwEAJyo0LE1tq29SZ lKSwox0ZIbsTdIvSF7XstzUEUt2w996Fv3/DqyyiBgMgIDAm+fGJ3k+BMTJIkPPrX8Mkpud7Phego S6vCB21dN7C6Xx2W7mJ6KbKzmuFyvLN4iI2I2wnNzwA9GJ+yPds2ObNlKGrSEdJMLR9mIv/9E2ASB LGsqf+9MA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrHXC-0003GM-Ig; Fri, 03 Jul 2020 08:59:02 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrHX9-0003Ft-Am for linux-arm-kernel@lists.infradead.org; Fri, 03 Jul 2020 08:59:00 +0000 X-Originating-IP: 86.202.118.225 Received: from localhost (lfbn-lyo-1-23-225.w86-202.abo.wanadoo.fr [86.202.118.225]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id E9876E0012; Fri, 3 Jul 2020 08:58:55 +0000 (UTC) Date: Fri, 3 Jul 2020 10:58:55 +0200 From: Alexandre Belloni To: Ahmad Fatoum Subject: Re: [PATCH] clk: at91: fix possible dead lock in new drivers Message-ID: <20200703085855.GD6538@piout.net> References: <20200703073236.23923-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200703073236.23923-1-a.fatoum@pengutronix.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200703_045859_558993_FE8AA438 X-CRM114-Status: GOOD ( 21.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephen Boyd , Michael Turquette , linux-kernel@vger.kernel.org, Ludovic Desroches , kernel@pengutronix.de, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 03/07/2020 09:32:35+0200, Ahmad Fatoum wrote: > syscon_node_to_regmap() will make the created regmap get and enable the > first clock it can parse from the device tree. This clock is not needed to > access the registers and should not be enabled at that time. > > Use device_node_to_regmap to resolve this as it looks up the regmap in > the same list but doesn't care about the clocks. This issue is detected > by lockdep when booting the sama5d3 with a device tree containing the > new clk bindings. > > This fix already happened in 6956eb33abb5 ("clk: at91: fix possible > deadlock") for the drivers that had been migrated to the new clk binding > back then. This does the same for the new drivers as well. > > Fixes: 01e2113de9a5 ("clk: at91: add sam9x60 pmc driver") > Signed-off-by: Ahmad Fatoum Acked-by: Alexandre Belloni > --- > Only boot tested on the sama5d3. > --- > drivers/clk/at91/at91sam9g45.c | 2 +- > drivers/clk/at91/at91sam9n12.c | 2 +- > drivers/clk/at91/sam9x60.c | 2 +- > drivers/clk/at91/sama5d3.c | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c > index 9873b583c260..fe9d391adeba 100644 > --- a/drivers/clk/at91/at91sam9g45.c > +++ b/drivers/clk/at91/at91sam9g45.c > @@ -111,7 +111,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np) > return; > mainxtal_name = of_clk_get_parent_name(np, i); > > - regmap = syscon_node_to_regmap(np); > + regmap = device_node_to_regmap(np); > if (IS_ERR(regmap)) > return; > > diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c > index 630dc5d87171..4aa97e672bd6 100644 > --- a/drivers/clk/at91/at91sam9n12.c > +++ b/drivers/clk/at91/at91sam9n12.c > @@ -124,7 +124,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np) > return; > mainxtal_name = of_clk_get_parent_name(np, i); > > - regmap = syscon_node_to_regmap(np); > + regmap = device_node_to_regmap(np); > if (IS_ERR(regmap)) > return; > > diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c > index 3e20aa68259f..2b4c67485eee 100644 > --- a/drivers/clk/at91/sam9x60.c > +++ b/drivers/clk/at91/sam9x60.c > @@ -178,7 +178,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np) > return; > mainxtal_name = of_clk_get_parent_name(np, i); > > - regmap = syscon_node_to_regmap(np); > + regmap = device_node_to_regmap(np); > if (IS_ERR(regmap)) > return; > > diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c > index 5e4e44dd4c37..5609b04e6565 100644 > --- a/drivers/clk/at91/sama5d3.c > +++ b/drivers/clk/at91/sama5d3.c > @@ -121,7 +121,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np) > return; > mainxtal_name = of_clk_get_parent_name(np, i); > > - regmap = syscon_node_to_regmap(np); > + regmap = device_node_to_regmap(np); > if (IS_ERR(regmap)) > return; > > -- > 2.27.0 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel