Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6781390ybi; Wed, 29 May 2019 13:05:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwB8mPjcF42kWiJ0Yjisg7gJyIvgtq7wyxL4o57mQNqjJnGyLBOOeX7bpWh5+DN3rBkYtzM X-Received: by 2002:a63:e645:: with SMTP id p5mr140368973pgj.4.1559160312065; Wed, 29 May 2019 13:05:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559160312; cv=none; d=google.com; s=arc-20160816; b=HN7E5HfdIKL+Ok4rG4aFcGckJ2TQJJx6iZxw39Yb+jkBcp3exk330GWWadfqdmk1UV gom/9f2f2o4Nrh3kfzNt/EHYHPUsS7nrS6n8F1N2wYiDhT2eNoyQFCcgIDqryPdfz1yX rhQc7h4P1ABuE25Lq9PPIeyghqxsuRKV9v8UdkN/GnuHcu1uoEBirI/GGHAS2pJ8pUsA 1SZJ4E7jE8/Pu434ThMFBoe8W4GK6C6zDYXwj3aWkRE5RmTDWx7TM/Z/gsNbm4Q8YQvO pzevZjX4PI4fAwJiReoK3fYfH13BEvw8ZSgEOAXsI0YnLRiO1Ki24ZydLklxVR3k2srp vlGA== 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=wGYaW+Hbd7AIoyclHFi63uNBzsUxP8AhdA4OguMOUvU=; b=TNEc5wXFOiuSUgAb/DsWyfKmh/po4I96qhjkYJl4yIsEcp/wZeDL5EhbV93PP+dH+b 95YOLRWaSoJ5GEYILHL3uaf1IrUW+DR4N2W9xKriN/c5kn5ZHW/Ug0zuyyMkWsOse9Xp q7G87H5TFd/rTE5DAq4D/aa8qZL2sAfhvWENRJjcaiN7VeLPSGLhgWzTCess6lIOVKD7 7Icow/9BCKHCB5pHnw/wjzjobnMH0F295pMwEdQW9HFlLN5E+xfymZ1Z+Nc+4juKND44 61dYDP18Wl4ZZwkkNx2l9+L9p5KSlriq6Jq8Gwq2rBZRSFBBHL40vKQzlPXJ4vqutb0G ZhZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=B8qh1Ld1; 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 u38si738288pgm.538.2019.05.29.13.04.53; Wed, 29 May 2019 13:05:12 -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=B8qh1Ld1; 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 S1726225AbfE2UDZ (ORCPT + 99 others); Wed, 29 May 2019 16:03:25 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:37707 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725990AbfE2UDZ (ORCPT ); Wed, 29 May 2019 16:03:25 -0400 Received: by mail-oi1-f195.google.com with SMTP id i4so2747127oih.4 for ; Wed, 29 May 2019 13:03:24 -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=wGYaW+Hbd7AIoyclHFi63uNBzsUxP8AhdA4OguMOUvU=; b=B8qh1Ld1yMoWv42IjspSyHyrdNKC/Oak8TrNecsHfG/hEFJqdhKoXaNDznyMAbR8TY JDudaudBS400/nz0t2T89CvhNY7aY48OZ92qeMBJ2L4TrkqBWlsOa7qb8O6EAmyizV/w h5/z2hq1cYpvnFgrT69H3jABNHO1ao+JnuspAqa7ayvj56s9jXAt3TxfO3PU0pVarzNR b3kt9GEmlrh9w000Qg3vprCJNFsmy4fHFQHaTcAXpOPZQwK+uH/mv99EEI5hOTSNfaJE uxLWN2jt7vTQhYuPaCiuJ8fFW6Y8JCBUMdOJppnbQMSCuxX7rGB2slGjawAtJHnDCihn 8D6Q== 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=wGYaW+Hbd7AIoyclHFi63uNBzsUxP8AhdA4OguMOUvU=; b=a9HbtDuf8YTrX98R7QZzqTin6qVSrBBNtta4QJtXtZnThoKezkJOZ15zIR4kq161UH At/x6iYs3xEaWvwRIe4AOUqRxuooH76cjcdSQ+4XYd2egcu8ZNuYU+/RlE+aH8utW+yN Rd4aQkGI4QlAf2iUAdPHiXYC08ukQefz6jpQdrLYhFjEu6k6oyTEyXrVzDoDJF2cedFv 8f6FHQSLK/mSshPgdF4OD1KbZpd8ljCQ8BaPBzHN2hIWanZNOg2kDWlshu4qQpC0XUMu moc4BzVyw5eCA2GFWHKo6u/zcxa+Yzq84NGSQYXNMUjmeZ8aGHdJ+B3ADjqoRwrhCUqE q3bw== X-Gm-Message-State: APjAAAX8QaTEjHOiCAQXtvbjyywI8kU48k7O0WkyHH93K1Wx0O0f46ru BcuJ5r+ZP1+FBqqfMfmCFFXusKwvY2fBWxJHDlYylg== X-Received: by 2002:aca:ec0f:: with SMTP id k15mr21599oih.43.1559160199272; Wed, 29 May 2019 13:03:19 -0700 (PDT) MIME-Version: 1.0 References: <20190524010117.225219-1-saravanak@google.com> In-Reply-To: From: Saravana Kannan Date: Wed, 29 May 2019 13:02:43 -0700 Message-ID: Subject: Re: [PATCH v1 0/5] Solve postboot supplier cleanup and optimize probe ordering To: Rob Herring , Mark Rutland , Greg Kroah-Hartman , "Rafael J. Wysocki" , Frank Rowand Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Android Kernel Team 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 Sending again because email client somehow reverted to HTML. Frank, Rob, Mark, Gentle reminder. I've replied to your emails spread across the different patches in the series. Hoping they address your questions and concerns. Please let me know what you think. Thanks, Saravana On Wed, May 29, 2019 at 1:00 PM Saravana Kannan wrote: > > Frank, Rob, Mark, > > Gentle reminder. I've replied to your emails spread across the different patches in the series. Hoping they address your questions and concerns. Please let me know what you think. > > Thanks, > Saravana > > On Thu, May 23, 2019 at 6:01 PM Saravana Kannan wrote: >> >> Add a generic "depends-on" property that allows specifying mandatory >> functional dependencies between devices. Add device-links after the >> devices are created (but before they are probed) by looking at this >> "depends-on" property. >> >> This property is used instead of existing DT properties that specify >> phandles of other devices (Eg: clocks, pinctrl, regulators, etc). This >> is because not all resources referred to by existing DT properties are >> mandatory functional dependencies. Some devices/drivers might be able >> to operate with reduced functionality when some of the resources >> aren't available. For example, a device could operate in polling mode >> if no IRQ is available, a device could skip doing power management if >> clock or voltage control isn't available and they are left on, etc. >> >> So, adding mandatory functional dependency links between devices by >> looking at referred phandles in DT properties won't work as it would >> prevent probing devices that could be probed. By having an explicit >> depends-on property, we can handle these cases correctly. >> >> Having functional dependencies explicitly called out in DT and >> automatically added before the devices are probed, provides the >> following benefits: >> >> - Optimizes device probe order and avoids the useless work of >> attempting probes of devices that will not probe successfully >> (because their suppliers aren't present or haven't probed yet). >> >> For example, in a commonly available mobile SoC, registering just >> one consumer device's driver at an initcall level earlier than the >> supplier device's driver causes 11 failed probe attempts before the >> consumer device probes successfully. This was with a kernel with all >> the drivers statically compiled in. This problem gets a lot worse if >> all the drivers are loaded as modules without direct symbol >> dependencies. >> >> - Supplier devices like clock providers, regulators providers, etc >> need to keep the resources they provide active and at a particular >> state(s) during boot up even if their current set of consumers don't >> request the resource to be active. This is because the rest of the >> consumers might not have probed yet and turning off the resource >> before all the consumers have probed could lead to a hang or >> undesired user experience. >> >> Some frameworks (Eg: regulator) handle this today by turning off >> "unused" resources at late_initcall_sync and hoping all the devices >> have probed by then. This is not a valid assumption for systems with >> loadable modules. Other frameworks (Eg: clock) just don't handle >> this due to the lack of a clear signal for when they can turn off >> resources. This leads to downstream hacks to handle cases like this >> that can easily be solved in the upstream kernel. >> >> By linking devices before they are probed, we give suppliers a clear >> count of the number of dependent consumers. Once all of the >> consumers are active, the suppliers can turn off the unused >> resources without making assumptions about the number of consumers. >> >> By default we just add device-links to track "driver presence" (probe >> succeeded) of the supplier device. If any other functionality provided >> by device-links are needed, it is left to the consumer/supplier >> devices to change the link when they probe. >> >> >> Saravana Kannan (5): >> of/platform: Speed up of_find_device_by_node() >> driver core: Add device links support for pending links to suppliers >> dt-bindings: Add depends-on property >> of/platform: Add functional dependency link from "depends-on" property >> driver core: Add sync_state driver/bus callback >> >> .../devicetree/bindings/depends-on.txt | 26 +++++ >> drivers/base/core.c | 106 ++++++++++++++++++ >> drivers/of/platform.c | 75 ++++++++++++- >> include/linux/device.h | 24 ++++ >> include/linux/of.h | 3 + >> 5 files changed, 233 insertions(+), 1 deletion(-) >> create mode 100644 Documentation/devicetree/bindings/depends-on.txt >> >> -- >> 2.22.0.rc1.257.g3120a18244-goog >>