Skip to contentSkip to conversation

DEVFS_FS

DISCUSSION Adam J. Richter 3 participants 4 messages Nov 11, 2004 – Nov 12, 2004 VFS

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines

What is the approved substitute for DEVFS_FS that is marked obsolete?

DEVFS_FS is not obsolete. Rather, this is a case of misstatements
being repeated so many times that people start to believe it.

1. Only devfs (or the lookup trapping facility used in my remake
of it) can configure new devices on demand based on accesses to files missing from /dev, which allows for faster boot time (no need
to initialize device you won't use during this session), easier fixing of device driver bugs, and potentially less memory utilization (the new devfs implementation plus lookup traps have a code size of about 5kB combined; the inode+dname utilization of devfs is less than sysfs due to there being fewer nodes and you can run devfs without sysfs, and when inode+dname memory utilization of both are fixed, the size of the unnecessarily loaded kernel modules will dominate).

2. Only devfs allows a device driver to pass suggested names
for arbitrary minor device numbers (e.g., /dev/sound/mixer, /dev/sound/dsp). Otherwise, a configuration file or a static /dev has to know these things in advance.

3. Only devfs allows a device driver to pass suggested names
for arbitrary related facilities that do not fall under the same major device number (e.g., CD-ROM's, tapes).

Fundamentally, the functionality of being able to trap accesses
to nonexistent devices and the ability to pass the additional string information in #2 and #3 provide a more flexible user interface as new kernel facilities are developed, and communicating the relevant information through a virtual file system is useful for avoid unnecessary serialization and deferring certain initializations (for example, until later in a boot process).

By the way, with devfs, especially under the new implementation,
it is not particularly difficult to remap the names using {,UN}REGISTER events from a shadow file system (or directly from /dev if you also want the default names), without the underlying configuration having any prior knowledge about device numbers. Many statements in Greg Kroah-Hartmann's "udev and devfs - The final word" that seem to contract this seem to me to be wrong or misleading when it would be easy to be clearer (for example, "devfs does not handle the need for dynamic major/minor numbers", when devfs does not care and not know whether the major/minor device number passed to it were dynamically allocated).

This is not to say that I am "against udev" by every possible
interpretation of that term. I think using sysfs or hotplug events to create nodes in /dev (but usually not to load the corresponding kernel modules) is a useful user interface improvement. I also hope to see the devfs interface evolve to do things like be able to statically export the default /dev file mappers from kernel modules, just as hardware device ID tables are exported, and, if sysfs memory consumption were to improve radically (the sysfs backing store patch would really help), then the memory usage, the _requirement_ of a user level helper program (instead of it just being an option) and the loss of ability to select devfs and sysfs independently _might_ be offset by simplification of other user level helper code (by making /dev maintenance one of multiple duties of a sysfs watching facility).

I think that Linux users would be much better served by allowing
the devfs functionality to be actively maintained, improved and exported to "non-devfs" systems (for example the tmpfs lookup trapping) in general, and, in particular, by integrating my devfs rewrite instead of refusing it (and I have offered to arrange it so that the kernel can be configured with either the old or the new devfs implementation). Whether this functionality is called "devfs" in the future is not important, but providing its functionality for those who want it is, and that is what is being undermined by not integrating the new devfs implementation.

                    __     ______________ 

Adam J. Richter \ /
[email protected] | g g d r a s i l

#1 lore raw
Quoted 2 lines

DEVFS_FS is not obsolete. Rather, this is a case of misstatements being repeated so many times that people start to believe it.

I thought it was ultimately a case of no one willing to maintain it. What I read is that supporters of devfs got weary enough of the criticism that they finally packed up and went home.

To me, the criticism of devfs missed its most important feature: It was fundamentally designed to eradicate device numbers altogether. Device numbers are an ancient technology. In today's world, a device's basic name should be something like /dev/sound/mixer instead of a small number.

If you miss that, and think devfs is about making mnemonic aliases for small numbers, then it's easy to see devfs as a poor approximation of udev.

Quoted 5 lines

Only devfs (or the lookup trapping facility used in my remake of it) can configure new devices on demand based on accesses to files missing from /dev, which allows for faster boot time (no need to initialize device you won't use during this session), easier fixing of device driver bugs, and potentially less memory utilization

Why is that? First, let me make sure I parsed the sentence right: You're saying the only way to configure devices on demand such that you get all those benefits is by using your lookup trapping facility in conjunction with your version of devfs? I don't see it. Any device driver can put off configuring a device until it's accessed. A loadable kernel module lets you put off driver loading and initialization until some time after boot. Autoloading of LKMs lets you do that on demand. And if autoloading isn't functional enough, your lookup trapping can do all manner of device initialization with or without devfs. So where's the devfs connection?

Also, I'm not clear on what memory utilization or device initialization delays we're talking about.

#2 lore raw
Quoted 4 lines · Bryan Henderson

To me, the criticism of devfs missed its most important feature: It was fundamentally designed to eradicate device numbers altogether. Device numbers are an ancient technology. In today's world, a device's basic name should be something like /dev/sound/mixer instead of a small number.

I agree.

Numberless devices are so useful that even some non-devfs systems have a few drivers which allocate a number and require userspace to do horrible things like parse /proc/devices to open the device.

Versions of udev that use /lib/udev-state/devices.tar.bz2 to workaround the limitation described below completely break this numberless feature.

Quoted 3 lines

If you miss that, and think devfs is about making mnemonic aliases for small numbers, then it's easy to see devfs as a poor approximation of udev.

In my experience, udev has not been as good as people say, because while devfs just works, the udev-based system I'm using right now requires all manner of manual modprobing before basic things like pppd, openvpn and mtools work.

Quoted 10 lines
Quoted 5 lines

Only devfs (or the lookup trapping facility used in my remake of it) can configure new devices on demand based on accesses to files missing from /dev, which allows for faster boot time (no need to initialize device you won't use during this session), easier fixing of device driver bugs, and potentially less memory utilization

Why is that? First, let me make sure I parsed the sentence right: You're saying the only way to configure devices on demand such that you get all those benefits is by using your lookup trapping facility in conjunction with your version of devfs?

Wrongly parsed.
He's saying _either_ devfs _or_ looking trapping is sufficient.

Quoted 2 lines

Also, I'm not clear on what memory utilization or device initialization delays we're talking about.

Examples: If you compile all USB drivers into the kernel, or if you modprobe them during boot scripts, then boot time is extended by the time taken to initialise the host controllers and connected devices. If you compile in SCSI drivers, boot time is further extended by the time taken to probe and initialise your SCSI devices.

The time for initialising devices which you don't want to use this session can be quite significant, if you find a few seconds to be significant.

Same goes for unnecessary memory utilisation. Having drivers loaded for devices which you aren't using can be significant, if you find a few hundred kbytes significant.

-- Jamie

#3 lore raw
Quoted 8 lines

Examples: If you compile all USB drivers into the kernel, or if you modprobe them during boot scripts, then boot time is extended by the time taken to initialise the host controllers and connected devices. If you compile in SCSI drivers, boot time is further extended by the time taken to probe and initialise your SCSI devices.

Having drivers loaded
for devices which you aren't using can be significant,

So it sounds like you're talking about the feature of devfs in which the driver doesn't get loaded until someone refers to the /dev directory that refers to it. But that's not a characteristic of devfs -- that's just devfs keeping up with the classic mknod system. In the classic system (if you choose to set it up that way), the device driver doesn't get loaded until someone refers to its major number. That's part of the general module autoloading function.

Fundamentally, I believe devfs has this problem worse than the mknod system. Devfs strives to make meaningful names for devices, which means it has to some work, such as talk to the device, to create one. With the mknod system, devices often have names that have nothing to do with the true identity of the device, so a name can simply be implied. Taking SCSI as an example, a reasonable driver for a single parallel SCSI bus with one LU per target could simply assign minor number = target ID and do no initialization work at all. But the same driver in devfs would want to talk to the 16 possible targets and make up names more meaningful than target ID for them -- and omit from the namespace the ones that don't answer.