[Buildroot] [PATCH] linux: don't automatically set uevent_helper with mdev /dev management

Peter Korsgaard jacmet at uclibc.org
Sat Feb 8 20:51:19 UTC 2014


>>>>> "Thomas" == Thomas De Schampheleire <patrickdepinguin at gmail.com> writes:

Hi,

 >> No, mdev -s only scans /sys for devices and create the corresponding
 >> device nodes (already done by devtmpfs) and execute whatever commands
 >> you have defined, it afaik doesn't handle module load or firmware requests.

 > When you say 'module load', the only relevant consequence of that is
 > the creation of nodes in /sys that may need corresponding entries in
 > /dev right? So this is covered by the S10mdev script, as far as I see.
 > What else would happen in 'module load' that mdev does not cover?

I mean module load as in automatic loading of kernel modules
modprobe. The kernel generates hotplug events with the needed modalias
that mdev can pass to modprobe, but our mdev.conf is not setup to do that.

Here's a blog post about it:

https://frankpzh.wordpress.com/2011/04/16/kmod-udev-and-modprobe/

 > However, the kernel configuration says: "This should not be used
 > today, because usual systems create many events at bootup or device
 > discovery in a very short time frame. One forked process per event can
 > create so many processes that it creates a high system load, or on
 > smaller systems it is known to create out-of-memory situations during
 > bootup."

Yes, the "modern" way to send these events (E.G. what udev is using) is
afaik through netlink instead of forking a process for each, but if you
want to handle these events through mdev then there's not really any way
around it.


 > So then I wonder, how is it supposed to work for module load and
 > firmware loading if you can't use this option. Or put another way: are
 > you sure we need to set the uevent_helper_path for that?

If you want to be notified of hotplug events (and don't use netlink),
then you have to set it.

Out of interest I did a quick test with qemu_arm_versatile_defconfig and
the following patch:

diff -u package/busybox/S10mdev output/target/etc/init.d/S10mdev
--- package/busybox/S10mdev     2013-10-24 09:55:30.270408593 +0200
+++ output/target/etc/init.d/S10mdev    2014-02-08 21:26:48.450713447 +0100
@@ -7,6 +7,8 @@
   start)
        echo "Starting mdev..."
        echo /sbin/mdev >/proc/sys/kernel/hotplug
+       echo -n "seqnum: "
+       cat /sys/kernel/uevent_seqnum
        /sbin/mdev -s
        ;;
   stop)

And I see the kernel triggers 357 hotplug events before we get
here. Looking at the pid number after bootup and login that also seems
to match (428 with CONFIG_UEVENT_HELPER_PATH="/sbin/mdev" and 73 when
set to the empty string), but I don't see any significant boot speed
difference here.

So, I'm not saying I don't believe you or that it perhaps wouldn't be
better to handle the initial hotplug events with mdev, just that it less
"correct" - But mdev is afaik inherently racy, so perhaps not doing it
would be the "least bad" approach (and gives us same behaviour if kernel
isn't built by buildroot).

-- 
Bye, Peter Korsgaard



More information about the buildroot mailing list