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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 531A4C3DA6E for ; Sun, 17 Dec 2023 23:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:To:Cc:From:Subject:References: In-Reply-To:MIME-Version:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dy6NzI86z822UELU1ESrDIB23w9V32kUMxj9WUbnUv0=; b=nMK9wxANq4zbqg qxM5aj5+k6QzNSM3BNH08gwkoKvHB8NFU/EzbBnNMyyWE4WJgMVVbLgdHXEXPzVMTVzzoRRrahvTZ v9m+eNWbtcx7zkAZ4UHcPMf8vmSvEgaQtdeKPbQKgzZ6OD2SDmdOOGjdVb7ICIhcSeRRST96mts2e WJlKuvwxGifWJ7d/tWC0VJjMVA6ueQ/cO+liIIG0kIhb5jgz1/EtdpGv/HUdh4xrJWYQ3vugi+D/G +QA8OWkBueNKIEYStHgWVkPWhDAnNSExmqWd/j/IOCaVBL9awsFoUIzMxw27qhGrwHgNvlnX19cP4 nW7lP/K3PQ58/hjYCJ4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rF0C3-008cOO-1f; Sun, 17 Dec 2023 23:05:07 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rF0C1-008cNw-0I for linux-arm-kernel@lists.infradead.org; Sun, 17 Dec 2023 23:05:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 47D0D60BC3; Sun, 17 Dec 2023 23:05:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4A8FC433C7; Sun, 17 Dec 2023 23:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702854303; bh=C31/vdIwlOG4/RQpDKhURj/OwqcINur5NKr6OP5ZcBY=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=caqjKKMZzNHtUE0k7JGP35K97SrxPimgNRsRVIJWxbjG1a00XoKn/0+6ZnN89afve PIBAxXW8bxMrKeUs+DTNEf5gXZnCr4QZvlvWU+9uYUhn8hDW3nyYmQlTQJ1YpG36zn CUYH4ZjWdNwIOt9h2GICr9xgmZVbfoG1VW+kPLf96DYm3hE9cwBJ+pU/5Dn4tJjUN+ 9y0OpSVS4eBouTH5fVXb7cBzIiM2xBIa/GQq2jsqRrdhewFJG6oU5Zz/opuLCgtrt0 lr0ISwKr0/aUkOPgwzNWluAXdwOsnl/IBG7obL957qQpuvRPCK76VaMuKUJU2BFe0b vEooQ6HNn55/w== Message-ID: <883a61872f94c972cc410da84eaf7b97.sboyd@kernel.org> MIME-Version: 1.0 In-Reply-To: <20231002180854.1603452-2-ben.wolsieffer@hefring.com> References: <20231002180854.1603452-1-ben.wolsieffer@hefring.com> <20231002180854.1603452-2-ben.wolsieffer@hefring.com> Subject: Re: [PATCH 1/2] clk: stm32: initialize syscon after clocks are registered From: Stephen Boyd Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Michael Turquette , Ben Wolsieffer To: Ben Wolsieffer , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Date: Sun, 17 Dec 2023 15:05:01 -0800 User-Agent: alot/0.10 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231217_150505_300185_5D5D7E9B X-CRM114-Status: GOOD ( 19.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Quoting Ben Wolsieffer (2023-10-02 11:08:53) > The stm32-power-config syscon (PWR peripheral) is used in this driver > and the STM32 RTC driver to enable write access to backup domain > registers. The syscon's clock has a gate controlled by this clock > driver, but this clock is currently not registered in the device tree. > This only happens to work currently because all relevant clock setup and > RTC initialization happens before clk_disabled_unused(). After this > point, all syscon register writes are ignored. Seems like we should mark those clks as CLK_IGNORE_UNUSED and add a comment to that fact. > > If we simply add the syscon clock in the device tree, we end up with a > circular dependency because the clock has not been registered at the > point this driver requests the syscon. > > This patch avoids this circular dependency by moving the syscon lookup > after the clocks are registered. This does appear to create a possible > race condition where someone could attempt to perform an operation on a > backup domain clock before the syscon has been initialized. This would > result in the operation having no effect because backup domain writes > could not be enabled. I'm not sure if this is a problem or if there is > a way to avoid it. There's no comment in the code that says the regmap must be set there instead of earlier. What's to stop someone from tripping over this problem later? At the least, please add a comment. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel