From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Saravana Kannan <saravanak@google.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@android.com
Subject: Re: [PATCH v1 0/5] Solve postboot supplier cleanup and optimize probe ordering
Date: Fri, 24 May 2019 07:52:17 +0200 [thread overview]
Message-ID: <20190524055217.GC31664@kroah.com> (raw)
In-Reply-To: <20190524010117.225219-1-saravanak@google.com>
On Thu, May 23, 2019 at 06:01:11PM -0700, 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.
Somewhere in this wall of text you need to say:
MAKES DEVICES BOOT FASTER!
right? :)
So in short, this solves the issue of deferred probing with systems with
loads of modules for platform devices and device tree, in that now you
have a chance to probe devices in the correct order saving loads of busy
loops.
A good thing, I like this, very nice work, all of these are:
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
but odds are I'll take this through my tree, so I'll add my s-o-b then.
But only after the DT people agree on the new entry.
thanks,
greg k-h
next prev parent reply other threads:[~2019-05-24 5:52 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 1:01 [PATCH v1 0/5] Solve postboot supplier cleanup and optimize probe ordering Saravana Kannan
2019-05-24 1:01 ` [PATCH v1 1/5] of/platform: Speed up of_find_device_by_node() Saravana Kannan
2019-05-24 17:56 ` Frank Rowand
2019-05-24 18:17 ` Saravana Kannan
2019-05-24 18:21 ` Saravana Kannan
2019-05-25 0:12 ` Frank Rowand
2019-06-11 14:51 ` Frank Rowand
2019-06-11 20:07 ` Saravana Kannan
2019-05-24 1:01 ` [PATCH v1 2/5] driver core: Add device links support for pending links to suppliers Saravana Kannan
2019-05-24 5:48 ` Greg Kroah-Hartman
2019-05-24 1:01 ` [PATCH v1 3/5] dt-bindings: Add depends-on property Saravana Kannan
2019-05-24 15:01 ` Mark Rutland
2019-05-24 22:09 ` Saravana Kannan
2019-05-24 1:01 ` [PATCH v1 4/5] of/platform: Add functional dependency link from "depends-on" property Saravana Kannan
2019-05-24 1:01 ` [PATCH v1 5/5] driver core: Add sync_state driver/bus callback Saravana Kannan
2019-05-24 5:48 ` Greg Kroah-Hartman
2019-05-24 5:52 ` Greg Kroah-Hartman [this message]
2019-05-25 2:17 ` [PATCH v1 0/5] Solve postboot supplier cleanup and optimize probe ordering Saravana Kannan
2019-05-24 13:04 ` Rob Herring
2019-05-24 21:51 ` Saravana Kannan
2019-05-24 17:49 ` Frank Rowand
2019-05-24 21:53 ` Saravana Kannan
2019-05-25 0:16 ` Frank Rowand
2019-05-25 0:22 ` Frank Rowand
2019-05-25 0:25 ` Frank Rowand
2019-05-25 2:08 ` Saravana Kannan
2019-05-25 1:47 ` Saravana Kannan
2019-05-25 2:40 ` Frank Rowand
2019-05-25 4:04 ` Saravana Kannan
2019-06-11 14:56 ` Frank Rowand
2019-06-11 20:19 ` Saravana Kannan
2019-05-29 20:00 ` Saravana Kannan
2019-05-29 20:02 ` Saravana Kannan
2019-05-31 23:27 ` David Collins
2019-06-10 21:17 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190524055217.GC31664@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=saravanak@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).