Letting mdev + devtmpfs play together?

Floris Bos bos at je-eigen-domein.nl
Sat Apr 18 15:05:24 UTC 2015


Hi,

I was wondering if it is possible to configure mdev NOT to add and 
remove device nodes, and let devtmpfs handle that part instead?


The problem I am having is that after adding a new partition to storage, 
the kernel sends both hotplug events REMOVING and ADDING the partition node.
However often they are processed out of order, and "remove" is processed 
after "add" making the new partition node disappear:

==
mdev[598]: 9.191594 ACTION:add SUBSYSTEM:block DEVNAME:mmcblk0p6 
DEVPATH:/devices/platform/soc/3f300000.mmc/mmc_host/mmc0/mmc0:1234/block/mmcblk0/mmcblk0p6
mdev[598]: dev 179,6
[...]
mdev[593]: 9.192168 ACTION:remove SUBSYSTEM:block DEVNAME:mmcblk0p6 
DEVPATH:/devices/platform/soc/3f300000.mmc/mmc_host/mmc0/mmc0:1234/block/mmcblk0/mmcblk0p6
mdev[593]: rule matched, line -1
mdev[593]: unlink: mmcblk0p6
==

I tried enabling waiting for sequence numbers by echoing a newline to 
/dev/mdev.seq, however I noticed there are situations where that does 
not work properly either.

==
mdev[527]: first seq written
mdev[527]: 2.902914 ACTION:add SUBSYSTEM:usb DEVNAME:(null) 
DEVPATH:/devices/platform/bcm2708_usb/usb1/1-1/1-1:1.0
mdev[526]: 2.902980 waiting for '527'
==

526 waiting for 527?
Race condition while writing the first sequence number?

Meanwhile 527 and later process normally.
However eventually 526 times out, writes 527 to .seq and the mess is 
complete:

==
[...]
mdev[526]: timed out waiting for '568'
mdev[526]: 6.410098 ACTION:add SUBSYSTEM:usb DEVNAME:bus/usb/001/002 
DEVPATH:/devices/platform/bcm2708_usb/usb1/1-1
mdev[526]: dev 189,1
mdev[526]: rule matched, line -1
mdev[526]: mknod bus/usb/001/002 (189,1) 20660 0:0
mdev[526]: 6.413223 exiting
mdev[568]: 6.664987 waiting for '527'
mdev[570]: 6.667484 waiting for '527'
mdev[571]: 6.667798 waiting for '527'
mdev[569]: 6.668286 waiting for '527'
mdev[572]: 6.668698 waiting for '527'
==


I'm mainly interested in just using mdev to respond to certain events 
like firmware requests, and executing a program when a certain device 
appears.
Think devtmpfs would suffice for actually managing /dev
So was wondering if I couldn't simply combine the two, avoiding this 
problem, but cannot find in the documentation how to disable the 
internal add/remove rules.


Yours sincerely,

Floris Bos



More information about the busybox mailing list