From: David Daney <david.daney@cavium.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Greg Kroah-Hartman <greg@kroah.com>, Dilan Lee <dilee@nvidia.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Manjunath GKondaiah <manjunath.gkondaiah@linaro.org>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [RFC PATCH v3] drivercore: Add driver probe deferral mechanism
Date: Thu, 22 Sep 2011 12:28:40 -0700 [thread overview]
Message-ID: <4E7B8C68.2050906@cavium.com> (raw)
In-Reply-To: <20110922184614.25419.84606.stgit@ponder>
Thanks Grant, This is sorely needed.
On 09/22/2011 11:51 AM, Grant Likely wrote:
> Allow drivers to report at probe time that they cannot get all the resources
> required by the device, and should be retried at a later time.
>
> This should completely solve the problem of getting devices
> initialized in the right order. Right now this is mostly handled by
> mucking about with initcall ordering which is a complete hack, and
> doesn't even remotely handle the case where device drivers are in
> modules. This approach completely sidesteps the issues by allowing
> driver registration to occur in any order, and any driver can request
> to be retried after a few more other drivers get probed.
>
> v3: - Hold off workqueue scheduling until late_initcall so that the bulk
> of driver probes are complete before we start retrying deferred devices.
> - Tested with simple use cases. Still needs more testing though.
> Using it to get rid of the gpio early_initcall madness, or to replace
> the ASoC internal probe deferral code would be ideal.
> v2: - added locking so it should no longer be utterly broken in that regard
> - remove device from deferred list at device_del time.
> - Still completely untested with any real use case, but has been
> boot tested.
>
> TODO: - Create a separate singlethread_workqueue so that drivers can't
> mess things up by calling flush_work().
> - Maybe this should be wrapped with a kconfig symbol so it can
> be compiled out on systems that don't care.
>
> Signed-off-by: Grant Likely<grant.likely@secretlab.ca>
> Cc: Greg Kroah-Hartman<greg@kroah.com>
> Cc: Mark Brown<broonie@opensource.wolfsonmicro.com>
> Cc: Arnd Bergmann<arnd@arndb.de>
> Cc: Dilan Lee<dilee@nvidia.com>
> Cc: Manjunath GKondaiah<manjunath.gkondaiah@linaro.org>
FWIW:
Acked-by: David Daney <david.daney@cavium.com>
> ---
>
> Hi Manjunath,
>
> Here's the current state of the patch. The major think that needs to
> be done is to convert it to use a separate workqueue as described in
> the TODO above. It also needs some users adapted to it. One of the
> gpio drivers would work; preferably one of the newer drivers that
> doesn't have a lot of drivers depending on the early_initcall()
> behaviour yet.
>
> Mark Brown may also be able to suggest specific examples.
>
I know I have an example:
My MDIO and I2C bus multiplexer patches are not yet merged, but they are
relevant to this.
Consider a Ethernet device driver, it needs to communicate with PHY
devices and its driver cannot be be initialized until the PHY drivers
have been initialized.
However these PHYs are on an multiplexed MDIO bus controlled by GPIO
pins. We cannot initialize the PHY drivers until the MDIO bus is
initialized.
Wait there is more... The GPIO pins controlling the MDIO bus
multiplexer are on an I2C controlled GPIO expander and cannot be used
until the I2C system is up and the drivers initialized.
So we have this driver initialization dependency:
Ethernet driver -> PHY/MDIO -> GPIO/I2C
We cannot really have a static initialization order because the
relationships are board dependent and there are more levels than can be
achieved with *_initcall(). On some boards the PHYs are directly
connected so there is no multiplexer. On others there is a MDIO
multiplexer, but it is controlled by GPIO pins on the SOC and are thus
available when the GPIO subsystem is up rather than I2C.
Without something like this patch, we have a house of cards just waiting
to collapse.
> For everyone else; this is the current state of the patch. I think it
> is in pretty good shape other than the TODO item above. I'm turning
> it over to Manjunath to polish up for merging. I would appreciate
> any feedback.
>
> g.
>
>
> drivers/base/base.h | 1
> drivers/base/core.c | 2 +
> drivers/base/dd.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/device.h | 5 ++
> 4 files changed, 141 insertions(+), 1 deletions(-)
[...]
next prev parent reply other threads:[~2011-09-22 19:28 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-22 18:51 [RFC PATCH v3] drivercore: Add driver probe deferral mechanism Grant Likely
2011-09-22 18:58 ` Joe Perches
2011-09-22 19:28 ` David Daney [this message]
2011-09-22 20:29 ` Alan Cox
2011-09-22 21:19 ` Grant Likely
2011-09-23 17:50 ` Valdis.Kletnieks
2011-09-23 23:18 ` Grant Likely
2011-09-22 21:19 ` David Daney
2011-09-22 22:47 ` Alan Cox
2011-09-23 5:02 ` Grant Likely
2011-09-23 16:55 ` David Daney
2011-09-26 14:16 ` Mark Brown
2011-09-26 15:12 ` Russell King - ARM Linux
2011-09-26 15:26 ` Mark Brown
2011-09-26 15:48 ` Grant Likely
2011-09-27 13:50 ` Arnd Bergmann
2011-09-27 21:08 ` Grant Likely
2011-09-27 22:13 ` Mark Brown
2011-09-28 13:04 ` Arnd Bergmann
2011-09-28 13:20 ` Mark Brown
2011-09-28 23:14 ` Grant Likely
2011-09-29 11:00 ` Mark Brown
2011-10-03 23:02 ` Kevin Hilman
2011-10-04 15:52 ` Grant Likely
2011-10-04 14:51 ` G, Manjunath Kondaiah
2011-10-04 15:58 ` Grant Likely
2011-10-04 18:35 ` G, Manjunath Kondaiah
2011-10-04 23:35 ` Grant Likely
2011-10-07 3:31 ` G, Manjunath Kondaiah
2011-10-11 20:47 ` Andrew Morton
2011-10-11 21:07 ` David Daney
2011-10-13 4:19 ` Grant Likely
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=4E7B8C68.2050906@cavium.com \
--to=david.daney@cavium.com \
--cc=arnd@arndb.de \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dilee@nvidia.com \
--cc=grant.likely@secretlab.ca \
--cc=greg@kroah.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manjunath.gkondaiah@linaro.org \
/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