Subject: Re: Request for comments: let config(1) generate LKMs
To: Hiroyuki Bessho <>
From: Bill Stouder-Studenmund <>
List: tech-toolchain
Date: 09/18/2007 13:21:11
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Sep 14, 2007 at 12:21:45AM +0900, Hiroyuki Bessho wrote:
> Thank you for the comment.
> At Thu, 13 Sep 2007 13:17:55 +0200,
> Juan RP wrote:
> >=20
> > On Thu, 13 Sep 2007 18:55:32 +0900 (JST)
> > Hiroyuki Bessho <> wrote:
> >=20
> >=20
> > The only problem is how to build different LKMs for the same driver,
> > but with different locators (I/O port, IRQ, etc).
> >=20
> > On drivers where a different I/O port can be used, the driver itself mi=
> > have to probe them before the final attach (something like nsclpcsio(4)
> > currently does), to avoid multiple different modules, e.g:
> >=20
> > module it0 	at isa? port 0x290
> > module it1 	at isa? port 0xc00
> > module it2 	at isa? port 0xd00
> >=20
> > What do you think? what's the best option to fix all this crap?
> >=20
>   In the case above, device instances it[012] go to module it.o, along
> with codes related to it and it_isa.  When it.o is loaded, 0x290 is
> probed and it0 is attached if it exists, and same for 0xc00 and 0xd00.

I think a better solution is to conceptualize locators as independent of=20
the code in the module. We code them into the kernel now both because=20
we've always done that and because it's the easiest way to do it in a=20
monolithic blob.

For LKMs, however, I think it's better to have the code and have a plist=20
that includes the locators.

>   I think we can allow users to say
> module       ne0	at isa? port 0x280 irq 9
> module "nex" ne1	at isa? port 0x290 irq 10
> module "nex" ne2	at isa? port 0x300 irq 11
>   In this case, module ne.o has ne and ne_isa driver codes and a
> device instance ne0. Module nex.o will have only config(9) glue staff
> to probe port 0x290 and 0x300 and attach ne1 and/or ne2 because ne and
> ne_isa related codes are in module ne.o.  I'm not 100% sure this works
> yet, but I guess that allowing users to specify module name for
> devices will provide good way for some configuration.  And if it
> works, config(1) can detect that module nex.o depends on module ne.o
> and can submit some useful information.

Why would we want to support this option? I don't see the benefit to=20
making something like the "nex" module.

>   And I know there can be some issues with
> ne*	at mca? slot ?
> module	"ne_isa"    ne0 at isa? port 0x280 irq 9
> module  "ne_pcmcia" ne* at pcmcia? function ?
>   In this case, ne driver is in the kernel, so ne_isa.o has ne_isa
> attachment codes, and ne_pcmcia.o has ne_pcmcia codes.  The problem is
> that both ne_isa and ne_pcmcia require the attribute rtl80x9.  If we
> compile rtl80x9 related codes into both ne_isa and ne_pcmcia, we can't
> load both modules at the same time.  If we compile rtl80x9 only into
> ne_isa.o, ne_pcmcia.o depends on ne_isa.o, which doesn't look very
> nice.  The solution I can think of for now is
>   a) allow users to say
>       module rtl80x9
>      to tell independent module for the attribute rtl80x9 and don't
>      compile it into ne_isa.o or ne_pcmcia.o.  Without "module
>       rtl80x9", rtl80x9 related codes is compiled into ne_isa.o.
>   b) config(1) implicitly generate rtl80x9.o.
>   I believe if we go further we'll encounter many cases to solve like
> this, and we need to define good rules how `module' keyword works in
> config(5).

Option (b). Even if it means some config changes to standard defintion=20

Right now, users don't have to include anything to make ne @ isa or ne @
pcmcia work. No special commands regarding rtl80x9.o It happens as a
result of including things that need it.

I see no reason why adding module support should change that, and a lot of=
reasons why it shouldn't. :-)

I think a good rule is:

a) If nothing depends on the attribute, leave it out.

b) If something hard-coded into the kernel depends on the attribute, build=
it into the kernel. Also mark it as present for whatever dependency system=
we come up with.

c) if modules depend on the attribute and nothing hard coded into the=20
kernel does (i.e. we aren't also in case (b)), make a module. And note all=
the dependencies.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.7 (NetBSD)