linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Jamie Lokier <jamie@shareable.org>
Cc: Mike Frysinger <vapier.adi@gmail.com>,
	Mike Rapoport <mike@compulab.co.il>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	ksummit-2009-discuss@lists.linux-foundation.org,
	linux-arch@vger.kernel.org, linux-embedded@vger.kernel.org
Subject: Re: Representing Embedded Architectures at the Kernel Summit
Date: Tue, 16 Jun 2009 15:04:44 -0600	[thread overview]
Message-ID: <fa686aa40906161404x69b473a3ufc3c67fd57abcb21@mail.gmail.com> (raw)
In-Reply-To: <20090616200705.GP11893@shareable.org>

On Tue, Jun 16, 2009 at 2:07 PM, Jamie Lokier<jamie@shareable.org> wrote:
> Grant Likely wrote:
>> On Tue, Jun 16, 2009 at 12:18 PM, Jamie Lokier<jamie@shareable.org> wrote:
>> > Something which lets you specify a dependency in a one-line
>> > MODULE_INIT_PREREQS() macro would be much nicer.
>>
>> That would work for some cases, but a lot of cases the problem is not
>> module init order, but rather driver the probe order.  ie. In the
>> Ethernet case I was working on the mac cannot be opened before the
>> phy_device is registered.  Or another example is GPIOs.  An GPIO
>> driven SPI or MDIO bus cannot be probed before all the devices
>> providing the GPIOs are probed (right now GPIOs are 'special' and
>> probed early, but this is ugly and there is no reason it couldn't be
>> handled within the Linux driver model.
>
> Both of those cases look like a simple module init order problem.
>
> I'm not seeing how it's a probe order problem.  Even if you can probe
> PHYs independently first, how are they going to be bound to the
> ethernet MACs, other than by dodgy defaults?
>
> In any of your examples, is the "modprobe" symbol dependency order
> insufficient, when they are external modules?

In both cases the driver is waiting for a specific instance, but has
no idea which driver will provide that service.

For the Ethernet example:  Both the MAC driver and the MDIO bus driver
are registered independently (say via either the platform bus).  The
MDIO bus driver creates a new mdio_bus instance and registers a
phy_device for each child on the bus.  The pdata for the MAC driver
only contains the address of the phy, but it does not know which
driver handles the MDIO bus and it does not know what driver will
handle the phy.  All the MAC cares about dereferencing the phy address
to get a pointer to the phy_device structure which only works after
the MDIO bus is probed and the correct phy_device is registered..
Module dependencies won't help here because the MAC cannot know what
module to depend against.  Plus, in some cases, the MAC will be used
without a PHY, in which case it cannot depend on any phy modules.

For the GPIO example, same thing.  Something like the i2c-gpio driver
doesn't know anything about which device provides the GPIO signals.
It is only handled GPIO numbers for each signal and it cannot be
probed before all the required GPIOs are registered with the system.
Again module dependencies don't work because the driver doesn't know
which GPIO driver it will get bound against at run time.

> If the problem is simply that "modprobe" can calculate dependencies
> but linked-in modules don't, maybe the solution is to use the symbolic
> dependencies to calculate a linked-in driver initialisation order.
>
> If it's a probe order problem, where there aren't symbolic
> dependencies, then MODULE_PROVIDE("gpio") and MODULE_REQUIRE("gpio")
> or something like that might handle those cases, except for tricky
> ones like a GPIO-driven I2C bus which controls a GPIO chip.

Ugh.... it feels too coarse grained to me.  It solves some of the
problems, but still requires playing dirty tricks for the tricky cases
which scuttles the whole lot.  ie. your i2c GPIO chip example.
Another driver wired to one of those 2nd level GPIOs and using
MODULE_REQUIRE("gpio") would immediately be defeated and would need
some other method to indicate the dependency.  Plus there is the
question when stuff is loaded as modules as to how does the kernel
know when MODULE_PROVIDE("gpio") is complete?  What if I load the gpio
driver after the gpio-i2c driver?  I'd much rather define the
dependency at the resource level, not module level because that is
what the driver is actually needing.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

  parent reply	other threads:[~2009-06-16 21:05 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-02 15:22 Representing Embedded Architectures at the Kernel Summit James Bottomley
2009-06-02 15:22 ` James Bottomley
2009-06-02 17:29 ` Josh Boyer
2009-06-02 17:42   ` James Bottomley
2009-06-02 17:52     ` David VomLehn
2009-06-02 18:25       ` James Bottomley
2009-06-02 18:25         ` James Bottomley
2009-06-02 18:51         ` Josh Boyer
2009-06-02 19:30           ` Tim Bird
2009-06-02 20:37             ` [Ksummit-2009-discuss] " James Bottomley
2009-06-02 20:44               ` Bill Gatliff
2009-06-02 21:34               ` Robert Schwebel
2009-06-02 21:34                 ` Robert Schwebel
2009-06-03  3:35                 ` Greg KH
2009-06-03  0:03               ` David VomLehn
2009-06-03  0:52                 ` Eric W. Biederman
2009-06-03  1:42                 ` Steven Rostedt
2009-06-03  1:42                   ` Steven Rostedt
2009-06-02 22:21   ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-03  6:24     ` [Ksummit-2009-discuss] " Ralf Baechle
2009-06-10 23:13     ` Kumar Gala
2009-06-14  3:48       ` Grant Likely
2009-06-10 23:08   ` Kumar Gala
2009-06-02 17:29 ` Grant Likely
2009-06-02 17:29   ` Grant Likely
2009-06-02 17:45   ` David VomLehn
2009-06-02 17:45     ` David VomLehn
2009-06-02 18:46     ` Grant Likely
2009-06-02 17:48   ` James Bottomley
2009-06-02 17:48     ` James Bottomley
2009-06-03 12:17     ` Mark Brown
2009-06-03 12:17       ` Mark Brown
2009-06-04 18:18     ` Grant Likely
2009-06-04 18:18       ` Grant Likely
2009-06-02 21:10   ` Russell King
2009-06-02 21:16     ` Bill Gatliff
2009-06-02 21:16       ` Bill Gatliff
2009-06-04 20:15       ` Grant Likely
2009-06-04 20:15         ` Grant Likely
2009-06-02 21:18     ` Geert Uytterhoeven
2009-06-02 21:18       ` Geert Uytterhoeven
2009-06-03  7:07       ` [Ksummit-2009-discuss] " Ralf Baechle
2009-06-02 21:40     ` Robert Schwebel
2009-06-02 21:40       ` Robert Schwebel
2009-06-02 21:48       ` Russell King
2009-06-04 20:08     ` Grant Likely
2009-06-04 20:08       ` Grant Likely
     [not found]     ` <3340601010994331832@unknownmsgid>
2009-06-04 20:24       ` Grant Likely
2009-06-04 20:24         ` Grant Likely
2009-06-03  6:53   ` [Ksummit-2009-discuss] " Ralf Baechle
2009-06-03 13:04 ` Catalin Marinas
2009-06-03 14:06   ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-03 14:06     ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-03 16:19   ` James Bottomley
2009-06-03 17:09     ` Russell King
2009-06-03 18:43       ` Andrew Morton
2009-06-03 18:43         ` Andrew Morton
2009-06-03 19:01         ` James Bottomley
2009-06-03 19:01           ` James Bottomley
2009-06-04  3:11         ` David VomLehn (dvomlehn)
2009-06-04  3:24           ` Mike Frysinger
2009-06-04  9:23           ` Mel Gorman
2009-06-04  9:23             ` Mel Gorman
2009-06-03 19:08     ` Catalin Marinas
2009-06-03 19:08       ` Catalin Marinas
2009-06-10  9:42     ` Thomas Petazzoni
2009-06-16  6:42 ` Mike Rapoport
2009-06-16  8:06   ` Mike Frysinger
2009-06-16 12:19     ` [Ksummit-2009-discuss] " Ralf Baechle
2009-06-17  4:26       ` H. Peter Anvin
2009-06-17  4:26         ` H. Peter Anvin
2009-06-17 15:04         ` Ralf Baechle
2009-06-17 17:14           ` H. Peter Anvin
2009-06-16 16:06     ` Grant Likely
2009-06-16 18:18       ` Jamie Lokier
2009-06-16 18:18         ` Jamie Lokier
2009-06-16 19:28         ` Grant Likely
2009-06-16 19:28           ` Grant Likely
2009-06-16 20:07           ` Jamie Lokier
2009-06-16 20:10             ` Marcel Holtmann
2009-06-16 21:04             ` Grant Likely [this message]
2009-06-18  3:05   ` Paul Mundt
2009-06-17 14:31 ` Kumar Gala
2009-06-17 14:31   ` Kumar Gala
2009-06-18  2:51   ` Paul Mundt
2009-06-19  2:59     ` Kumar Gala
2009-06-19  3:00       ` Paul Mundt
2009-06-19  3:00         ` Paul Mundt
2009-06-19  7:53         ` Kumar Gala

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=fa686aa40906161404x69b473a3ufc3c67fd57abcb21@mail.gmail.com \
    --to=grant.likely@secretlab.ca \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=jamie@shareable.org \
    --cc=ksummit-2009-discuss@lists.linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-embedded@vger.kernel.org \
    --cc=mike@compulab.co.il \
    --cc=vapier.adi@gmail.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).