mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Adamson <keith.adamson@attbi.com>
To: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
Cc: Jeff Garzik <jgarzik@mandrakesoft.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Roman Zippel <zippel@linux-m68k.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>,
	torvalds@transmeta.com
Subject: Re: [PATCH] automatic initcalls
Date: 29 Jul 2002 22:49:15 -0400	[thread overview]
Message-ID: <1027997356.9786.38.camel@h00d0700074d1.ne.client2.attbi.com> (raw)
In-Reply-To: <20020729103912.A18765@nightmaster.csn.tu-chemnitz.de>

On Mon, 2002-07-29 at 04:39, Ingo Oeser wrote:
> On Sat, Jul 27, 2002 at 11:51:32PM -0400, Jeff Garzik wrote:
> > I've always preferred a system where one simply lists dependencies [as 
> > you describe above], and some program actually does the hard work of 
> > chasing down all the initcall dependency checking and ordering.
> 
> So we just need to build a directed graph, detect edges without
> existing nodes (someone changed the initcall, we depend on) and
> cycles (someone messed up the ordering) as errors, sort the
> resulting graph toplogically and dump it as a sequence.
> 
> This is no rocket science and we have two tools, which does this
> all for us (make and tsort, which create a warning for both cases).
> 
> The hard part is to CREATE all the dependencies and check and
> double check them with the maintainers.
> 

I definitely agree the easy part is the algorithm and the hard part is
creating the dependency list.  For instance, attached is a small
algorithm that does the initcall sequencing at run time.

The API is is simple, you just register your initcall with a list of
critical initcalls you need to be run before yours (not all, just the
ones you definitely need to be run first).  Then the ordering of the all
the initcalls are sequenced at run time.  This way you don't have to
worry about link ordering or code ordering of your initcalls during
make/compile/link.  All initcall ordering is done during boot.  

This really frees you from module inter-dependencies because is doesn't
mater in what order you register you initcalls.  You only need register
them with a list the critical modules that need to be initialized before
yours.

The API also provides that you can register more than one initcall for
your module with a different set of critical modules that must be run
first.

This should be relative easy to add to the kernel, as you don't have to
modify any of the existing initcalls.  You do need to remove all
existing calls to them and register them instead with the new API.

Untar and "cd init; cc *.c; ./a.out"

Four example modules register their initcalls, "foo1, foo2, foo3, foo4",
and then the main routine sequences them at run time.  

Regards, Keith




  reply	other threads:[~2002-07-30  2:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-27 20:22 Roman Zippel
2002-07-28  3:31 ` Rusty Russell
2002-07-28  3:51   ` Jeff Garzik
2002-07-28  4:47     ` Linus Torvalds
2002-07-28  8:50       ` Keith Adamson
2002-07-28 18:59       ` Oliver Xymoron
2002-07-29 23:39       ` Rusty Russell
2002-07-29  8:39     ` Ingo Oeser
2002-07-30  2:49       ` Keith Adamson [this message]
2002-07-30  2:51         ` Keith Adamson
2002-07-28 12:18   ` Roman Zippel
2002-07-29 23:46     ` Rusty Russell
2002-07-30 23:04       ` [PATCH] automatic module_init ordering Roman Zippel
2002-07-31  2:33         ` Kai Germaschewski
2002-07-31  3:26           ` Rusty Russell
2002-07-31 17:06             ` Kai Germaschewski
2002-07-31 23:28               ` Rusty Russell
2002-07-28 21:59   ` [PATCH] automatic initcalls Kai Germaschewski
2002-07-29 18:56   ` Patrick Mochel
2002-07-29 20:14     ` Roman Zippel

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=1027997356.9786.38.camel@h00d0700074d1.ne.client2.attbi.com \
    --to=keith.adamson@attbi.com \
    --cc=ingo.oeser@informatik.tu-chemnitz.de \
    --cc=jgarzik@mandrakesoft.com \
    --cc=kai@tp1.ruhr-uni-bochum.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@transmeta.com \
    --cc=zippel@linux-m68k.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

all inboxes | Powered by JetHome®