Re: [PATCH] driver-core: devtmpfs - driver core maintained /dev tmpfs

Andy Lutomirski
2009-05-02T15:18:44Z

Kay Sievers wrote:
> On Sat, May 2, 2009 at 09:19, Christoph Hellwig <hch@infradead.org> wrote:
>> On Fri, May 01, 2009 at 03:24:01PM +0200, Kay Sievers wrote:
>>> I'm very sure, you can not fix it outside the kernel. Or do you have
>>> an idea how to create the missing device nodes for device without
>>> crawling sysfs, when the first userspace process is started?
>> Just make sure to queue up your uevents in a ring buffer that udev
>> can read once it has started?
>
> Which does not really target any of the problems we try to solve, and
> is probably even larger than the 300 lines to create the proper /dev
> stuff right away. It's about fractions of a second, we are optimizing
> for, and we need to start as many things in parallel, as early as
> possible. And a working and populated /dev is mandatory for most of
> the stuff we need to bring up.
>
> I think the init=/bin/sh case alone would be justification enough to
> do that, it can save you a lot of trouble if things go wrong, which
> things do, and which is pretty hard to cope with today, with no access
> to your devices.

What's wrong with:

mount -n -t sysfs none /sys
mount -n -t tmpfs none /tmp
udevd --daemon
udevadm trigger

once the shell comes up? There could even be a standard script that all
distributions ship that does that, plus mounts /proc and does whatever
magic is needed to make Ctrl-C work.

(OK, so you depend on udev and mount working, but you already depend
on sh working, and you'll have a heck of time rescuing anything if even
mount doesn't work.)

If you want a really reliable rescue mode, then either put a whole
working busybox system in a spare initramfs with a spare boot menu entry
or just use a real rescue disk, neither of which require devtmpfs.

As a separate question, what happens with devtmpfs if I plug in some
device that uses dynamic minors, then unplug it, then plug in another
device that gets a new minor but the same name, all before (or even
after) udev starts? Are there any subsystems that could do that?

--Andy

>
> We are not implementing anything crazy here like devfs did, including
> the later versions - there is no modprobe behind your back, no lookup
> hooks, no stupid new naming scheme, no new filesystem type to
> register.
> Udev uses the kernel provided names anyway today, there are no naming
> rules at all in current userspace for 98 of 100 devices. It's todays
> kernel which provides the naming already, and we will not change
> anything here, just add the few exceptions, which are only in udev
> rules today, and let the kernel create the node that udev will create
> anyway.
>
> Thanks,
> Kay