Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp697004rdg; Wed, 11 Oct 2023 03:02:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSuyBpJ18/YRUkFkcXpucyhxa14HMv7V+8HPQzQTR4ajX7uCBQc5394KrK09m7ywIt4Ieg X-Received: by 2002:a05:6a00:2295:b0:692:7527:c2d0 with SMTP id f21-20020a056a00229500b006927527c2d0mr21725046pfe.32.1697018576803; Wed, 11 Oct 2023 03:02:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697018576; cv=none; d=google.com; s=arc-20160816; b=pgzFnreazqgs0eMHtu0KPUdxE5mA6Eh6PL9Rl1NrGHiiVc2Ly/4guL3VkP27uti+Nl 32SZ2/PCHn1QU78B1PfQAHPAzpp8FfRJLJGan8WZzg34BuOZgJ3hOOgN6RH8E+Yiq9zB rqbvn3ayyRcXWhKbF6Qu1nEmvly3Dx0qPV+D/rFmEEj8ICooY32ntlyMQvgHolCy0HdK lUYa9WYAIPH4SoBYUkSZpRsoUMUs13SnDae2Jhtd5ssf9ko/77xv1g4OL754QQvdhAhH T5uOXyAH8p6oBai7TQVUSDOnWeOPjrCE+i8KXsQXjy0euKrLDuh2jmuKod7EX3JkFhxu Vr0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=tHhJzEAtVv4Lc1vGFKwITVWu0tLpIxpO6P/2yTlamv0=; fh=KJN1W9yOAWgSq9zfQBni89+CfhmDFnjhsEeQmYNtQrw=; b=cu5YNNE8JdTPocSpaIAbRxlCVhRgz58zQ32eXmXPrexLdkRFWRH/sb2KhSse+kBD+8 svmZYT8bSh3ZSb7e8MevARkAhq3xevf61ghuP+2g2b3q7d0dXHDxyKzKkTVhvLrjel9R KqJtTbPsDjlgcpNdbkgbnFKTHKedXe6v1PKNr74lNueha2KVQi2bIAhMn0V11eQNp5U5 DfsqFNMY3Q2AoeJS0RBFf3mNnl7XEzJzomJWHdw0oRfvaTHccEI6kbzThPJtd4oIS4Ou eU45+0F7cyImv/yl9IMQdIMXGkYi0VMMGdCsltVDh+DqMLzqVxNC9lKcbJnXGd22+krE xupA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DYOLI4pX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id e70-20020a636949000000b0057d08dac75csi13448608pgc.517.2023.10.11.03.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 03:02:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DYOLI4pX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 15885803C5CF; Wed, 11 Oct 2023 03:02:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231407AbjJKKCk (ORCPT + 99 others); Wed, 11 Oct 2023 06:02:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231438AbjJKKCe (ORCPT ); Wed, 11 Oct 2023 06:02:34 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07041A4 for ; Wed, 11 Oct 2023 03:02:31 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32615eaa312so6025435f8f.2 for ; Wed, 11 Oct 2023 03:02:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697018550; x=1697623350; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=tHhJzEAtVv4Lc1vGFKwITVWu0tLpIxpO6P/2yTlamv0=; b=DYOLI4pXf22Odd/+v/jgz5rSdsS9BKHowIfG0QJNCiglZ7AQI91vLO6kOf/rKj3Rp3 3bn/fRy3Jui+I0ZitJ+4ZHN1es0YiczBJ9bWL6oTR5BtYs9VoGqZ6/xgTqOgZxq6VMze RRh7HxS6C0Rhj+7FV9j4C4tOKxGGuheova9LFBYdrF+BVj9/xQKAx3XwK7igwZKD5SX1 eaGhskwDH1o1iIdW4gLrEaDYROBqE/r340k28ut/WQKqQoKtBNIl2XYLiJN/mqdWyxfO ihIHWqwWfr4lmbUKkVHN4T8/yMOJ70Tdb12lsOB0xjAtCVrGWJ3yf0BhaDkBaO1M/6Nm tGig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697018550; x=1697623350; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tHhJzEAtVv4Lc1vGFKwITVWu0tLpIxpO6P/2yTlamv0=; b=T44nubVqML4kRk+Cn24T/zf/3diZlaegcRCXlArhJIMukwGyU21Q6uLJhInLl5Qpk1 5EAraExP8gXw3bYXIdd9dqsjmUjytYpOaXJkAHB8U6rSmT1hiwRfDN47fwtFaNgY3BLo uaRMsTgSi4Aic9phiEMCSUX8v1Acrtp0v4+LmqPjHNALxZ2J8zTCg/Lr5YfVTHmMaCGw xDXreZAwq+F4eITwv0tk4qF2xxwKYo1dFQt/PzvSnbs1sIPoOce7bfu1g2ebf9CZwDDp xrSS1NecESm2g0pkWS0BqoccyzVMnivpALnkmQjBN+PznjsUB3d58kQonqCdzs/GAaXd JabA== X-Gm-Message-State: AOJu0Yyjklq0h4sD2OnZggyLcvBlNqaJYDfv+Cm9x6Zwv9x+pSjCOAIO KqHbprfmajIjg8+tSHnRVmxteA== X-Received: by 2002:a5d:56ca:0:b0:319:6e74:1637 with SMTP id m10-20020a5d56ca000000b003196e741637mr17326999wrw.27.1697018550317; Wed, 11 Oct 2023 03:02:30 -0700 (PDT) Received: from [192.168.86.24] ([5.133.47.210]) by smtp.googlemail.com with ESMTPSA id c17-20020a056000105100b003231ca246b6sm15055179wrx.95.2023.10.11.03.02.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Oct 2023 03:02:29 -0700 (PDT) Message-ID: <04112100-026c-b010-6e8c-730049d43e47@linaro.org> Date: Wed, 11 Oct 2023 11:02:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v12 5/7] nvmem: core: Rework layouts to become regular devices Content-Language: en-US To: Miquel Raynal Cc: Greg Kroah-Hartman , Michael Walle , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Marko , Thomas Petazzoni , Luka Perkov , Randy Dunlap , Chen-Yu Tsai , Daniel Golle References: <20231005155907.2701706-1-miquel.raynal@bootlin.com> <20231005155907.2701706-6-miquel.raynal@bootlin.com> <20231011093843.49831a75@xps-13> From: Srinivas Kandagatla In-Reply-To: <20231011093843.49831a75@xps-13> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 03:02:54 -0700 (PDT) Hi Miquel, On 11/10/2023 08:38, Miquel Raynal wrote: > Hi Srinivas, > > srinivas.kandagatla@linaro.org wrote on Mon, 9 Oct 2023 10:44:45 +0100: > >> On 05/10/2023 16:59, Miquel Raynal wrote: >>> Current layout support was initially written without modules support in >>> mind. When the requirement for module support rose, the existing base >>> was improved to adopt modularization support, but kind of a design flaw >>> was introduced. With the existing implementation, when a storage device >>> registers into NVMEM, the core tries to hook a layout (if any) and >>> populates its cells immediately. This means, if the hardware description >>> expects a layout to be hooked up, but no driver was provided for that, >>> the storage medium will fail to probe and try later from >>> scratch. Technically, the layouts are more like a "plus" and, even we >> >> This is not true, As layouts are kind of resources for nvmem providers, Ideally the provider driver should defer if there is no matching layout available. > > That is not possible as layouts are now devices, the device will be > populated but you cannot know when it will be actually probed? > >> Expressing this as a weak dependency is going to be an issue, >> >> 1. With creating the sysfs entries and user notifications > > For me, this is not an issue. Greg? > >> 2. nvmem consumers will be in a confused state with provider registered but without cells added yet. > > Wow, I feel like we are moving backwards. > > Consumers don't know about the nvmem devices, they just care about a > cell. If the cell isn't there, the consumer decides what it wants > to do with that. > > We initially discussed that we would not EPROBE_DEFER if the layouts > were not yet available because the NVMEM device may be created from a > device that is the main storage and while you don't have your rootfs, Does it not sound like we are not expressing the dependencies between nvmem provider and layout drivers correctly? > you don't have access to your modules. And anyway it's probably a bad > idea to allow endless probe deferrals on your main storage device. > > If the cells are not available at that time, it's not a huge deal? The > consumers will have to wait a bit more (or take any other action, this > is device dependent). In this case the nvmem consumers will get an -ENOENT error, which is very confusing TBH. thanks, Srini > >> --srini >>> consider that the hardware description shall be correct, we could still >>> probe the storage device (especially if it contains the rootfs). >>> >>> One way to overcome this situation is to consider the layouts as >>> devices, and leverage the existing notifier mechanism. When a new NVMEM >>> device is registered, we can: >>> - populate its nvmem-layout child, if any >>> - try to modprobe the relevant driver, if relevant >>> - try to hook the NVMEM device with a layout in the notifier >>> And when a new layout is registered: >>> - try to hook all the existing NVMEM devices which are not yet hooked to >>> a layout with the new layout >>> This way, there is no strong order to enforce, any NVMEM device creation >>> or NVMEM layout driver insertion will be observed as a new event which >>> may lead to the creation of additional cells, without disturbing the >>> probes with costly (and sometimes endless) deferrals. >>> >>> In order to achieve that goal we need: >>> * To keep track of all nvmem devices >>> * To create a new bus for the nvmem-layouts with minimal logic to match >>> nvmem-layout devices with nvmem-layout drivers. >>> All this infrastructure code is created in the layouts.c file. >>> >>> Signed-off-by: Miquel Raynal >>> Tested-by: Rafał Miłecki >>> --- > > Thanks, > Miquèl