The udev tail wags the dog
OLPC laptops have, among their other quirks, a special keyboard which requires the loading of a specific keymap to operate properly. For the older generations of laptops, loading this keymap has been easily handled with a udev rule:
ENV{DMI_VENDOR}=="OLPC", ATTR{[dmi/id]product_name}=="XO", \ RUN+="keymap $name olpc-xo"
This rule simply extracts the name of the machine from the desktop management interface (DMI) data that has been made available in sysfs. If that data indicates that the system is running on an XO laptop, the appropriate keymap file is loaded. DMI is an x86-specific interface, though, and the upcoming (1.75) generation of the XO laptop is not an x86-based machine. There is no DMI information available on that laptop, so this rule fails; some other solution will be needed.
In current times, the source for hardware description information - especially on non-discoverable platforms - is supposed to be the device tree structure. So Paul Fox's solution would seem to make sense: he created a new rule with a helper script to extract the machine identification from the device tree, which happens to be available in /proc/device-tree. It almost certainly came as a surprise when this solution was rejected by udev maintainer Kay Sievers, who said:
Of course, Paul wasn't adding the /proc/device-tree interface; criticism of such a move would not have been surprising. That file has a long history; it has been supported, under some architectures, since the 2.2 kernel. So one might think that it is a bit late to be complaining about it; there are a number of /proc files added in those days which would not be allowed into /proc now. In general, those files are considered to be part of the user-space ABI at this point; like it or not, we are stuck with them. The device tree file has been around for long enough that it almost certainly falls into that category; it's hard to imagine that it would have been maintained for so long if there were no programs making use of it. Whether or not the udev developers like it, /proc/device-tree is not likely to go anywhere else anytime soon.
That still doesn't mean that the udev developers have to make use of it, though, and they seem determined to hold out for something better. Quoting Kay again:
Kay would like to see the machine identification information exposed separately somewhere under /sys; it has even been suggested that platforms using device trees could emulate the DMI directory found on x86 systems. That, to them, looks like a longer-term solution that doesn't put udev in the position of blocking an ABI cleanup sometime in the future.
In essence, what we have is a user-space utility telling the kernel that an interface it has supported for well over a decade is unacceptable and needs to be replaced. To force that replacement, udev is refusing to accept changes that make use of the existing interface. Whether that is a proper course of action depends on one's perspective. To some, it will look like a petty attempt to force kernel developers to maintain two interfaces with duplicate information in the hope that a long-lived /proc file will eventually go away, despite its long history. To others, it will seem like a straightforward attempt to help the kernel move toward interfaces that are more supportable in the long term.
In this particular case, it looks like udev probably wins. Adding the
machine identification somewhere in sysfs will be easy enough that it is
probably not worth the effort to fight the battle. In a more general
sense, this episode shows that the kernel ABI is not just something handed
down to user space from On High. User-space developers will have their
say, even a dozen years after the interface has been established; that is a
good thing. Having more developers look at these
issues from both sides of the boundary can only help in the creation of
better interfaces.
Index entries for this article | |
---|---|
Kernel | Development model/User-space ABI |
Kernel | Device tree |
Kernel | udev |
Posted Aug 25, 2011 1:46 UTC (Thu)
by jonabbey (guest, #2736)
[Link] (15 responses)
Am I missing something?
Posted Aug 25, 2011 2:19 UTC (Thu)
by corbet (editor, #1)
[Link] (14 responses)
Posted Aug 25, 2011 9:41 UTC (Thu)
by chrispe (subscriber, #4442)
[Link] (13 responses)
Posted Aug 28, 2011 3:33 UTC (Sun)
by giraffedata (guest, #1954)
[Link] (12 responses)
Where would your device tree come from? I presume you could install a new graphics controller in your PC; how would the device tree get changed so Linux and the things running under it know to drive it differently than the old one?
Posted Aug 28, 2011 9:12 UTC (Sun)
by nhippi (subscriber, #34640)
[Link] (11 responses)
Device tree/DMI are more useful in telling kernel about devices that cannot be automatically scanned. Usually such devices are "soldered on", so the need of changing the Device tree is quite rare.
Life in X86 and DMI is a bit more complicated, as Bios also probes some devices and puts them in DMI. Often instead of probing those devices in kernel again, we trust the bios with varying degrees of success.
Posted Aug 28, 2011 19:18 UTC (Sun)
by giraffedata (guest, #1954)
[Link] (10 responses)
(There was an article about this in LWN not long ago, but I didn't get it then either).
Posted Aug 28, 2011 20:35 UTC (Sun)
by robbe (guest, #16131)
[Link]
Seems like on this device-tree system some device is not ending up under /sys/devices, or too little actual info is put there, although the kernel had it handed to it via the device tree.
Posted Aug 28, 2011 22:11 UTC (Sun)
by mjg59 (subscriber, #23239)
[Link] (8 responses)
Posted Aug 28, 2011 23:04 UTC (Sun)
by giraffedata (guest, #1954)
[Link] (7 responses)
Posted Aug 28, 2011 23:57 UTC (Sun)
by dlang (guest, #313)
[Link]
on many embedded systems (including ARM) this isn't the case. the kernel running on the system has no way of guessing what will happen if it sends data out to some I/O address. The kernel must be told about every device in the system and where it is.
it's the fact that almost every device on an x86 system is on a bus that can report what is there that makes the systems "discoverable"
Posted Aug 29, 2011 0:28 UTC (Mon)
by mjg59 (subscriber, #23239)
[Link] (4 responses)
Posted Aug 29, 2011 1:39 UTC (Mon)
by dlang (guest, #313)
[Link] (3 responses)
Device Trees are a way for the System Administrator who installs an OS on the system what hardware exists.
It's far more likely that the hardware manufacturer is going to accurately identify what hardware exists than it is that the System Administrator is going to know what hardware exists on a system.
Device Trees may look like they are discoverable if you are only looking at it from the point of view of an OS that has the Device Tree provided to it. But from the point of view of the person trying to install the system who has to figure out what to put in the Device Tree, they are not discoverable, they are the output of research, not the source of information.
Posted Aug 29, 2011 2:15 UTC (Mon)
by mjg59 (subscriber, #23239)
[Link] (2 responses)
Posted Aug 29, 2011 2:26 UTC (Mon)
by dlang (guest, #313)
[Link] (1 responses)
ARM vendors don't really care about Device Trees, they are pretty happy just hard-coding the kernel itself.
it's the people who want to upgrade the devices and people who want to maintain the upstream tree that want the consolidation made available by device trees.
Posted Oct 18, 2011 16:15 UTC (Tue)
by jcm (subscriber, #18262)
[Link]
Posted Aug 29, 2011 0:32 UTC (Mon)
by mjg59 (subscriber, #23239)
[Link]
Posted Aug 25, 2011 2:36 UTC (Thu)
by cesarb (subscriber, #6266)
[Link] (3 responses)
Posted Aug 25, 2011 2:40 UTC (Thu)
by josh (subscriber, #17465)
[Link] (1 responses)
Posted Aug 28, 2011 20:17 UTC (Sun)
by robbe (guest, #16131)
[Link]
Now these birth pains are mostly gone, I see no pressing need to merge. So udev could serve as a poster child for the "incubator" idea proposed by dberkholz at https://lwn.net/Articles/456308/
Posted Aug 27, 2011 0:42 UTC (Sat)
by jcm (subscriber, #18262)
[Link]
Posted Aug 25, 2011 4:43 UTC (Thu)
by dilinger (subscriber, #2867)
[Link]
Posted Aug 25, 2011 17:47 UTC (Thu)
by iabervon (subscriber, #722)
[Link]
Posted Aug 25, 2011 18:03 UTC (Thu)
by martin.langhoff (subscriber, #61417)
[Link] (1 responses)
There is a big push from the kernel side to consolidate platforms on using device-tree - see for example http://www.linaro.org/linaro-blog/2011/08/15/enabling-dev... -- but perhaps device-tree has not been discussed at a plumbers conference.
Posted Aug 25, 2011 20:11 UTC (Thu)
by BenHutchings (subscriber, #37955)
[Link]
The nodes in a device tree are supposed to be bound to devices in the Linux device model. udev will then receive the information from those nodes through uevents and sysfs, just as it does for devices that are discovered on a PCI or USB bus. In this case some nodes with useful information are not bound to anything in the device model, and that should be fixed.
Posted Aug 27, 2011 0:47 UTC (Sat)
by jcm (subscriber, #18262)
[Link]
The udev tail wags the dog
You're not running a system that actually uses a device tree. x86 systems are (mostly) discoverable and don't need an external file to know what the layout of the hardware is.
The udev tail wags the dog
x86 discoverability is over rated
x86 discoverability is over rated
I'd rather have a simple bootloader and device tree than an ACPI or EFI BIOS in my PC. Perhaps the BIOS could be chain loaded for OSes that need it.
x86 discoverability is over rated
OK, well I'm more confused than ever. On a system such as x86 that is discoverable, how does a user space program get the information that on other systems it gets from /proc/device_tree? And I presume there's a difference in how the kernel gets that information as well?
x86 discoverability is over rated
x86 discoverability is over rated
x86 discoverability is over rated
Well so far, I'm not seeing anything that makes the adjective "discoverable" apply more to an x86 system than to one of these mysterious systems that has a /proc/device_tree. All I see is a different set of protocols for conducting discovery or reporting its results.
x86 discoverability is over rated
x86 discoverability is over rated
x86 discoverability is over rated
x86 discoverability is over rated
x86 discoverability is over rated
x86 discoverability is over rated
x86 discoverability is over rated
x86 discoverability is over rated
Merge into the kernel?
Merge into the kernel?
Merge into the kernel?
Merge into the kernel?
The udev tail wags the dog
The udev tail wags the dog
Linux Plumbers fail
Linux Plumbers fail
The udev tail wags the dog