Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3347597ybl; Mon, 19 Aug 2019 17:12:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+Ld0HqmiVgdK4L7Md3+cwboyVPCqH4Hgdbd/rEXJz+p0W4QSCgdthKg3jnhQOInVOoE0y X-Received: by 2002:a63:6fcf:: with SMTP id k198mr22204855pgc.276.1566259933780; Mon, 19 Aug 2019 17:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566259933; cv=none; d=google.com; s=arc-20160816; b=REr6vGi7xKPLZpOGHHA6NE4t+BzPHguezB3Ez434m4THjzD6Mydcyfbd3CAEbbRKVV nnwctZxbaHe1EwphfG4doVmkR00K9jMGhT7hTJDcuWWnVRZxjd4KcNlvOX7JpcHSY740 TO1AQ6KRICeqM9wUq+CCU97GHzEjMCCCnVmKmneOxGLDr2mbW6w4S1iqJ0hMZtYJm3eO WeMl6x03gerUs0HD5Eiy99jvLWDjXpgwQqdWUeYiQ0h+7nihgK0xLVUx3/ZSMMRdCGX0 UJeb4j2yFEqxgIvltlyAPc/mnLuNpYvm0lOo5T6+K1hZ2cbi2ywu0QleR7UWgxVkXUdK tZuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bkkChTW0EqV/CgrPH+BbWe/Zt2gMOVq7+GmSUYWaXDE=; b=L8YZJ8YPh2PclXnYiBVXaO41EOeg3ecV7N255M261F/PLLwaB8RMGcNDbIUegJlwvX J8hnLKnQXE4CICA2oOant171xktVOPhuuGuiF9p1TliU9Eoc6+V1x8lKj83lEfYyXZi9 0TwQ7WNDYViumdsgLb+beNLgpRr6oT4udsX+bTUIgjg+0nAYuxPLga4DyRIZGS5MS2L/ fqDQx3km1048hvM03oGVb+oce0KaSF/yNBXD8SqC0p/yA2zNV7Ku6r8dS+DMYbBioshe kATMvr2HI8rGsDYjEUiEuMHgTT8vcm1T+kaPPQhCy3mshVjacrngRT9DuV9U38ztCHg7 KajA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XPpZ1C0n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si11469515pfd.165.2019.08.19.17.11.58; Mon, 19 Aug 2019 17:12:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XPpZ1C0n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728819AbfHTAJq (ORCPT + 99 others); Mon, 19 Aug 2019 20:09:46 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:41768 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728578AbfHTAJp (ORCPT ); Mon, 19 Aug 2019 20:09:45 -0400 Received: by mail-ot1-f67.google.com with SMTP id o101so3387581ota.8 for ; Mon, 19 Aug 2019 17:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bkkChTW0EqV/CgrPH+BbWe/Zt2gMOVq7+GmSUYWaXDE=; b=XPpZ1C0ntJ/QDMGuBSe60QhMfwQdBTtGKgaEfG1T5FoRaHQ7f3StWl6c9eD3CyyFNc ybxTNZf5aC9h/iBz5aLyoJzn43SIzYono7iJkqn4tFCnJ2/xWp9u4lrstgB41o2i1Bh2 FbWaqQKVay3rP3ZfDFERUvIxYi5ptyNa5JGdiYUgxjJwAtSgQl8qmMZKgvKMl3jMURz2 VF8v+EOCUWN8hkhsNVFkkPPD9kS8UfVH+h/4xp+lCY2P1lIjfFMrn5Ko++2cJtQyGQgQ opQr/DKapSrigvn8ikV8YjFscAog7WYEIlpGEpprSsD1jKGtfzP41Z6EAsuebtmgMw6q yt/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bkkChTW0EqV/CgrPH+BbWe/Zt2gMOVq7+GmSUYWaXDE=; b=W2wal61oQ3nGHYgkbPYB+BKxN7Ujau0pLsaX1GnUDIsbgnzuxx1KqjE64Tch8Cmb0z S1hb7dF+PuWtqFAUqtaGNRxMVktRg4VJcCLDcIqH7jUSXb4HrJmDa9iXiAO/jYd3ujo9 DYncsbfOCrMKWA4p5lmn96tSjwj8UuxogL8W+UluXKtQG7LSTSqFAkzZE9D1TsS8+KRQ kRBoJ7trOhGmxfhnUoyoKosnorJ4ADmim7bEEBXZQ84108v9RaYll44F89mpBcqc7VgC 5zFUlsg0KRSmH2bx+xrAxiGgHMHdmm4bomOTY5RrTa6ujv4H0Sny8k1CJlxAQEo4f3ya ay3g== X-Gm-Message-State: APjAAAVjlkWEoBdFOAwTuQZpPFVOWvbnDulTzYIAfOYyxLFouyQhDSGQ ngXXtgLXsg7Vb6hXV653Zq+V72t3a/0y4Ius2s14bw== X-Received: by 2002:a05:6830:1e0f:: with SMTP id s15mr21605580otr.231.1566259784272; Mon, 19 Aug 2019 17:09:44 -0700 (PDT) MIME-Version: 1.0 References: <20190724001100.133423-1-saravanak@google.com> <20190724001100.133423-4-saravanak@google.com> <141d2e16-26cc-1f05-1ac0-6784bab5ae88@gmail.com> <19c99a6e-51c3-68d7-d1d6-640aae754c14@gmail.com> <74931824-f8a1-0435-e00a-5b5cdbe8a8a2@gmail.com> In-Reply-To: <74931824-f8a1-0435-e00a-5b5cdbe8a8a2@gmail.com> From: Saravana Kannan Date: Mon, 19 Aug 2019 17:09:08 -0700 Message-ID: Subject: Re: [PATCH v7 3/7] of/platform: Add functional dependency link from DT bindings To: Frank Rowand Cc: Rob Herring , Mark Rutland , Greg Kroah-Hartman , "Rafael J. Wysocki" , Jonathan Corbet , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML , David Collins , Android Kernel Team , Linux Doc Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 19, 2019 at 2:30 PM Frank Rowand wrote: > > On 8/19/19 1:49 PM, Saravana Kannan wrote: > > On Mon, Aug 19, 2019 at 10:16 AM Frank Rowand wrote: > >> > >> On 8/15/19 6:50 PM, Saravana Kannan wrote: > >>> On Wed, Aug 7, 2019 at 7:06 PM Frank Rowand wrote: > >>>> > >>>> On 7/23/19 5:10 PM, Saravana Kannan wrote: > >>>>> Add device-links after the devices are created (but before they are > >>>>> probed) by looking at common DT bindings like clocks and > >>>>> interconnects. > >> > >> > >> < very big snip (lots of comments that deserve answers) > > >> > >> > >>>> > >>>> /** > >>>> * of_link_property - TODO: > >>>> * dev: > >>>> * con_np: > >>>> * prop: > >>>> * > >>>> * TODO... > >>>> * > >>>> * Any failed attempt to create a link will NOT result in an immediate return. > >>>> * of_link_property() must create all possible links even when one of more > >>>> * attempts to create a link fail. > >>>> > >>>> Why? isn't one failure enough to prevent probing this device? > >>>> Continuing to scan just results in extra work... which will be > >>>> repeated every time device_link_check_waiting_consumers() is called > >>> > >>> Context: > >>> As I said in the cover letter, avoiding unnecessary probes is just one > >>> of the reasons for this patch. The other (arguably more important) > >> > >> Agree that it is more important. > >> > >> > >>> reason for this patch is to make sure suppliers know that they have > >>> consumers that are yet to be probed. That way, suppliers can leave > >>> their resource on AND in the right state if they were left on by the > >>> bootloader. For example, if a clock was left on and at 200 MHz, the > >>> clock provider needs to keep that clock ON and at 200 MHz till all the > >>> consumers are probed. > >>> > >>> Answer: Let's say a consumer device Z has suppliers A, B and C. If the > >>> linking fails at A and you return immediately, then B and C could > >>> probe and then figure that they have no more consumers (they don't see > >>> a link to Z) and turn off their resources. And Z could fail > >>> catastrophically. > >> > >> Then I think that this approach is fatally flawed in the current implementation. > > > > I'm waiting to hear how it is fatally flawed. But maybe this is just a > > misunderstanding of the problem? > > Fatally flawed because it does not handle modules that add a consumer > device when the module is loaded. If you are talking about modules adding child devices of the device they are managing, then that's handled correctly later in the series. If you are talking about modules adding devices that aren't defined in DT, then right, I'm not trying to handle that. The module needs to make sure it keeps the resources needed for new devices it's adding are in the right state or need to add the right device links. > > In the text below, I'm not sure if you mixing up two different things > > or just that your wording it a bit ambiguous. So pardon my nitpick to > > err on the side of clarity. > > Please do nitpick. Clarity is good. > > > > > >> A device can be added by a module that is loaded. > > > > No, in the example I gave, of_platform_default_populate_init() would > > add all 3 of those devices during arch_initcall_sync(). > > The example you gave does not cover all use cases. > > There are modules that add devices when the module is loaded. You can not > ignore systems using such modules. I'll have to agree to disagree on that. While I understand that the design should be good and I'm happy to work on that, you can't insist that a patch series shouldn't be allowed because it's only improving 99% of the cases and leaves the other 1% in the status quo. You are just going to bring the kernel development to a grinding halt. > > > >> In that case the device > >> was not present at late boot when the suppliers may turn off their resources. > > > > In that case, the _drivers_ for those devices aren't present at late > > boot. So that they can't request to keep the resources on for their > > consumer devices. Since there are no consumer requests on resources, > > the suppliers turn off their resources at late boot (since there isn't > > a better location as of today). The sync_state() call back added in a > > subsequent patche in this series will provide the better location. > > And the sync_state() call back will not deal with modules that add consumer > devices when the module is loaded, correct? Depends. If it's just more devices from DT, then it'll be fine. If it's not, then the module needs to take care of the needs of devices it's adding. > > > >> (I am assuming the details since I have not reviewed the patches later in > >> the series that implement this part.) > >> > >> Am I missing something? > > > > I think you are mixing up devices getting added/populated with drivers > > getting loaded as modules? > > Only some modules add devices when they are loaded. But these modules do > exist. Out of the billions of Android devices, how many do you see this happening in? Thanks, Saravana