All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: David Daney <david.daney@cavium.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	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: Wed, 12 Oct 2011 22:19:31 -0600	[thread overview]
Message-ID: <20111013041931.GH15829@ponder.secretlab.ca> (raw)
In-Reply-To: <4E94B01D.2050402@cavium.com>

On Tue, Oct 11, 2011 at 02:07:41PM -0700, David Daney wrote:
> On 10/11/2011 01:47 PM, Andrew Morton wrote:
> >On Thu, 22 Sep 2011 12:51:23 -0600
> >Grant Likely<grant.likely@secretlab.ca>  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.
> >
> >What happens is there is a circular dependency, or if a driver's
> >preconditions are never met?  AFAICT the code keeps running the probe
> >function for ever.
> >
> 
> The deferred probe functions are only run once per (other) driver
> binding event.  So once you quit registering new drivers, no further
> probing is done.  There is no endless loop happening here.
> 
> If the preconditions are never met, the driver will just sit in the
> list waiting.

Plus, as an optimization, walking the deferred list doesn't begin
until late initcall time so that the first pass over the device
drivers proceeds completely before starting retries.

> >If so: bad.  The kernel should detect such situations, should
> >exhaustively report them and if possible, fix them up and struggle
> >onwards.

The kernel won't get stalled on deferred probe.  It may end up with
stale devices in the deferred list, but that only means those
particular devices won't get bound to a driver.  It isn't fatal.

> I don't think we should actively report anything, but being able to
> inspect the deferred probe list from user space might be useful for
> diagnosing problems

Well, we could dump out the remaining deferred devices in sysfs.
Alternately the kernel could dump them out to the console log after
userspace starts.  That would catch conditions where built-in drivers
aren't able to initialize their devices.

g.

WARNING: multiple messages have this Message-ID (diff)
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v3] drivercore: Add driver probe deferral mechanism
Date: Wed, 12 Oct 2011 22:19:31 -0600	[thread overview]
Message-ID: <20111013041931.GH15829@ponder.secretlab.ca> (raw)
In-Reply-To: <4E94B01D.2050402@cavium.com>

On Tue, Oct 11, 2011 at 02:07:41PM -0700, David Daney wrote:
> On 10/11/2011 01:47 PM, Andrew Morton wrote:
> >On Thu, 22 Sep 2011 12:51:23 -0600
> >Grant Likely<grant.likely@secretlab.ca>  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.
> >
> >What happens is there is a circular dependency, or if a driver's
> >preconditions are never met?  AFAICT the code keeps running the probe
> >function for ever.
> >
> 
> The deferred probe functions are only run once per (other) driver
> binding event.  So once you quit registering new drivers, no further
> probing is done.  There is no endless loop happening here.
> 
> If the preconditions are never met, the driver will just sit in the
> list waiting.

Plus, as an optimization, walking the deferred list doesn't begin
until late initcall time so that the first pass over the device
drivers proceeds completely before starting retries.

> >If so: bad.  The kernel should detect such situations, should
> >exhaustively report them and if possible, fix them up and struggle
> >onwards.

The kernel won't get stalled on deferred probe.  It may end up with
stale devices in the deferred list, but that only means those
particular devices won't get bound to a driver.  It isn't fatal.

> I don't think we should actively report anything, but being able to
> inspect the deferred probe list from user space might be useful for
> diagnosing problems

Well, we could dump out the remaining deferred devices in sysfs.
Alternately the kernel could dump them out to the console log after
userspace starts.  That would catch conditions where built-in drivers
aren't able to initialize their devices.

g.

  reply	other threads:[~2011-10-13  4:19 UTC|newest]

Thread overview: 63+ 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:51 ` Grant Likely
2011-09-22 18:58 ` Joe Perches
2011-09-22 18:58   ` Joe Perches
2011-09-22 19:28 ` David Daney
2011-09-22 20:29 ` Alan Cox
2011-09-22 20:29   ` Alan Cox
2011-09-22 21:19   ` Grant Likely
2011-09-22 21:19     ` Grant Likely
2011-09-23 17:50     ` Valdis.Kletnieks
2011-09-23 17:50       ` Valdis.Kletnieks at vt.edu
2011-09-23 23:18       ` Grant Likely
2011-09-23 23:18         ` Grant Likely
2011-09-22 21:19   ` David Daney
2011-09-22 22:47     ` Alan Cox
2011-09-22 22:47       ` Alan Cox
2011-09-23  5:02       ` Grant Likely
2011-09-23  5:02         ` Grant Likely
2011-09-23 16:55       ` David Daney
2011-09-23 16:55         ` David Daney
2011-09-26 14:16 ` Mark Brown
2011-09-26 14:16   ` Mark Brown
2011-09-26 15:12   ` Russell King - ARM Linux
2011-09-26 15:12     ` Russell King - ARM Linux
2011-09-26 15:26     ` Mark Brown
2011-09-26 15:26       ` Mark Brown
2011-09-26 15:48       ` Grant Likely
2011-09-26 15:48         ` Grant Likely
2011-09-27 13:50         ` Arnd Bergmann
2011-09-27 13:50           ` Arnd Bergmann
2011-09-27 21:08           ` Grant Likely
2011-09-27 21:08             ` Grant Likely
2011-09-27 22:13             ` Mark Brown
2011-09-27 22:13               ` Mark Brown
2011-09-28 13:04               ` Arnd Bergmann
2011-09-28 13:04                 ` Arnd Bergmann
2011-09-28 13:20                 ` Mark Brown
2011-09-28 13:20                   ` Mark Brown
2011-09-28 23:14               ` Grant Likely
2011-09-28 23:14                 ` Grant Likely
2011-09-29 11:00                 ` Mark Brown
2011-09-29 11:00                   ` Mark Brown
2011-10-03 23:02 ` Kevin Hilman
2011-10-03 23:02   ` Kevin Hilman
2011-10-04 15:52   ` Grant Likely
2011-10-04 15:52     ` Grant Likely
2011-10-04 14:51 ` G, Manjunath Kondaiah
2011-10-04 14:51   ` G, Manjunath Kondaiah
2011-10-04 14:51   ` G, Manjunath Kondaiah
2011-10-04 15:58   ` Grant Likely
2011-10-04 15:58     ` Grant Likely
2011-10-04 15:58     ` Grant Likely
2011-10-04 18:35     ` G, Manjunath Kondaiah
2011-10-04 18:35       ` G, Manjunath Kondaiah
2011-10-04 23:35       ` Grant Likely
2011-10-04 23:35         ` Grant Likely
2011-10-07  3:31         ` G, Manjunath Kondaiah
2011-10-07  3:31           ` G, Manjunath Kondaiah
2011-10-11 20:47 ` Andrew Morton
2011-10-11 20:47   ` Andrew Morton
2011-10-11 21:07   ` David Daney
2011-10-13  4:19     ` Grant Likely [this message]
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=20111013041931.GH15829@ponder.secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=david.daney@cavium.com \
    --cc=dilee@nvidia.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.