[PATCH] udev enhancements to use kernel event queue

Steven Dake
2003-06-12T18:57:33Z

[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]

Folks,

I have been looking at the udev idea that Greg KH has developed.
Userland device enumeration definately is the way to go, however, there
are some problems with using /sbin/hotplug to transmit device
enumeration events:

1) performance of fork/exec with lots of devices is very poor
2) lots of processes can be forked with no policy to control how many
are forked at once potentially leading to OOM
3) /sbin/hotplug events can occur out of order, eg: remove event occurs,
/sbin/hotplug sleeps waiting for something, insert event occurs and
completes immediately. Then the remove event completes, after the
insert, resulting in out-of-order completion and a broken /dev. I have
seen this several times with udev.
4) early device enumeration (character devices, etc) are missed because
/sbin/hotplug is not available during early device init.

To solve these problems, I've developed a driver and some minor
modifications to the lib/kobject.c to queue these events and allow a
user space program to read the events at its leisure. The driver
supports poll/select for effecient use of the processor.

The feature is called the System Device Enumeration Event Queue. I've
attached a tarball which includes udev-0.1 modified to use the SDEQ, a
kernel patch against linux 2.5.70 that implements the SDEQ, and a
test/library that tests the SDEQ functionality.

To jump right in try these steps:
1) apply the SDEQ patch
2) configure CONFIG_SDEQ on in config/general
3) make in the udev-0.1 directory
4) mkdir /newdevs (this is where the devices are enumerated)
5) reboot with new kernel
6) mount sysfs in /sys
7) mknod /dev/sdeq c 10 222 (this creates the device node that is used
to communicate with the SDEQ)
7) run ./udev in udev-0.1 directory

Look in /newdevs for enumerated devices.

you can use fdisk on a disk device to see how dynamic device
creation/deletion works.

If it works for you or doesn't or you like the idea or don't, I've love
to hear about it

Thanks
-steve

[-- Attachment #2: sdeq.tar.gz --]
[-- Type: application/x-gzip, Size: 20163 bytes --]