Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11813062rwl; Tue, 3 Jan 2023 05:13:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXtrW3pX8UbIW+dAVPAhOgNJ3ERek0I7Bg8BzleZwFK3hJVP72ngV0Ti1orSqd2k4DRZIJxc X-Received: by 2002:a17:902:d3cc:b0:192:9141:ace5 with SMTP id w12-20020a170902d3cc00b001929141ace5mr25412319plb.13.1672751624744; Tue, 03 Jan 2023 05:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672751624; cv=none; d=google.com; s=arc-20160816; b=rpjSl2j3cZojYk8Vf9E4X5gg/6c7tyipSvZQOgL4I4ht8DBPyPTux7bOB8GaOU/AvX UOt64kJmNc2/Fy5QD0g8YTSbHV7hsLkoUQNWPbRySPMTsGpLsysWQ1JWj3yv8Iwu6S8m SzIrIHJbQrH+TcdiqUP0a4og7Z0uJkHb3S6l5BFE0NkZd+ZVudKW0obFYtBlSvr6yUNl O/bdyaCnKAudLO8o2b9573mIVTStTNJ2TLkqLaLKJQ58Aj0R9GTybUy8QyXbrHCCFY/Q EQbUwK2bTo/u9A8N71qW5bTu34H4Js5LiuymuIM/dmDD/w/ANVSX9OYRx3Ubt1+hsV0Q amSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ZaHND2LIe18ZX8Nyvi0cT4E76kdV89XTyg9t2stIFjg=; b=P7BnO0zQudGsBI/MrZXFNaqwwDyg5QxKYJ/Z05P/JYsAYo2yNaQO/ResjKG00zOmhD 5gtXrzCrmo155GORIgI6P4WSy7v/Azlg6IFspU2haN7oUKz7RtA0FmxV3yGDWaMzwNHJ AjYlauSs1KevhgXTHebtYdfSjukP5Rlj6w8gFv1P8qX4zVHOKxczrHdYcjKVaZH9k3Q7 Ya/U52AHSzJ5VojC4qRUnAVqkChN9+hf0eQ4Dss3dTsMA1TlmfrOlnqzA1aBt9bGR2v9 2BvZjab/+slqBmBKUTiJ8G26UoabE3f38otGSSqyC3fKagX84PYGpswKAlxE0MeEGdae EFsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=polUZinC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r139-20020a632b91000000b0049206a74135si31214258pgr.275.2023.01.03.05.13.36; Tue, 03 Jan 2023 05:13:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=polUZinC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237589AbjACMtF (ORCPT + 60 others); Tue, 3 Jan 2023 07:49:05 -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) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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!