Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11723267rwl; Tue, 3 Jan 2023 03:55:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXtZwCzq/3cAe81GN3N2WvwMFjed3d7rIkgCPRb66YpFNignSz+IFpUaExZQbKZoZELVC2gW X-Received: by 2002:a17:906:9f07:b0:7ec:27d7:1838 with SMTP id fy7-20020a1709069f0700b007ec27d71838mr47181698ejc.22.1672746955159; Tue, 03 Jan 2023 03:55:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672746955; cv=none; d=google.com; s=arc-20160816; b=UhQYCy6LCfPy9k04PWh0NADQ6Iz9p1wqcXS3hR5FWsRtEKCUiwiwm/5PkwsFtRfZGj IKXDSth32b+nd80i4xtNL/q5WaOA9qf2/ZSk62wTv0kvTdRJ16EmQYrRr9N31MtP9b9A G4+XWeYIPQEOGDlo1jQY7omA5IAtfWYOoxyaLP/8XV6nPV596IJomIKhACaOiRQ6TMyk FzoxilrydLe94qaLk3as00qKXbqYws+7ukhFW3LpaNrqJmAHouw773ZEPaaFAevCzyOW FLJ64780GbO/8JZetjHLieLl3z4Ato1+HaK3+UsdZbMl6EbsRUZ8nr5n4V8JUQbJ7XD1 jumA== 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=zbzYgDF4K+r+TpM4DRrnLWpGsS46VZmZwN2Hl2Ix+Gk=; b=mmI4HxkrzT0Pg+r6txJ8v2dY4bKB7TpopM9q1GTt8fPWoq6lZHc3xh+GmfSR21JX5L 2rBbe85HTsulZ4bqZnRfF5SA8uf55YpkV7GqO4NnXLUhhTEpGMZ5WeiYZI5CmIEBkqpN 2GI5EhKUVOAfs4rIWFbg4RGtIGqdqdvygYlQLXbSMyXH3lK8Q7wubXcIbJrpxHj0PrAN ORHWDYzKRLRyjkMSr0bxG2H/cCCAdA8QrCW23qD/gnN2XuVE4084Bo/QmpkeDGzNwLLx XMqHEeFQnySem+shOsufkZ4Mu61RFm99qxewxbua/OEWzRu3rqRHzKDs+AYLQAVVS/oX mwYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=HeVwX6+P; 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 xh9-20020a170906da8900b0084c47845c30si23314898ejb.779.2023.01.03.03.55.40; Tue, 03 Jan 2023 03:55:55 -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=HeVwX6+P; 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 S230193AbjACLq0 (ORCPT + 60 others); Tue, 3 Jan 2023 06:46:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236963AbjACLqW (ORCPT ); Tue, 3 Jan 2023 06:46:22 -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 B5823E7 for ; Tue, 3 Jan 2023 03:46:20 -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=zbzYgDF4K+r+TpM4DRrnLWpGsS46VZmZwN2Hl2Ix+Gk=; b=HeVwX6+PGa+Ddj1+IYOEjcaQYg ytPGw7kbv7HCjYSjqtlGJQAdxwjiQsCTzxaocv0mx122FyLuABGQNVAlERzXj1AQgIdEjIg1MCItn KdiyyHoUml1hQnDgiwCNsm8PLED0JmZDNKqm1SuxAMrqrZkSYS2LIKba1jKnIiTV1dI1lhsHM6d+1 MjBXI8EhuIuhDx35MJVYJRYlKKGdZ6aDN7c04Qm5gxEAU66cvb8W9wHNJDvUk/YyTX2aDxfjf19+T 6nspgoPOgpBRU86Fl8pyd/Rwo0x05UWJ1TFgIdmcLfVoQxRj9BOGznnACGeMgEaxdmlA6giwah/UQ 9mzouETw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35924) 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 1pCfkH-0005GS-Sg; Tue, 03 Jan 2023 11:46:17 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pCfkF-00022U-Qd; Tue, 03 Jan 2023 11:46:15 +0000 Date: Tue, 3 Jan 2023 11:46:15 +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 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. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!