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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DF38C46467 for ; Tue, 3 Jan 2023 12:49:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237593AbjACMtG (ORCPT ); Tue, 3 Jan 2023 07:49:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237570AbjACMtD (ORCPT ); Tue, 3 Jan 2023 07:49:03 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05B322CD for ; Tue, 3 Jan 2023 04:49:01 -0800 (PST) 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=ZaHND2LIe18ZX8Nyvi0cT4E76kdV89XTyg9t2stIFjg=; b=polUZinCdMNuV/UaKXheRK93sZ d6ZFz+UxhFc6r61eswtpUQvRK2jURTG2CY/1OlT0lcAaHFTyi1SDOLCfTznUJH0QTXAy2S3auA4Sp CYlQPrC4jgaA3BphQ7sKzzk1RCI6MIsT7/YyoPDZT1VwFZ7HfUpl0HEaCDL5yeV+oV3aknzMULVPj v9Rj4s+54EchY3T0JT4ejh5vx4qqI3hvqq6GscqbCJBvQOZB3jGbcCGgt2D6ZQZy6vA8q/i+J2/iV hEnNI0aad8ymva0lEbd731lhyF84uhM10rnrlmFSoOV4dX+PAHzsWN0gyBkLS9BM8Bj2iABC6z+7s mJsemxlA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35928) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pCgiw-0005Ic-Dw; Tue, 03 Jan 2023 12:48:58 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pCgis-00024q-Uk; Tue, 03 Jan 2023 12:48:54 +0000 Date: Tue, 3 Jan 2023 12:48:54 +0000 From: "Russell King (Oracle)" To: Srinivas Kandagatla Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Hector Martin Subject: Re: [PATCH] nvmem: fix registration vs use race Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 03, 2023 at 12:42:49PM +0000, Srinivas Kandagatla wrote: > > > On 03/01/2023 11:46, Russell King (Oracle) wrote: > > On Tue, Jan 03, 2023 at 11:30:36AM +0000, Srinivas Kandagatla wrote: > > > > > > > > > On 03/01/2023 09:42, Russell King (Oracle) wrote: > > > > The i.MX6 CPU frequency driver sometimes fails to register at boot time > > > > due to nvmem_cell_read_u32() sporadically returning -ENOENT. > > > > > > > > This happens because there is a window where __nvmem_device_get() in > > > > of_nvmem_cell_get() is able to return the nvmem device, but as cells > > > > have been setup, nvmem_find_cell_entry_by_node() returns NULL. > > > > > > > > The occurs because the nvmem core registration code violates one of the > > > > fundamental principles of kernel programming: do not publish data > > > > structures before their setup is complete. > > > > > > > > Fix this by making nvmem core code conform with this principle. > > > > > > > how about a Fixes tag and Cc stable? > > > > Which commit do you suggest? This error goes all the way back to the > > inception of nvmem, commit > > > > eace75cfdcf7 ("nvmem: Add a simple NVMEM framework for nvmem providers") > > > > but clearly its going to be a lot of effort to backport it all the > > way due to all the changes. > > I understand the backport issue, On the other hand as this a real issue > backporting to atleast stable kernels would be worth. I'll add this commit as a fixes tag, but I don't have the ability to test backports of this, since the use of nvmem on imx6 platforms is relatively recent. How do you suggest we end up with tested backports for stable trees? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!