Subject: Re: A potential step towards modularisation
To: None <cube@cubidou.net>
From: Christoph Hellwig <hch@infradead.org>
List: tech-kern
Date: 02/09/2004 14:50:05
On Mon, Feb 09, 2004 at 02:02:19PM +0100, cube@cubidou.net wrote:
> > 
> > I do not understand what you mean here. Specifically, what means "unless the
> > kernel gets feeded with the probing functions".
> 
> Think "PCI IDs <-> driver" table.  That way the kernel (arguably, the bus driver)
> would know what to load.

That's exactly how bus probing works in Linux.  Each driver registers an
tables IDs it's interested in for further probing with the bus driver.

Of course this doesn't work if the driver is not loaded at all, so you
have a few choices:

(a) always load all drivers by either compiling them statically into the
    kernel or loading all modular drivers
     + no userspace involvement
     - wastes lots of memory

(b) load only the modules you have hardware for
     + doesn't waste memory
     - userspace needs to know what hardware exists
     - requires manual intervention when adding new hardware

(c) kernel does a userspace upcall when new hardware is found
     + doesn't waste memory
     + works fine with later added hardware (even while the kernel
       is running)
     - needs good coordination between kernel and userland.

Option (c) is very popular under Linux these days as the so-called
hotplug model where the kernel calls /sbin/hotplug when the bus driver
detects hardware or sees hardware removals (and a few other events)