hotplug and modalias handling (WAS: Re: RFD: Rework/extending functionality of mdev)

Isaac Dunham ibid.ag at gmail.com
Fri Mar 20 00:54:21 UTC 2015


On Thu, Mar 19, 2015 at 06:02:33PM -0600, James Bowlin wrote:
> On Wed, Mar 18, 2015 at 02:48 AM, Isaac Dunham said:
> > Is this manifested as "the root device never shows up"?
> 
> Yes, although we call it the boot device.
> 
> > As the one who probably posted this, I can comment further:
> > I've heard of one computer where this was an issue, a couple
> > years ago; a number of people on the Puppy Linux forums were
> > experimenting with mdev, and one reported that the modalias
> > file was missing with a Broadcom wireless card.
> 
> That is interesting.  Do you think this could have been due to a
> bug in the broadcom driver?   We don't do any networking in our
> initrd/initramfs so maybe we can get by with the faster methods
> that use modalias files instead of uevent files.  The broken
> hotplugging (or whatever the problem is) is a bigger issue for
> us now even though it is small compared to the problems caused
> by the broken modprobe a year ago.
> 
> > However, you may find it worth noting that "find /sys" will get
> > its list of files slightly later than globbing will.
> 
> I don't know what the globbing solution is that you refer to.

Sorry, your reference to /sys/devices/ made me semi-remember this
bit (again, from the Puppy Linux forums):

grep -h ^MODALIAS= /sys/bus/*/devices/*/uevent |cut -c 10-

See:
http://www.murga-linux.com/puppy/viewtopic.php?t=78941&start=210


> took me a little while to understand the following solution from
> the alpinelinux initrd/initramfs, partly because it does not work
> here at all:
> 
>     find /sys -name modalias | xargs sort -u | xargs modprobe -a
> 
> It fails badly whenever one or more modalias files has a space in
> the path (which is the case here).  That is easily remedied with:
> 
>     find /sys -name modalias -print0 \
>         | xargs -0 sort -u \
>         | xargs modprobe -a -q -b 2>/dev/null
> 
> This is probably more efficient than what I'm currently doing
> if /sys is replaced with /sys/devices.  Thank you.

Ah.

Where SYSBASE is the directory you're searching in, you might prefer to use:
find $SYSBASE -name modalias -exec sort -u '{}' + | xargs modprobe ...

(ie, use find -exec instead of find -0 |xargs -0).

FYI: I find that there are uevents in /sys/bus/ and /sys/module/, 
but no modalias files.

<snip>
> My latest solution is to coldplug inside the loop that looks for
> the boot device.  When we were experiencing the bug in the
> smaller busybox modprobe about a year ago we tried various
> schemes of always loading certain modules but that was not very
> satisfactory.  It masks the problem instead of fixing it and it.
> If loading of hardware specific modules is not 100% reliable then
> where do you draw the line of which specific modules to load on
> every machine.  Likewise, loading a bunch of modules after a
> delay can in some cases just further postpone the eventual
> failure.  

That sounds like a good course.
 
> ISTM repeated coldplugging is a reasonable compromise even if it
> is not as elegant as hotplugging.  At least it only loads modules
> that correspond to the hardware.
> 
> Thank you for your help.  This discussion has been useful to
> me.  

Glad to be of help.


Thanks,
Isaac Dunham



More information about the busybox mailing list