Skip to contentSkip to conversation

Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev

PATCH In review Greg KH 19 participants 78 messages Aug 5, 2009 – Aug 13, 2009

Subsystems (4)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev

Here's the devtmpfs patch again. For .32 it's a simple and clean patch. It's been tested and agreed by three major distros that this is a good idea. SuSE has been shipping this in their kernels for a while now with no problems, and actual speedups measured on their boot times. Gentoo also has been testing it, but we haven't gotten a tested-by: line from them yet, hopefully that will happen soon.

A number of embedded distros have also privately said they would be using this patch, I really don't understand why they don't publically want to state this, but oh well...

It's been in linux-next for many months now, with no reported regressions at all as well.

thanks,

greg k-h

--------------

From: Kay Sievers <[email protected]>

Devtmpfs lets the kernel create a tmpfs instance called devtmpfs very early at kernel initialization, before any driver-core device is registered. Every device with a major/minor will provide a device node in devtmpfs.

Devtmpfs can be changed and altered by userspace at any time, and in any way needed - just like today's udev-mounted tmpfs. Unmodified udev versions will run just fine on top of it, and will recognize an already existing kernel-created device node and use it. The default node permissions are root:root 0600. Proper permissions and user/group ownership, meaningful symlinks, all other policy still needs to be applied by userspace.

If a node is created by devtmps, devtmpfs will remove the device node when the device goes away. If the device node was created by userspace, or the devtmpfs created node was replaced by userspace, it will no longer be removed by devtmpfs.

If it is requested to auto-mount it, it makes init=/bin/sh work without any further userspace support. /dev will be fully populated and dynamic, and always reflect the current device state of the kernel. With the commonly used dynamic device numbers, it solves the problem where static devices nodes may point to the wrong devices.

It is intended to make the initial bootup logic simpler and more robust, by de-coupling the creation of the inital environment, to reliably run userspace processes, from a complex userspace bootstrap logic to provide a working /dev.

---
 drivers/base/Kconfig     |   25 +++
 drivers/base/Makefile    |    1 
 drivers/base/base.h      |    6 
 drivers/base/core.c      |    3 
 drivers/base/devtmpfs.c  |  367 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/base/init.c      |    1 
 include/linux/device.h   |   10 +
 include/linux/shmem_fs.h |    3 
 init/do_mounts.c         |    2 
 init/main.c              |    2 
 mm/shmem.c               |    9 -
 11 files changed, 422 insertions(+), 7 deletions(-)
drivers/base/base.h +6 -0
@@ -139,3 +139,9 @@ static inline void module_add_driver(str
 				     struct device_driver *drv) { }
 static inline void module_remove_driver(struct device_driver *drv) { }
 #endif
+
+#ifdef CONFIG_DEVTMPFS
+extern int devtmpfs_init(void);
+#else
+static inline int devtmpfs_init(void) { return 0; }
+#endif
drivers/base/core.c +3 -0
@@ -929,6 +929,8 @@ int device_add(struct device *dev)
 		error = device_create_sys_dev_entry(dev);
 		if (error)
 			goto devtattrError;
+
+		devtmpfs_create_node(dev);
 	}
 
 	error = device_add_class_symlinks(dev);
@@ -1075,6 +1077,7 @@ void device_del(struct device *dev)
 	if (parent)
 		klist_del(&dev->p->knode_parent);
 	if (MAJOR(dev->devt)) {
+		devtmpfs_delete_node(dev);
 		device_remove_sys_dev_entry(dev);
 		device_remove_file(dev, &devt_attr);
 	}
drivers/base/devtmpfs.c new file +367 -0

367 lines not on this page · raw message

drivers/base/init.c +1 -0
@@ -20,6 +20,7 @@
 void __init driver_init(void)
 {
 	/* These are the core pieces */
+	devtmpfs_init();
 	devices_init();
 	buses_init();
 	classes_init();
drivers/base/Kconfig +25 -0
@@ -8,6 +8,31 @@ config UEVENT_HELPER_PATH
 	  Path to uevent helper program forked by the kernel for
 	  every uevent.
 
+config DEVTMPFS
+	bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
+	depends on HOTPLUG && SHMEM && TMPFS
+	help
+	  This creates a tmpfs filesystem, and mounts it at bootup
+	  and mounts it at /dev. The kernel driver core creates device
+	  nodes for all registered devices in that filesystem. All device
+	  nodes are owned by root and have the default mode of 0600.
+	  Userspace can add and delete the nodes as needed. This is
+	  intended to simplify bootup, and make it possible to delay
+	  the initial coldplug at bootup done by udev in userspace.
+	  It should also provide a simpler way for rescue systems
+	  to bring up a kernel with dynamic major/minor numbers.
+	  Meaningful symlinks, permissions and device ownership must
+	  still be handled by userspace.
+	  If unsure, say N here.
+
+config DEVTMPFS_MOUNT
+	bool "Automount devtmpfs at /dev"
+	depends on DEVTMPFS
+	help
+	  This will mount devtmpfs at /dev if the kernel mounts the root
+	  filesystem. It will not affect initramfs based mounting.
+	  If unsure, say N here.
+
 config STANDALONE
 	bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL
 	default y
drivers/base/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-y			:= core.o sys.o bus.o dd.o \
 			   driver.o class.o platform.o \
 			   cpu.o firmware.o init.o map.o devres.o \
 			   attribute_container.o transport_class.o
+obj-$(CONFIG_DEVTMPFS)	+= devtmpfs.o
 obj-y			+= power/
 obj-$(CONFIG_HAS_DMA)	+= dma-mapping.o
 obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
include/linux/device.h +10 -0
@@ -543,6 +543,16 @@ extern void put_device(struct device *de
 
 extern void wait_for_device_probe(void);
 
+#ifdef CONFIG_DEVTMPFS
+extern int devtmpfs_create_node(struct device *dev);
+extern int devtmpfs_delete_node(struct device *dev);
+extern int devtmpfs_mount(const char *mountpoint);
+#else
+static inline int devtmpfs_create_node(struct device *dev) { return 0; }
+static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
+static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
+#endif
+
 /* drivers/base/power/shutdown.c */
 extern void device_shutdown(void);
 
include/linux/shmem_fs.h +3 -0
@@ -38,6 +38,9 @@ static inline struct shmem_inode_info *S
 	return container_of(inode, struct shmem_inode_info, vfs_inode);
 }
 
+extern int init_tmpfs(void);
+extern int shmem_fill_super(struct super_block *sb, void *data, int silent);
+
 #ifdef CONFIG_TMPFS_POSIX_ACL
 int shmem_permission(struct inode *, int);
 int shmem_acl_init(struct inode *, struct inode *);
init/do_mounts.c +1 -1
@@ -415,7 +415,7 @@ void __init prepare_namespace(void)
 
 	mount_root();
 out:
+	devtmpfs_mount("dev");
 	sys_mount(".", "/", NULL, MS_MOVE, NULL);
 	sys_chroot(".");
 }
-
init/main.c +2 -0
@@ -68,6 +68,7 @@
 #include <linux/async.h>
 #include <linux/kmemcheck.h>
 #include <linux/kmemtrace.h>
+#include <linux/shmem_fs.h>
 #include <trace/boot.h>
 
 #include <asm/io.h>
@@ -808,6 +809,7 @@ static void __init do_basic_setup(void)
 	init_workqueues();
 	cpuset_init_smp();
 	usermodehelper_init();
+	init_tmpfs();
 	driver_init();
 	init_irq_proc();
 	do_ctors();
mm/shmem.c +3 -6
@@ -2298,8 +2298,7 @@ static void shmem_put_super(struct super
 	sb->s_fs_info = NULL;
 }
 
-static int shmem_fill_super(struct super_block *sb,
-			    void *data, int silent)
+int shmem_fill_super(struct super_block *sb, void *data, int silent)
 {
 	struct inode *inode;
 	struct dentry *root;
@@ -2519,7 +2518,7 @@ static struct file_system_type tmpfs_fs_
 	.kill_sb	= kill_litter_super,
 };
 
-static int __init init_tmpfs(void)
+int __init init_tmpfs(void)
 {
 	int error;
 
@@ -2576,7 +2575,7 @@ static struct file_system_type tmpfs_fs_
 	.kill_sb	= kill_litter_super,
 };
 
-static int __init init_tmpfs(void)
+int __init init_tmpfs(void)
 {
 	BUG_ON(register_filesystem(&tmpfs_fs_type) != 0);
 
@@ -2687,5 +2686,3 @@ int shmem_zero_setup(struct vm_area_stru
 	vma->vm_ops = &shmem_vm_ops;
 	return 0;
 }
-
-module_init(init_tmpfs)
#1 lore raw
Quoted 12 lines · Greg KH
drivers/base/core.c +2 -0
@@ -929,6 +929,8 @@ int device_add(struct device *dev)
 		error = device_create_sys_dev_entry(dev);
 		if (error)
 			goto devtattrError;
+
+		devtmpfs_create_node(dev);
 	}
 
 	error = device_add_class_symlinks(dev);

[...]

Quoted 2 lines
drivers/base/devtmpfs.c new file +0 -0

[...]

Quoted 1 line

+int devtmpfs_create_node(struct device *dev)

Returns an int that's never checked. Is this intentional?

Quoted 1 line

+int devtmpfs_delete_node(struct device *dev)

Similarly.

David

Signature · 6 lines
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/


'member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom'
author
#2 lore raw
Quoted 17 lines · David Vrabel
Quoted 12 lines · Greg KH
drivers/base/core.c +2 -0
@@ -929,6 +929,8 @@ int device_add(struct device *dev)
 		error = device_create_sys_dev_entry(dev);
 		if (error)
 			goto devtattrError;
+
+		devtmpfs_create_node(dev);
 	}
 
 	error = device_add_class_symlinks(dev);

[...]

Quoted 2 lines
drivers/base/devtmpfs.c new file +0 -0

[...]

Quoted 7 lines
Quoted 1 line

+int devtmpfs_create_node(struct device *dev)

Returns an int that's never checked. Is this intentional?

Quoted 1 line

+int devtmpfs_delete_node(struct device *dev)

Similarly.

Probably not, Kay, care to respin this?

thanks,

greg k-h

#3 lore raw
In reply to Greg KH
Quoted 1 line · On Wed, 5 Aug 2009 10:15:13 -0700 Greg KH <[email protected]> wrote:

Here's the devtmpfs patch again. For .32 it's a simple and clean patch.

You seem to have reposted it rather than anyone addressing any of the complaints people made about ?

To quote Christoph

Quoted 2 lines

What tree did you find with devtmpfs in it? It was pretty clearly rejected when it came up.

and Arjan (who is doing about the fastest Linux boot anyone has and has better data than anyone else)

Quoted 7 lines

so just to state the obvious: this code is not needed to boot fast. It is mostly a workaround for having a bad initrd; if you don't use an initrd, or if you use an initrd that's made with the right device nodes in it already, you really just don't need this.

I would much rather that you just fix your initrd... than to put this sort of thing into the kernel....

plus

Quoted 2 lines

Eric has shown that just making the nodes is 0.06 seconds with todays sysfs interface, and there is room for improvement,

and Erik Biederman

Quoted 8 lines
Quoted 5 lines

option for us. And still, nobody will be forced
to use it, it's entirely optional. For our systems, we decided to do it that way, and we ship it already in the distro, and if there are no substantial problems coming up, which we don't expect, we will continue using it.

Yes but you are asking all of us to maintain it. Forever in perpetuity. A better case needs to be made than you have already shipped the code.

Also can you confirm the SELinux issues raised by Stephen Smalley and David Quigley were fixed and resolved.

Alan

author
#4 lore raw
Quoted 12 lines · Alan Cox
Quoted 1 line · On Wed, 5 Aug 2009 10:15:13 -0700 Greg KH <[email protected]> wrote:

Here's the devtmpfs patch again. For .32 it's a simple and clean patch.

You seem to have reposted it rather than anyone addressing any of the complaints people made about ?

To quote Christoph

Quoted 2 lines

What tree did you find with devtmpfs in it? It was pretty clearly rejected when it came up.

That's not anything to address, what do you want me to say, "maple"? :)

Quoted 2 lines

and Arjan (who is doing about the fastest Linux boot anyone has and has better data than anyone else)

We did this work based on Arjan's work. It solves a problem that Moblin has as well, which is why Novell is using it for their Moblin-based images they are shipping. It makes things go faster, with a simpler userspace codepath, and we have the numbers as have been previously posted.

Quoted 7 lines
Quoted 7 lines

so just to state the obvious: this code is not needed to boot fast. It is mostly a workaround for having a bad initrd; if you don't use an initrd, or if you use an initrd that's made with the right device nodes in it already, you really just don't need this.

I would much rather that you just fix your initrd... than to put this sort of thing into the kernel....

We have "fixed" our initrd, so much so we don't even use one for Moblin, just like Intel doesn't. The userspace boot sequence uses this for a faster boot time. Ubuntu and Red Hat both independently confirmed this as well.

Quoted 4 lines

plus

Quoted 2 lines

Eric has shown that just making the nodes is 0.06 seconds with todays sysfs interface, and there is room for improvement,

A 0.06 speedup is still a speedup, right? :)

Seriously, we saw much more than that, about 0.5 from what I last remember, Kay?

Quoted 10 lines

and Erik Biederman

Quoted 8 lines
Quoted 5 lines

option for us. And still, nobody will be forced
to use it, it's entirely optional. For our systems, we decided to do it that way, and we ship it already in the distro, and if there are no substantial problems coming up, which we don't expect, we will continue using it.

Yes but you are asking all of us to maintain it. Forever in perpetuity. A better case needs to be made than you have already shipped the code.

I will maintain it. Or Kay will. It's the equalivant of adding a driver to the kernel, if you don't want it, it touches nothing else. The diffstat shows a bit of reorg to handle this, I can split it into 2 patches if that's really necessary.

Quoted 4 lines

Also can you confirm the SELinux issues raised by Stephen Smalley and David Quigley were fixed and resolved.

From what I recall, yes, they were. I'm guessing the Red Hat boot tests

performed by Harald confirms this.

thanks,

greg k-h

author
#5 lore raw
Quoted 16 lines · Greg KH
Quoted 12 lines · Alan Cox
Quoted 1 line · On Wed, 5 Aug 2009 10:15:13 -0700 Greg KH <[email protected]> wrote:

Here's the devtmpfs patch again. For .32 it's a simple and clean patch.

You seem to have reposted it rather than anyone addressing any of the complaints people made about ?

To quote Christoph

Quoted 2 lines

What tree did you find with devtmpfs in it? It was pretty clearly rejected when it came up.

That's not anything to address, what do you want me to say, "maple"? :)

Quoted 8 lines
Quoted 2 lines

and Arjan (who is doing about the fastest Linux boot anyone has and has better data than anyone else)

We did this work based on Arjan's work. It solves a problem that Moblin has as well, which is why Novell is using it for their Moblin-based images they are shipping. It makes things go faster, with a simpler userspace codepath, and we have the numbers as have been previously posted.

And to expound on this a bit, it's not just about fast boot, although this is a great benefit of this patch.

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

And then there's the great reason Kay previously stated, "if sysfs has all the names, numbers, and device properties, why would we need complex userspace to have the nodes?"

thanks,

greg k-h

#6 lore raw
Quoted 5 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Quoted 3 lines

And then there's the great reason Kay previously stated, "if sysfs has all the names, numbers, and device properties, why would we need complex userspace to have the nodes?"

Exactly.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#7 lore raw
Quoted 11 lines · Andi Kleen
Quoted 5 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

If you use mount by label or UUID, you still need udev (or other tools) in the initrd to find the right disk, correct? And for distros that want to support that, does this really reduce the amount of code in the initrd?

#8 lore raw
Quoted 1 line

If you use mount by label or UUID, you still need udev (or other tools)

I don't use that on my boxes.

Quoted 3 lines

in the initrd to find the right disk, correct? And for distros that want to support that, does this really reduce the amount of code in the initrd?

There are more users than just distros.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#9 lore raw
In reply to David Dillow
Quoted 8 lines · David Dillow
Quoted 7 lines · Andi Kleen
Quoted 5 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

Quoted 7 lines
Quoted 4 lines

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

If you use mount by label or UUID, you still need udev (or other tools) in the initrd to find the right disk, correct?

Yes, you would.

Quoted 2 lines

And for distros that want to support that, does this really reduce the amount of code in the initrd?

Yes it does, see the code in the Novell Moblin images for an example of how to use devtmpfs with udev for how to do this.

thanks,

greg k-h

#10 lore raw
Quoted 7 lines · Greg KH
Quoted 6 lines · David Dillow
Quoted 5 lines · Andi Kleen
Quoted 4 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

As a initrd less kernel user I can really only agree: getting rid
of the udev-in-initrd requirement would be a big step forward
in usability. Typically I always have to pre populate a on disk /dev manually first to get my kernels to boot.

If you use mount by label or UUID, you still need udev (or other tools) in the initrd to find the right disk, correct?

Yes, you would.

Might be straying off-topic here, but I find software raid to be particularly useful in this case. I've been using it on my home server for a few years now, including through the transition from ide to libata. The kernel autostart for md devices has been rock-solid, and successfully hides the real device name. No initramfs required.

You might want to adapt the md+lvm setup from the gentoo docs [1], even if you only have one disk (degraded mirror). The only gotcha I've encountered was forgetting to set up grub after replacing a failed disk, and it happened to be first in line in the BIOS. Didn't notice 'till an extended power outage forced a reboot.

Phil

[1] http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml

#11 lore raw
In reply to Greg KH
Quoted 11 lines · Greg KH
Quoted 2 lines · David Dillow

If you use mount by label or UUID, you still need udev (or other tools) in the initrd to find the right disk, correct?

Yes, you would.

Quoted 2 lines

And for distros that want to support that, does this really reduce the amount of code in the initrd?

Yes it does, see the code in the Novell Moblin images for an example of how to use devtmpfs with udev for how to do this.

I followed up with Greg offline to make sure I was looking at the right thing, but the upshot is that Moblin does not use an initrd and devtmpfs does not in any way reduce the amount of code for those distros that want to support more than the root=/dev/blah syntax.

Given Eric and Arjan's numbers about the time it takes to populate /dev from /sys -- pointing the speed problem squarely at udev or the ruleset -- I don't see much of a win for devtmpfs other than avoiding a static /dev to make init=/bin/sh work. You cannot rely on it for a hotplug disk such as USB, as it doesn't do the root=LABEL=usbroot that you'd want to do since the location is not stable.

author
#12 lore raw
Quoted 10 lines · David Dillow
Quoted 9 lines · Greg KH
Quoted 2 lines · David Dillow

If you use mount by label or UUID, you still need udev (or other tools) in the initrd to find the right disk, correct?

Yes, you would.

Quoted 2 lines

And for distros that want to support that, does this really reduce the amount of code in the initrd?

Quoted 7 lines
Quoted 2 lines

Yes it does, see the code in the Novell Moblin images for an example of how to use devtmpfs with udev for how to do this.

I followed up with Greg offline to make sure I was looking at the right thing, but the upshot is that Moblin does not use an initrd and devtmpfs does not in any way reduce the amount of code for those distros that want to support more than the root=/dev/blah syntax.

Like Scott points out, this option now allows distros to use blkid directly instead of udev if they want to implement things like this without udev.

Quoted 4 lines

Given Eric and Arjan's numbers about the time it takes to populate /dev from /sys -- pointing the speed problem squarely at udev or the ruleset -- I don't see much of a win for devtmpfs other than avoiding a static /dev to make init=/bin/sh work.

That's a very big win right there, don't you think? Also, embedded and rescue disks also would like it for this very reason.

Quoted 3 lines

You cannot rely on it for a hotplug disk such as USB, as it doesn't do the root=LABEL=usbroot that you'd want to do since the location is not stable.

Again, not all the world requires such labels.

thanks,

greg k-h

#13 lore raw
Quoted 9 lines · Greg KH
Quoted 4 lines · David Dillow

I followed up with Greg offline to make sure I was looking at the right thing, but the upshot is that Moblin does not use an initrd and devtmpfs does not in any way reduce the amount of code for those distros that want to support more than the root=/dev/blah syntax.

Like Scott points out, this option now allows distros to use blkid directly instead of udev if they want to implement things like this without udev.

But they already have that functionality -- RedHat has been doing it for ages, without devtmpfs. No new kernel code needed.

Quoted 6 lines
Quoted 4 lines

Given Eric and Arjan's numbers about the time it takes to populate /dev from /sys -- pointing the speed problem squarely at udev or the ruleset -- I don't see much of a win for devtmpfs other than avoiding a static /dev to make init=/bin/sh work.

That's a very big win right there, don't you think?

No, not really. It isn't hard to make a static /dev, or a rescue initrd for the cases with dynamic device numbers.

Quoted 2 lines

Also, embedded and
rescue disks also would like it for this very reason.

As a former embedded developer, I'd rather not waste kernel space on something I can throw away when I've booted. I know where my root is, and can statically populate /dev. Now, perhaps more embedded devices are moving to use USB for their root, but then it would seem to make more sense to use Eric/Arjan's program to populate /dev and do blk_id if I need to find a label or UUID, and then I can reuse the memory when I'm done. Perhaps I can find it by path and avoid the blk_id, but I still can do that without more kernel code.

And I realize that we're not talking about a lot of kernel memory here, so it depends on one's definition of waste.

Quoted 5 lines
Quoted 3 lines

You cannot rely on it for a hotplug disk such as USB, as it doesn't do the root=LABEL=usbroot that you'd want to do since the location is not stable.

Again, not all the world requires such labels.

Sure. But it seems the world can get what the best of both worlds from a simple program to populate /dev from sysfs.

An interesting experiment may be time a boot to initial user space with and without devtmpfs -- and compare the difference to Eric/Arjan's program on the same hardware. I wonder how much is really saved.

#14 lore raw
Quoted 2 lines

No, not really. It isn't hard to make a static /dev, or a rescue initrd for the cases with dynamic device numbers.

There's a world between strictly controlled embedded and fully general distributions.

I want a dynamic /dev, but a fast one that doesn't need initrd or slows down booting.

This patch seems to be a good way to get that.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#15 lore raw

Hi Andi,

Quoted 10 lines
Quoted 2 lines

No, not really. It isn't hard to make a static /dev, or a rescue initrd for the cases with dynamic device numbers.

There's a world between strictly controlled embedded and fully general distributions.

I want a dynamic /dev, but a fast one that doesn't need initrd or slows down booting.

This patch seems to be a good way to get that.

I fully agree.

And more important, if you don't like it, you don't have to use it. It is just another filesystem and if you wanna stick with tmpfs that is just fine, too :)

Regards

Marcel

#16 lore raw
In reply to Andi Kleen
Quoted 5 lines · Andi Kleen
Quoted 2 lines

No, not really. It isn't hard to make a static /dev, or a rescue initrd for the cases with dynamic device numbers.

There's a world between strictly controlled embedded and fully general distributions.

Sure, and I've acknowledged that. But it doesn't mean this needs a kernel solution.

Quoted 2 lines

I want a dynamic /dev, but a fast one that doesn't need initrd or slows down booting.

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

It remains to be seen how much it costs to do it in user space vs kernel space. Arjan -- do you have a pointer to your program? Perhaps I can shake loose some time to test that.

author
#17 lore raw
Quoted 7 lines · David Dillow
Quoted 5 lines · Andi Kleen
Quoted 2 lines

No, not really. It isn't hard to make a static /dev, or a rescue initrd for the cases with dynamic device numbers.

There's a world between strictly controlled embedded and fully general distributions.

Quoted 8 lines

Sure, and I've acknowledged that. But it doesn't mean this needs a kernel solution.

Quoted 2 lines

I want a dynamic /dev, but a fast one that doesn't need initrd or slows down booting.

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

Their program only handles it for a reconstruction of /dev based on sysfs one time at boot. It does not handle things that are added or discovered by the system after that, you need udev for that.

So it's a great hack for boot time stuff, but not a complete /dev management replacement like this code can be for numerous systems.

thanks,

greg k-h

#18 lore raw
Quoted 17 lines · On Tue, 11 Aug 2009 17:34:33 -0700 Greg KH <[email protected]> wrote:
Quoted 7 lines · David Dillow
Quoted 5 lines · Andi Kleen
Quoted 2 lines

No, not really. It isn't hard to make a static /dev, or a rescue initrd for the cases with dynamic device numbers.

There's a world between strictly controlled embedded and fully general distributions.

Quoted 8 lines

Sure, and I've acknowledged that. But it doesn't mean this needs a kernel solution.

Quoted 2 lines

I want a dynamic /dev, but a fast one that doesn't need initrd or slows down booting.

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

Quoted 6 lines

Their program only handles it for a reconstruction of /dev based on sysfs one time at boot. It does not handle things that are added or discovered by the system after that, you need udev for that.

So it's a great hack for boot time stuff, but not a complete /dev management replacement

yeah you want udev for that anyway for various reasons... (not that udev is expensive per se, the expensive part of it is the exec of modprobe a hundred times... beyond that udev seems pretty cheap to me)

Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#19 lore raw
In reply to Greg KH
Quoted 10 lines · Greg KH
Quoted 2 lines · David Dillow

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

Their program only handles it for a reconstruction of /dev based on sysfs one time at boot. It does not handle things that are added or discovered by the system after that, you need udev for that.

So it's a great hack for boot time stuff, but not a complete /dev management replacement like this code can be for numerous systems.

What systems would those be? Perhaps it's just too early in the morning for me, but I'm having a hard time thinking of ones that wouldn't want to use udev in that case for the event notification, or have their own handler, such as an embedded system.

author
#20 lore raw
Quoted 5 lines · David Dillow
Quoted 4 lines · Greg KH
Quoted 2 lines · David Dillow

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

Quoted 8 lines
Quoted 6 lines

Their program only handles it for a reconstruction of /dev based on sysfs one time at boot. It does not handle things that are added or discovered by the system after that, you need udev for that.

So it's a great hack for boot time stuff, but not a complete /dev management replacement like this code can be for numerous systems.

What systems would those be?

Rescue disks, Embedded systems with no local users, servers with no local users, etc. Basically anything that you are only root on, and don't care about group permissions.

thanks,

greg k-h

#21 lore raw
Quoted 12 lines · On Wed, 12 Aug 2009 06:44:40 -0700 Greg KH <[email protected]> wrote:
Quoted 11 lines · David Dillow
Quoted 10 lines · Greg KH
Quoted 3 lines · David Dillow

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

Their program only handles it for a reconstruction of /dev based on sysfs one time at boot. It does not handle things that are added or discovered by the system after that, you need udev for that.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

So it's a great hack for boot time stuff, but not a complete /dev management replacement like this code can be for numerous systems.

What systems would those be?

Rescue disks, Embedded systems with no local users, servers with no local users, etc. Basically anything that you are only root on, and don't care about group permissions.

you're speaking for devtmpfs; the tool we use actually does do group and owners.

Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
author
#22 lore raw
Quoted 18 lines · Arjan van de Ven
Quoted 15 lines · On Wed, 12 Aug 2009 06:44:40 -0700 Greg KH <[email protected]> wrote:
Quoted 14 lines · David Dillow
Quoted 12 lines · Greg KH
Quoted 3 lines · David Dillow

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

Their program only handles it for a reconstruction of /dev based on sysfs one time at boot. It does not handle things that are added or discovered by the system after that, you need udev for that.

So it's a great hack for boot time stuff, but not a complete /dev management replacement like this code can be for numerous systems.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

What systems would those be?

Rescue disks, Embedded systems with no local users, servers with no local users, etc. Basically anything that you are only root on, and don't care about group permissions.

you're speaking for devtmpfs; the tool we use actually does do group and owners.

Yes I am, sorry if anyone inferred otherwise.

thanks,

greg k-h

#23 lore raw
In reply to Greg KH
Quoted 10 lines · Greg KH
Quoted 9 lines · David Dillow
Quoted 8 lines · Greg KH
Quoted 2 lines · David Dillow

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

Their program only handles it for a reconstruction of /dev based on sysfs one time at boot. It does not handle things that are added or discovered by the system after that, you need udev for that.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

So it's a great hack for boot time stuff, but not a complete /dev management replacement like this code can be for numerous systems.

What systems would those be?

Rescue disks, Embedded systems with no local users, servers with no local users, etc. Basically anything that you are only root on, and don't care about group permissions.

We've discussed those, though, and I think most of those fall under either having full control of their static environment, or would have something to watch for hotplug events -- udev or a replacement -- and so would have the ability to create the node from user space.

Rescue disks may be an exception, but they only need a minimal static /dev and then run a tool to get the initial setup. If you are expecting an expert to use them, then either running the tool by hand or as a post-modprobe rule should catch updates. They can also run udev (or a replacement) with stripped rules if you want to make it friendlier to non-expert users.

author
#24 lore raw
Quoted 16 lines · David Dillow
Quoted 15 lines · Greg KH
Quoted 13 lines · David Dillow
Quoted 10 lines · Greg KH
Quoted 2 lines · David Dillow

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

Their program only handles it for a reconstruction of /dev based on sysfs one time at boot. It does not handle things that are added or discovered by the system after that, you need udev for that.

So it's a great hack for boot time stuff, but not a complete /dev management replacement like this code can be for numerous systems.

What systems would those be?

Quoted 8 lines
Quoted 3 lines

Rescue disks, Embedded systems with no local users, servers with no local users, etc. Basically anything that you are only root on, and don't care about group permissions.

We've discussed those, though, and I think most of those fall under either having full control of their static environment, or would have something to watch for hotplug events -- udev or a replacement -- and so would have the ability to create the node from user space.

Rescue disks and booting to /init/bash have full control over their static environment? I don't think so.

Quoted 6 lines

Rescue disks may be an exception, but they only need a minimal static /dev and then run a tool to get the initial setup. If you are expecting an expert to use them, then either running the tool by hand or as a post-modprobe rule should catch updates. They can also run udev (or a replacement) with stripped rules if you want to make it friendlier to non-expert users.

Ok, so don't use devtmpfs on your rescue disk, let the rest of us have a choice :)

thanks,

greg k-h

#25 lore raw
Quoted 10 lines · Greg KH
Quoted 6 lines · David Dillow

Rescue disks may be an exception, but they only need a minimal static /dev and then run a tool to get the initial setup. If you are expecting an expert to use them, then either running the tool by hand or as a post-modprobe rule should catch updates. They can also run udev (or a replacement) with stripped rules if you want to make it friendlier to non-expert users.

Ok, so don't use devtmpfs on your rescue disk, let the rest of us have a choice :)

But you have a choice, patch your local kernel. ;)

While my opinion doesn't carry as much weight as yours, Alan's, or Arjan's, I'm "meh" on this patch. I'm not dead set against it going in, nor have I seen a compelling reason to do something in kernel space that can be readily done in user space.

#26 lore raw
In reply to David Dillow
Quoted 2 lines

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

That would likely need initrd at least on the distro I use which uses device files very early.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#27 lore raw
Quoted 5 lines · Andi Kleen
Quoted 2 lines

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

That would likely need initrd at least on the distro I use which uses device files very early.

Or mount a tmpfs on /dev and run it right after you mount /proc and /dev. Doesn't need an initrd.

#28 lore raw
In reply to Andi Kleen
Quoted 5 lines · On Wed, 12 Aug 2009 09:31:52 +0200 Andi Kleen <[email protected]> wrote:
Quoted 2 lines

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

That would likely need initrd at least on the distro I use which uses device files very early.

nah just need to call it early in /etc/rc.sysinit.

initrd is a read herring; distros don't need an initrd (well except fedora who ship borken with a /dev without even /dev/console)

initrd and /dev are not related concepts in that sense.

Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#29 lore raw
Quoted 6 lines · Arjan van de Ven
Quoted 3 lines · On Wed, 12 Aug 2009 09:31:52 +0200 Andi Kleen <[email protected]> wrote:
Quoted 2 lines

So use Eric/Arjan's program that does it in 60ms -- you get a dynamic /dev, no initrd, fast boot, and no kernel changes required.

Quoted 8 lines
Quoted 2 lines

That would likely need initrd at least on the distro I use which uses device files very early.

nah just need to call it early in /etc/rc.sysinit.

initrd is a read herring; distros don't need an initrd (well except fedora who ship borken with a /dev without even /dev/console)

SUSE has the same problem. If the on disk /dev is empty and it typically is out of the box then and there's no initrd you don't boot.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#30 lore raw
In reply to David Dillow
Quoted 13 lines · David Dillow
Quoted 11 lines · Andi Kleen
Quoted 5 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Quoted 5 lines

If you use mount by label or UUID, you still need udev (or other tools) in the initrd to find the right disk, correct? And for distros that want to support that, does this really reduce the amount of code in the initrd?

Distros would be then free to experiment with just running "blkid" in the initramfs to find the root filesystem, rather than the udev daemon (which runs blkid itself)

Scott

Signature · 2 lines
Scott James Remnant
[email protected]
#31 lore raw
In reply to Andi Kleen
Quoted 10 lines · Andi Kleen
Quoted 4 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Oh good, I thought I was the only one doing that.

The reason I don't like udev is that it's just to slow; something like a 5-10s delay on each boot. No idea why it should be so slow, but it's probably probing the kernel for all available devices at boot, when it could be much quicker by probing for the device on access.

Thanks!

--
Al

#32 lore raw
Quoted 12 lines · Al Boldi
Quoted 10 lines · Andi Kleen
Quoted 4 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Quoted 4 lines

Oh good, I thought I was the only one doing that.

The reason I don't like udev is that it's just to slow; something like a 5-10s delay on each boot.  No idea why it should be so slow,

Because you setup is broken, I guess.

Quoted 3 lines

but it's probably
probing the kernel for all available devices at boot, when it could be much quicker by probing for the device on access.

It takes more like 0.5 - 0.7 seconds on a usual setup.

Kay

#33 lore raw
Quoted 18 lines · Kay Sievers
Quoted 12 lines · Al Boldi
Quoted 10 lines · Andi Kleen
Quoted 4 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Quoted 4 lines

Oh good, I thought I was the only one doing that.

The reason I don't like udev is that it's just to slow; something like a 5-10s delay on each boot. No idea why it should be so slow,

Quoted 7 lines

Because you setup is broken, I guess.

Quoted 3 lines

but it's probably
probing the kernel for all available devices at boot, when it could be much quicker by probing for the device on access.

It takes more like 0.5 - 0.7 seconds on a usual setup.

I don't know about your setup, but all dists I used (fedora, mandriva, ubuntu, debian) hang every boot for 5-10s.

Are you saying devtmpfs has the same delay as udev?

Thanks!

--
Al

#34 lore raw
Quoted 21 lines · Al Boldi
Quoted 20 lines · Kay Sievers
Quoted 12 lines · Al Boldi
Quoted 10 lines · Andi Kleen
Quoted 4 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Quoted 4 lines

Oh good, I thought I was the only one doing that.

The reason I don't like udev is that it's just to slow; something like a 5-10s delay on each boot.  No idea why it should be so slow,

Because you setup is broken, I guess.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

but it's probably
probing the kernel for all available devices at boot, when it could be much quicker by probing for the device on access.

It takes more like 0.5 - 0.7 seconds on a usual setup.

I don't know about your setup, but all dists I used (fedora, mandriva, ubuntu, debian) hang every boot for 5-10s.

That's just not true. If you want to solve your issue, which has nothing to do with devtmpfs, please move that to the [email protected] list.

Thanks,
Kay

author
#35 lore raw
In reply to Al Boldi
Quoted 12 lines · Al Boldi
Quoted 10 lines · Andi Kleen
Quoted 4 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Quoted 6 lines

Oh good, I thought I was the only one doing that.

The reason I don't like udev is that it's just to slow; something like a 5-10s delay on each boot. No idea why it should be so slow, but it's probably probing the kernel for all available devices at boot, when it could be much quicker by probing for the device on access.

Like Kay stated, this sounds like a misconfiguration of your distro's udev setup, as the ones I use (openSUSE and Gentoo) do not have this problem at all.

Please work with your distro and the people on the [email protected] mailing list to help resolve this issue.

thanks,

greg k-h

#36 lore raw
Quoted 15 lines · Greg KH
Quoted 14 lines · Al Boldi
Quoted 10 lines · Andi Kleen
Quoted 4 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Oh good, I thought I was the only one doing that.

Quoted 8 lines
Quoted 4 lines

The reason I don't like udev is that it's just to slow; something like a 5-10s delay on each boot. No idea why it should be so slow, but it's probably probing the kernel for all available devices at boot, when it could be much quicker by probing for the device on access.

Like Kay stated, this sounds like a misconfiguration of your distro's udev setup, as the ones I use (openSUSE and Gentoo) do not have this problem at all.

Maybe they are using the same trick as Ubuntu and Debian, as they run udev in the background to hide the slowness. Both Fedora and Mandriva run udev in the foreground where the slowness is visible.

So really, if devtmpfs compares to udev speeds then this just looks like a devfs comeback. Remember, devfs was really slow.

Thanks!

--
Al

author
#37 lore raw
Quoted 21 lines · Al Boldi
Quoted 20 lines · Greg KH
Quoted 18 lines · Al Boldi
Quoted 10 lines · Andi Kleen
Quoted 4 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Oh good, I thought I was the only one doing that.

The reason I don't like udev is that it's just to slow; something like a 5-10s delay on each boot. No idea why it should be so slow, but it's probably probing the kernel for all available devices at boot, when it could be much quicker by probing for the device on access.

Quoted 7 lines
Quoted 3 lines

Like Kay stated, this sounds like a misconfiguration of your distro's udev setup, as the ones I use (openSUSE and Gentoo) do not have this problem at all.

Maybe they are using the same trick as Ubuntu and Debian, as they run udev in the background to hide the slowness. Both Fedora and Mandriva run udev in the foreground where the slowness is visible.

No, Gentoo and openSUSE do not run udev in the background. It's all due to the different scripts the udev rules call. Fedora was known for having some pretty horrible scripts in older releases, which have hopefully been fixed in the latest releases.

Quoted 2 lines

So really, if devtmpfs compares to udev speeds then this just looks like a devfs comeback. Remember, devfs was really slow.

Again, there is no "speed" for devtmpfs on its own, the device nodes just appear when the devices are added to the kernel, the speed of that depends on the device discovery within the kernel, nothing else.

And devfs was slow? How was that measured? That's not why it was removed from the kernel, that was due to a wide variety of other reasons.

thanks,

greg k-h

#38 lore raw
Quoted 7 lines · Greg KH
Quoted 2 lines · Al Boldi

So really, if devtmpfs compares to udev speeds then this just looks like a devfs comeback. Remember, devfs was really slow.

Again, there is no "speed" for devtmpfs on its own, the device nodes just appear when the devices are added to the kernel, the speed of that depends on the device discovery within the kernel, nothing else.

So on bootup this would mean a lot of discovery.

I think we could get some big speedup, by just dumping the possible non-realized device list on bootup, and then just refine it on physical access. This could make devtmpfs an acceptable replacement to static /dev.

Thanks!

--
Al

author
#39 lore raw
Quoted 10 lines · Al Boldi
Quoted 7 lines · Greg KH
Quoted 2 lines · Al Boldi

So really, if devtmpfs compares to udev speeds then this just looks like a devfs comeback. Remember, devfs was really slow.

Again, there is no "speed" for devtmpfs on its own, the device nodes just appear when the devices are added to the kernel, the speed of that depends on the device discovery within the kernel, nothing else.

So on bootup this would mean a lot of discovery.

Yes, all of this happens within the kernel, like normal. What are you getting at?

Quoted 3 lines

I think we could get some big speedup, by just dumping the possible non-realized device list on bootup, and then just refine it on physical access. This could make devtmpfs an acceptable replacement to static /dev.

Um, that's exactly what devtmpfs does, it creates the nodes based on the fact that the devices were physically (or virtually for some devices) discovered and registered with the kernel. This happens at the same time the existing uevents are generated and sent out to userspace.

I think you are getting very confused here as to what is going on, perhaps you should read the code a bit more to understand it better.

thanks,

greg k-h

#40 lore raw
Quoted 6 lines · Greg KH
Quoted 5 lines · Al Boldi
Quoted 4 lines · Greg KH
Quoted 2 lines · Al Boldi

So really, if devtmpfs compares to udev speeds then this just looks like a devfs comeback. Remember, devfs was really slow.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Again, there is no "speed" for devtmpfs on its own, the device nodes just appear when the devices are added to the kernel, the speed of that depends on the device discovery within the kernel, nothing else.

So on bootup this would mean a lot of discovery.

Yes, all of this happens within the kernel, like normal. What are you getting at?

I am getting at boot delay. A lot of discovery means a lot of delay. A lot of delay means people will stick with static /dev.

Quoted 9 lines
Quoted 4 lines

I think we could get some big speedup, by just dumping the possible non-realized device list on bootup, and then just refine it on physical access. This could make devtmpfs an acceptable replacement to static /dev.

Um, that's exactly what devtmpfs does, it creates the nodes based on the fact that the devices were physically (or virtually for some devices) discovered and registered with the kernel. This happens at the same time the existing uevents are generated and sent out to userspace.

The question is, how fast can devtmpfs get the device list from the kernel on bootup? How much faster than udev? How much slower than static /dev?

Thanks!

--
Al

author
#41 lore raw
Quoted 11 lines · Al Boldi
Quoted 10 lines · Greg KH
Quoted 9 lines · Al Boldi
Quoted 7 lines · Greg KH
Quoted 2 lines · Al Boldi

So really, if devtmpfs compares to udev speeds then this just looks like a devfs comeback. Remember, devfs was really slow.

Again, there is no "speed" for devtmpfs on its own, the device nodes just appear when the devices are added to the kernel, the speed of that depends on the device discovery within the kernel, nothing else.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

So on bootup this would mean a lot of discovery.

Yes, all of this happens within the kernel, like normal. What are you getting at?

I am getting at boot delay. A lot of discovery means a lot of delay. A lot of delay means people will stick with static /dev.

Um, again, I don't think you understand this patch at all.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

I think we could get some big speedup, by just dumping the possible non-realized device list on bootup, and then just refine it on physical access. This could make devtmpfs an acceptable replacement to static /dev.

Quoted 7 lines
Quoted 4 lines

Um, that's exactly what devtmpfs does, it creates the nodes based on the fact that the devices were physically (or virtually for some devices) discovered and registered with the kernel. This happens at the same time the existing uevents are generated and sent out to userspace.

The question is, how fast can devtmpfs get the device list from the kernel on bootup? How much faster than udev? How much slower than static /dev?

It's much faster than udev, and is equivalent to a static /dev with the exception that the group and permission settings that you are used to. udev then needs to come along and make those settings, but that's so frickin fast it's amazing.

So, test it out and see if you want to verify this. The developers at suse, red hat, and ubuntu that do this kind of work did validate this and put their name on this patch.

thanks,

greg k-h

#42 lore raw
Quoted 4 lines · Greg KH

It's much faster than udev, and is equivalent to a static /dev with the exception that the group and permission settings that you are used to. udev then needs to come along and make those settings, but that's so frickin fast it's amazing.

Sounds great!

Quoted 1 line

So, test it out and see if you want to verify this.

Ok, can you post a patch against .30?

Thanks!

--
Al

author
#43 lore raw
Quoted 11 lines · Al Boldi
Quoted 4 lines · Greg KH

It's much faster than udev, and is equivalent to a static /dev with the exception that the group and permission settings that you are used to. udev then needs to come along and make those settings, but that's so frickin fast it's amazing.

Sounds great!

Quoted 1 line

So, test it out and see if you want to verify this.

Ok, can you post a patch against .30?

If you look in the lkml archives, the first versions of this were posted against .30 if you wish to try them out.

thanks,

greg k-h

#44 lore raw
In reply to Greg KH
Quoted 9 lines · Greg KH
Quoted 2 lines · Al Boldi

The question is, how fast can devtmpfs get the device list from the kernel on bootup? How much faster than udev? How much slower than static /dev?

It's much faster than udev, and is equivalent to a static /dev with the exception that the group and permission settings that you are used to. udev then needs to come along and make those settings, but that's so frickin fast it's amazing.

Earlier in the thread you indicated a 0.5sec speedup over udev. Is that really considered "much faster"?

I do agree that it makes sense to do this, but more from an elegance view than a performance one.

Chris

#45 lore raw
Quoted 6 lines · Chris Friesen
Quoted 5 lines · Greg KH
Quoted 2 lines · Al Boldi

The question is, how fast can devtmpfs get the device list from the kernel on bootup?  How much faster than udev?  How much slower than static /dev?

Quoted 7 lines
Quoted 4 lines

It's much faster than udev, and is equivalent to a static /dev with the exception that the group and permission settings that you are used to. udev then needs to come along and make those settings, but that's so frickin fast it's amazing.

Earlier in the thread you indicated a 0.5sec speedup over udev.  Is that really considered "much faster"?

The kernel boots up and mounts the root filesystem in less than a second these days. :)

Quoted 2 lines

I do agree that it makes sense to do this, but more from an elegance view than a performance one.

That's right. The possible speedups are mainly a side-effect of the simplicity we get by having the kernel providing us the the nodes without having hard userspace synchronization points early at bootup.

The init=/bin/sh with a fully working and correctly, regarding the dynamic major/minor numbers, populated /dev is alone reason enough to do that, I think.

Also things like "modprobe loop; losetup /dev/loop0" will just work, which do not work reliably today without waiting for userspace to create the nodes.

Kay

#46 lore raw
In reply to Chris Friesen
Quoted 11 lines · Chris Friesen
Quoted 9 lines · Greg KH
Quoted 3 lines · Al Boldi

The question is, how fast can devtmpfs get the device list from the kernel on bootup? How much faster than udev? How much slower than static /dev?

It's much faster than udev, and is equivalent to a static /dev with the exception that the group and permission settings that you are used to. udev then needs to come along and make those settings, but that's so frickin fast it's amazing.

Quoted 5 lines

Earlier in the thread you indicated a 0.5sec speedup over udev. Is that really considered "much faster"?

I do agree that it makes sense to do this, but more from an elegance view than a performance one.

It's definitely more elegant, but at what cost?

For devtmpfs to be a realistic replacement for static /dev, it has to be comparable to static /dev in both speed and size. WRT speed, there should be no slowdown and it should be just as fast as a "tar -xp < dev.tar". WRT size, it should not be dependent on hotplug, and instead offer hotplug as an option.

Thanks!

--
Al

author
#47 lore raw
Quoted 12 lines · Al Boldi
Quoted 11 lines · Chris Friesen
Quoted 9 lines · Greg KH
Quoted 3 lines · Al Boldi

The question is, how fast can devtmpfs get the device list from the kernel on bootup? How much faster than udev? How much slower than static /dev?

It's much faster than udev, and is equivalent to a static /dev with the exception that the group and permission settings that you are used to. udev then needs to come along and make those settings, but that's so frickin fast it's amazing.

Quoted 7 lines
Quoted 5 lines

Earlier in the thread you indicated a 0.5sec speedup over udev. Is that really considered "much faster"?

I do agree that it makes sense to do this, but more from an elegance view than a performance one.

It's definitely more elegant, but at what cost?

You've seen the patch, you tell me :)

Quoted 2 lines

For devtmpfs to be a realistic replacement for static /dev, it has to be comparable to static /dev in both speed and size.

Since when is this requirement necessary? You want something for free in both speed and size? Well, you got it in speed, but not size, it will take up memory that is swapable, and a tiny ammount of non-swapable kernel memory for the code.

Quoted 2 lines

WRT speed, there should be no slowdown and it should be just as fast as a "tar -xp < dev.tar".

Again, where is this requirement coming from?

Have you timed devtmpfs? Have you timed your tar extraction? What is the difference, and since when does anyone use tar of a static dev tree at boot time?

Quoted 2 lines

WRT size, it should not be dependent on hotplug, and instead offer hotplug as an option.

Um, again, who made up such a requirement? Are you running systems today with CONFIG_HOTPLUG disabled? If so, how well is that working for you?

thanks,

greg k-h

#48 lore raw
Quoted 8 lines · Greg KH
Quoted 2 lines · Al Boldi

For devtmpfs to be a realistic replacement for static /dev, it has to be comparable to static /dev in both speed and size.

Since when is this requirement necessary? You want something for free in both speed and size? Well, you got it in speed, but not size, it will take up memory that is swapable, and a tiny ammount of non-swapable kernel memory for the code.

Not so tiny when you count in the hotplug dependency.

Quoted 6 lines
Quoted 2 lines

WRT speed, there should be no slowdown and it should be just as fast as a "tar -xp < dev.tar".

Again, where is this requirement coming from?

Have you timed devtmpfs?

Not yet, I am still waiting for the latest patch against .30.

Quoted 6 lines
Quoted 2 lines

WRT size, it should not be dependent on hotplug, and instead offer hotplug as an option.

Um, again, who made up such a requirement? Are you running systems today with CONFIG_HOTPLUG disabled? If so, how well is that working for you?

It's working out quite well. I don't like hotplug, it's too slow. I always turn it and module-autoloading off, to achieve a much more responsive system.

Thanks!

--
Al

author
#49 lore raw
Quoted 11 lines · Al Boldi
Quoted 8 lines · Greg KH
Quoted 2 lines · Al Boldi

For devtmpfs to be a realistic replacement for static /dev, it has to be comparable to static /dev in both speed and size.

Since when is this requirement necessary? You want something for free in both speed and size? Well, you got it in speed, but not size, it will take up memory that is swapable, and a tiny ammount of non-swapable kernel memory for the code.

Not so tiny when you count in the hotplug dependency.

devtmpfs does not rely on hotplug at all.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

WRT speed, there should be no slowdown and it should be just as fast as a "tar -xp < dev.tar".

Again, where is this requirement coming from?

Have you timed devtmpfs?

Not yet, I am still waiting for the latest patch against .30.

I already pointed you at it.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

WRT size, it should not be dependent on hotplug, and instead offer hotplug as an option.

Um, again, who made up such a requirement? Are you running systems today with CONFIG_HOTPLUG disabled? If so, how well is that working for you?

It's working out quite well. I don't like hotplug, it's too slow. I always turn it and module-autoloading off, to achieve a much more responsive system.

What becomes "more responsive"? What is too slow?

Anyway, this is quite off-topic for the original patch. If you have problems/issues with udev and CONFIG_HOTPLUG, let's take that to the [email protected] list.

thanks,

greg k-h

#50 lore raw
Quoted 6 lines · Greg KH
Quoted 5 lines · Al Boldi
Quoted 4 lines · Greg KH
Quoted 2 lines · Al Boldi

For devtmpfs to be a realistic replacement for static /dev, it has to be comparable to static /dev in both speed and size.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Since when is this requirement necessary? You want something for free in both speed and size? Well, you got it in speed, but not size, it will take up memory that is swapable, and a tiny ammount of non-swapable kernel memory for the code.

Not so tiny when you count in the hotplug dependency.

devtmpfs does not rely on hotplug at all.

Are you sure?

This is from the patch of this thread:

Review

Quoted 3 lines
(quoted diff) +3 -0
+config DEVTMPFS
+       bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
+       depends on HOTPLUG && SHMEM && TMPFS

Thanks!

--
Al

author
#51 lore raw
Quoted 12 lines · Al Boldi
Quoted 11 lines · Greg KH
Quoted 10 lines · Al Boldi
Quoted 8 lines · Greg KH
Quoted 2 lines · Al Boldi

For devtmpfs to be a realistic replacement for static /dev, it has to be comparable to static /dev in both speed and size.

Since when is this requirement necessary? You want something for free in both speed and size? Well, you got it in speed, but not size, it will take up memory that is swapable, and a tiny ammount of non-swapable kernel memory for the code.

Quoted 10 lines
Quoted 3 lines
Quoted 1 line

Not so tiny when you count in the hotplug dependency.

devtmpfs does not rely on hotplug at all.

Are you sure?

This is from the patch of this thread:

Quoted 3 lines
(quoted diff) +3 -0
+config DEVTMPFS
+       bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
+       depends on HOTPLUG && SHMEM && TMPFS

Ah, you're right.

Ok then, since you don't run CONFIG_HOTPLUG kernels, why are you worried about this code at all?

confused,

greg k-h

#52 lore raw
Quoted 24 lines · Greg KH
Quoted 12 lines · Al Boldi
Quoted 11 lines · Greg KH
Quoted 10 lines · Al Boldi
Quoted 8 lines · Greg KH
Quoted 2 lines · Al Boldi

For devtmpfs to be a realistic replacement for static /dev, it has to be comparable to static /dev in both speed and size.

Since when is this requirement necessary? You want something for free in both speed and size? Well, you got it in speed, but not size, it will take up memory that is swapable, and a tiny ammount of non-swapable kernel memory for the code.

Quoted 10 lines
Quoted 3 lines
Quoted 1 line

Not so tiny when you count in the hotplug dependency.

devtmpfs does not rely on hotplug at all.

Are you sure?

This is from the patch of this thread:

Quoted 3 lines
(quoted diff) +3 -0
+config DEVTMPFS
+       bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
+       depends on HOTPLUG && SHMEM && TMPFS
Quoted 6 lines

Ah, you're right.

Ok then, since you don't run CONFIG_HOTPLUG kernels, why are you worried about this code at all?

confused,

Linux used to be lean and mean which made it fun to work with, and which made the switch from the competition easy. Nowadays I see a lot of bloat going into the kernel which may indicate that Linux is starting to run out of steam. devtmpfs seems bloaty due to the hotplug dependency.

Thanks!

--
Al

author
#53 lore raw
Quoted 30 lines · Al Boldi
Quoted 29 lines · Greg KH
Quoted 12 lines · Al Boldi
Quoted 11 lines · Greg KH
Quoted 10 lines · Al Boldi
Quoted 8 lines · Greg KH
Quoted 2 lines · Al Boldi

For devtmpfs to be a realistic replacement for static /dev, it has to be comparable to static /dev in both speed and size.

Since when is this requirement necessary? You want something for free in both speed and size? Well, you got it in speed, but not size, it will take up memory that is swapable, and a tiny ammount of non-swapable kernel memory for the code.

Quoted 10 lines
Quoted 3 lines
Quoted 1 line

Not so tiny when you count in the hotplug dependency.

devtmpfs does not rely on hotplug at all.

Are you sure?

This is from the patch of this thread:

Quoted 3 lines
(quoted diff) +3 -0
+config DEVTMPFS
+       bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
+       depends on HOTPLUG && SHMEM && TMPFS

Ah, you're right.

Ok then, since you don't run CONFIG_HOTPLUG kernels, why are you worried about this code at all?

Quoted 6 lines
Quoted 1 line

confused,

Linux used to be lean and mean which made it fun to work with, and which made the switch from the competition easy. Nowadays I see a lot of bloat going into the kernel which may indicate that Linux is starting to run out of steam.

That doesn't seem to make sense, if more development is happening, and our number of contributors, different companies, and rate of change is increasing, how are we "running out of steam"?

What specific development number is proof of us slowing down? I see nothing but the exact, and extreme, opposite thing happening.

Quoted 1 line

devtmpfs seems bloaty due to the hotplug dependency.

Would you use it if we fix it to remove this dependancy?

Remember, the dependancy is the other way around here, if you don't want a CONFIG_HOTPLUG system (and honestly, I really can't believe that you run a system that interacts with the real world in a non-embedded manner that way), then you do not also have the devtmpfs code. So your system will be "light and tight", right?

So what really is your objection here? That we did not let devtmpfs work within a CONFIG_HOTPLUG=n type system? Or that devtmpfs works with the existing CONFIG_HOTPLUG=y systems (i.e. 99% of the world)?

greg k-h

#54 lore raw
Quoted 9 lines · Greg KH
Quoted 4 lines · Al Boldi

Linux used to be lean and mean which made it fun to work with, and which made the switch from the competition easy. Nowadays I see a lot of bloat going into the kernel which may indicate that Linux is starting to run out of steam.

That doesn't seem to make sense, if more development is happening, and our number of contributors, different companies, and rate of change is increasing, how are we "running out of steam"?

Running out of "quality steam". Quantity can never replace Quality.

Quoted 2 lines

What specific development number is proof of us slowing down? I see nothing but the exact, and extreme, opposite thing happening.

The increasing number of regressions are probably cause for concern.

Quoted 3 lines
Quoted 1 line

devtmpfs seems bloaty due to the hotplug dependency.

Would you use it if we fix it to remove this dependancy?

Yes, if it also compares to static /dev in terms of speed.

Quoted 2 lines

So what really is your objection here? That we did not let devtmpfs work within a CONFIG_HOTPLUG=n type system?

Yes.

Quoted 2 lines

Or that devtmpfs works with
the existing CONFIG_HOTPLUG=y systems (i.e. 99% of the world)?

And that should stay an option.

Thanks!

--
Al

author
#55 lore raw
Quoted 11 lines · Al Boldi
Quoted 9 lines · Greg KH
Quoted 4 lines · Al Boldi

Linux used to be lean and mean which made it fun to work with, and which made the switch from the competition easy. Nowadays I see a lot of bloat going into the kernel which may indicate that Linux is starting to run out of steam.

That doesn't seem to make sense, if more development is happening, and our number of contributors, different companies, and rate of change is increasing, how are we "running out of steam"?

Quoted 6 lines

Running out of "quality steam". Quantity can never replace Quality.

Quoted 2 lines

What specific development number is proof of us slowing down? I see nothing but the exact, and extreme, opposite thing happening.

The increasing number of regressions are probably cause for concern.

Is that just because we are paying more attention? Or the fact that our code base is increasing? Or something else?

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

devtmpfs seems bloaty due to the hotplug dependency.

Would you use it if we fix it to remove this dependancy?

Yes, if it also compares to static /dev in terms of speed.

So again, you want something for free? Good luck.

Quoted 4 lines
Quoted 2 lines

So what really is your objection here? That we did not let devtmpfs work within a CONFIG_HOTPLUG=n type system?

Yes.

Patches gladly welcome.

Quoted 4 lines
Quoted 2 lines

Or that devtmpfs works with
the existing CONFIG_HOTPLUG=y systems (i.e. 99% of the world)?

And that should stay an option.

Again, I don't really believe that you use a CONFIG_HOTPLUG=n system in the real world, so barring a patch from you or anyone else, I'll leave it as-is.

thanks,

greg k-h

#56 lore raw
Quoted 3 lines · Greg KH

Again, I don't really believe that you use a CONFIG_HOTPLUG=n system in the real world, so barring a patch from you or anyone else, I'll leave it as-is.

That seems a bit harsh. There are lots of embedded devices that don't need hotplug.

Chris

author
#57 lore raw
Quoted 8 lines · Chris Friesen
Quoted 3 lines · Greg KH

Again, I don't really believe that you use a CONFIG_HOTPLUG=n system in the real world, so barring a patch from you or anyone else, I'll leave it as-is.

That seems a bit harsh. There are lots of embedded devices that don't need hotplug.

You seem to have missed the previous statements from Al about this topic which resulted in him ignoring my previous questions about this topic, and hence, this statement from me.

And yes, of course I know that embedded devices don't need hotplug, but again, most of them that support any kind of external device being plugged into them, use that option.

thanks,

greg "context is everything" k-h

#58 lore raw
Quoted 3 lines · Greg KH

You seem to have missed the previous statements from Al about this topic which resulted in him ignoring my previous questions about this topic, and hence, this statement from me.

I tried to answer most of your questions, but if I missed some that you need answers for, then please point them out.

Thanks!

--
Al

#59 lore raw
In reply to Al Boldi
Quoted 4 lines · Al Boldi

Maybe they are using the same trick as Ubuntu and Debian, as they run udev in the background to hide the slowness. Both Fedora and Mandriva run udev in the foreground where the slowness is visible.

Ubuntu does not run udev in the background.

Scott

Signature · 2 lines
Scott James Remnant
[email protected]
#60 lore raw
Quoted 6 lines · Scott James Remnant
Quoted 3 lines · Al Boldi

Maybe they are using the same trick as Ubuntu and Debian, as they run udev in the background to hide the slowness. Both Fedora and Mandriva run udev in the foreground where the slowness is visible.

Ubuntu does not run udev in the background.

I put a date timestamp at the beginning and end of the start command of init.d/udev, and when you stop and then start init.d/udev it shows a ~5s delay. At boot I don't see this delay, but instead see the initial date stamp, then a flurry of parallel activity, then the final date stamp, which shows the ~5s delay.

Thanks!

--
Al

#61 lore raw
Quoted 6 lines · Al Boldi
Quoted 5 lines · Scott James Remnant
Quoted 3 lines · Al Boldi

Maybe they are using the same trick as Ubuntu and Debian, as they run udev in the background to hide the slowness. Both Fedora and Mandriva run udev in the foreground where the slowness is visible.

Quoted 8 lines
Quoted 1 line

Ubuntu does not run udev in the background.

I put a date timestamp at the beginning and end of the start command of init.d/udev, and when you stop and then start init.d/udev it shows a ~5s delay. At boot I don't see this delay, but instead see the initial date stamp, then a flurry of parallel activity, then the final date stamp, which shows the ~5s delay.

That flurry of activity is the things that udev does during boot that takes the 5s.

Right now we have to block until all udev activity is complete, to ensure that /dev is populated. This patch is one solution to that problem.

Scott

Signature · 2 lines
Scott James Remnant
[email protected]
#62 lore raw
In reply to Al Boldi
Quoted 18 lines · Al Boldi
Quoted 17 lines · Greg KH
Quoted 16 lines · Al Boldi
Quoted 9 lines · Andi Kleen
Quoted 4 lines · Greg KH

It makes the userspace boot process much simpler and easier to maintain, as well as providing a way to handle rescue disks and images trivially, and it makes the kernel _less_ dependant on the early userspace bootup scripts.

As a initrd less kernel user I can really only agree: getting rid of the udev-in-initrd requirement would be a big step forward in usability. Typically I always have to pre populate
a on disk /dev manually first to get my kernels to boot.

Oh good, I thought I was the only one doing that.

The reason I don't like udev is that it's just to slow; something like a 5-10s delay on each boot. No idea why it should be so slow, but it's probably probing the kernel for all available devices at boot, when it could be much quicker by probing for the device on access.

Quoted 7 lines
Quoted 3 lines

Like Kay stated, this sounds like a misconfiguration of your distro's udev setup, as the ones I use (openSUSE and Gentoo) do not have this problem at all.

Maybe they are using the same trick as Ubuntu and Debian, as they run udev in the background to hide the slowness. Both Fedora and Mandriva run udev in the foreground where the slowness is visible.

On Fedora parallel to udev, readahead is running, which makes you think udev is slow, but in the end readahead speeds up the boot process by 10%.

Quoted 10 lines

So really, if devtmpfs compares to udev speeds then this just looks like a devfs comeback. Remember, devfs was really slow.

Thanks!

--
Al

#63 lore raw
In reply to Greg KH
Quoted 8 lines · On Wed, 5 Aug 2009 11:28:05 -0700 Greg KH <[email protected]> wrote:
Quoted 2 lines

and Arjan (who is doing about the fastest Linux boot anyone has and has better data than anyone else)

We did this work based on Arjan's work. It solves a problem that Moblin has as well, which is why Novell is using it for their Moblin-based images they are shipping. It makes things go faster, with a simpler userspace codepath, and we have the numbers as have been previously posted.

Uhm.

Quoted 6 lines
Quoted 4 lines

plus

Quoted 2 lines

Eric has shown that just making the nodes is 0.06 seconds with todays sysfs interface, and there is room for improvement,

A 0.06 speedup is still a speedup, right? :)

it really is only this much.
Do we need to post the program again that we use to make all dev nodes based on sysfs ? Including the flexibility to have non-default owners and permissions?

Quoted 2 lines

Seriously, we saw much more than that, about 0.5 what I last remember, Kay?

I would find that hard to believe, there isn't 0.5 on the table any which way you look at it.

Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#64 lore raw
In reply to Greg KH
Quoted 36 lines · Greg KH

Here's the devtmpfs patch again. For .32 it's a simple and clean patch. It's been tested and agreed by three major distros that this is a good idea. SuSE has been shipping this in their kernels for a while now with no problems, and actual speedups measured on their boot times. Gentoo also has been testing it, but we haven't gotten a tested-by: line from them yet, hopefully that will happen soon.

A number of embedded distros have also privately said they would be using this patch, I really don't understand why they don't publically want to state this, but oh well...

It's been in linux-next for many months now, with no reported regressions at all as well.

thanks,

greg k-h

--------------

From: Kay Sievers <[email protected]>

Devtmpfs lets the kernel create a tmpfs instance called devtmpfs very early at kernel initialization, before any driver-core device is registered. Every device with a major/minor will provide a device node in devtmpfs.

Devtmpfs can be changed and altered by userspace at any time, and in any way needed - just like today's udev-mounted tmpfs. Unmodified udev versions will run just fine on top of it, and will recognize an already existing kernel-created device node and use it. The default node permissions are root:root 0600. Proper permissions and user/group ownership, meaningful symlinks, all other policy still needs to be applied by userspace.

drivers/base/devtmpfs.c line 104

Quoted 10 lines
drivers/base/devtmpfs.c new file +10 -0
+	err = vfs_path_lookup(dev_mnt->mnt_root, dev_mnt,
+			      path, LOOKUP_PARENT, &nd);
+	if (err == 0) {
+		struct dentry *dentry;
+
+		/* create directory right away */
+		dentry = lookup_create(&nd, 1);
+		if (!IS_ERR(dentry)) {
+			err = vfs_mkdir(nd.path.dentry->d_inode,
+					dentry, 0775);

Is there a typo here? I think the mode should be 0755. 0755 is used
below, and that does fit better with the 0600 mode for device nodes.

Thanks
Alan

author
#65 lore raw
Quoted 37 lines · Alan Jenkins
Quoted 35 lines · Greg KH

Here's the devtmpfs patch again. For .32 it's a simple and clean patch. It's been tested and agreed by three major distros that this is a good idea. SuSE has been shipping this in their kernels for a while now with no problems, and actual speedups measured on their boot times. Gentoo also has been testing it, but we haven't gotten a tested-by: line from them yet, hopefully that will happen soon.

A number of embedded distros have also privately said they would be using this patch, I really don't understand why they don't publically want to state this, but oh well...

It's been in linux-next for many months now, with no reported regressions at all as well.

thanks,

greg k-h

--------------

From: Kay Sievers <[email protected]>

Devtmpfs lets the kernel create a tmpfs instance called devtmpfs very early at kernel initialization, before any driver-core device is registered. Every device with a major/minor will provide a device node in devtmpfs.

Devtmpfs can be changed and altered by userspace at any time, and in any way needed - just like today's udev-mounted tmpfs. Unmodified udev versions will run just fine on top of it, and will recognize an already existing kernel-created device node and use it. The default node permissions are root:root 0600. Proper permissions and user/group ownership, meaningful symlinks, all other policy still needs to be applied by userspace.

Quoted 13 lines

drivers/base/devtmpfs.c line 104

Quoted 10 lines
drivers/base/devtmpfs.c new file +10 -0
+	err = vfs_path_lookup(dev_mnt->mnt_root, dev_mnt,
+			      path, LOOKUP_PARENT, &nd);
+	if (err == 0) {
+		struct dentry *dentry;
+
+		/* create directory right away */
+		dentry = lookup_create(&nd, 1);
+		if (!IS_ERR(dentry)) {
+			err = vfs_mkdir(nd.path.dentry->d_inode,
+					dentry, 0775);

Is there a typo here? I think the mode should be 0755. 0755 is used
below, and that does fit better with the 0600 mode for device nodes.

Yeah, I think you are correct. Kay, any objection to me making this change?

thanks,

greg k-h

#66 lore raw
Quoted 10 lines · Greg KH
Quoted 5 lines · Alan Jenkins
Quoted 2 lines

+                   err = vfs_mkdir(nd.path.dentry->d_inode,
+                                   dentry, 0775);

Is there a typo here?  I think the mode should be 0755.   0755 is used below, and that does fit better with the 0600 mode for device nodes.

Yeah, I think you are correct.  Kay, any objection to me making this change?

No, sure no objection. It sounds right to use 0755. I was just waiting if more things to fix come up. :)

Thanks,
Kay

author
#67 lore raw
Quoted 6 lines · Kay Sievers
Quoted 5 lines · Greg KH
Quoted 3 lines · Alan Jenkins
Quoted 2 lines

+                   err = vfs_mkdir(nd.path.dentry->d_inode,
+                                   dentry, 0775);

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is there a typo here?  I think the mode should be 0755.   0755 is used below, and that does fit better with the 0600 mode for device nodes.

Yeah, I think you are correct.  Kay, any objection to me making this change?

No, sure no objection. It sounds right to use 0755. I was just waiting if more things to fix come up. :)

I've made this fix in the version in my tree now.

thanks,

greg k-h

#68 lore raw
In reply to Greg KH

Hi!

drivers/base/devtmpfs.c line 5

Quoted 8 lines
drivers/base/devtmpfs.c new file +5 -0
@@ -0,0 +1,367 @@
+/*
+ * devtmpfs - kernel-maintained tmpfs-based /dev
+ *
+ * Copyright (C) 2009, Kay Sievers <[email protected]>
+ *

I'd expect GPL notice here...

drivers/base/devtmpfs.c line 31

Quoted 5 lines
drivers/base/devtmpfs.c new file +5 -0
+#if defined CONFIG_DEVTMPFS_MOUNT
+static int dev_mount = 1;
+#else
+static int dev_mount;
+#endif

A bit too many config options?

drivers/base/devtmpfs.c line 58

Quoted 7 lines
drivers/base/devtmpfs.c new file +7 -0
+#ifdef CONFIG_BLOCK
+static inline int is_blockdev(struct device *dev)
+{
+	return dev->class == &block_class;
+}
+#else
+static inline int is_blockdev(struct device *dev) { return 0; }

Should this go to header somewhere?

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author
#69 lore raw
Quoted 12 lines · Pavel Machek

Hi!

drivers/base/devtmpfs.c line 5

Quoted 8 lines
drivers/base/devtmpfs.c new file +5 -0
@@ -0,0 +1,367 @@
+/*
+ * devtmpfs - kernel-maintained tmpfs-based /dev
+ *
+ * Copyright (C) 2009, Kay Sievers <[email protected]>
+ *

I'd expect GPL notice here...

But it's not needed, the overall license of the kernel covers it.

Quoted 8 lines

drivers/base/devtmpfs.c line 31

Quoted 5 lines
drivers/base/devtmpfs.c new file +5 -0
+#if defined CONFIG_DEVTMPFS_MOUNT
+static int dev_mount = 1;
+#else
+static int dev_mount;
+#endif

A bit too many config options?

It's only 1 option, is that 1 too many for you?

Quoted 9 lines

drivers/base/devtmpfs.c line 58

Quoted 7 lines
drivers/base/devtmpfs.c new file +7 -0
+#ifdef CONFIG_BLOCK
+static inline int is_blockdev(struct device *dev)
+{
+	return dev->class == &block_class;
+}
+#else
+static inline int is_blockdev(struct device *dev) { return 0; }

Should this go to header somewhere?

It could go in device.h, but do others need it?

thanks,

greg k-h

#70 lore raw
Quoted 14 lines · Greg KH
Quoted 12 lines · Pavel Machek

Hi!

drivers/base/devtmpfs.c line 5

Quoted 8 lines
drivers/base/devtmpfs.c new file +5 -0
@@ -0,0 +1,367 @@
+/*
+ * devtmpfs - kernel-maintained tmpfs-based /dev
+ *
+ * Copyright (C) 2009, Kay Sievers <[email protected]>
+ *

I'd expect GPL notice here...

Quoted 2 lines

But it's not needed, the overall license of the kernel covers it.

Maybe. Maybe not, just add the single line there...

Quoted 10 lines
Quoted 8 lines

drivers/base/devtmpfs.c line 31

Quoted 5 lines
drivers/base/devtmpfs.c new file +5 -0
+#if defined CONFIG_DEVTMPFS_MOUNT
+static int dev_mount = 1;
+#else
+static int dev_mount;
+#endif

A bit too many config options?

It's only 1 option, is that 1 too many for you?

It is two, and this option duplicates commandline option. Maybe its better to use config_cmdline at that point?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#71 lore raw
Quoted 9 lines · Pavel Machek
Quoted 9 lines
Quoted 8 lines

drivers/base/devtmpfs.c line 31

Quoted 5 lines
drivers/base/devtmpfs.c new file +5 -0
+#if defined CONFIG_DEVTMPFS_MOUNT
+static int dev_mount = 1;
+#else
+static int dev_mount;
+#endif

A bit too many config options?

Quoted 4 lines
Quoted 1 line

It's only 1 option, is that 1 too many for you?

It is two, and this option duplicates  commandline option. Maybe its better to use config_cmdline at that point?

Sure, if you want to do that, I wouldn't mind to drop the CONFIG_DEVTMPFS_MOUNT, if we mount it by default, and have the command line to overwrite the setting.

Kay

#72 lore raw
In reply to Greg KH
Quoted 1 line · Greg KH

Here's the devtmpfs patch again.

As an embedded distro maintainer, I'd really like such an approach. With ptxdist, we can today build the complete rootfs for an embedded system without root permissions - just if we want to nfs-root boot the boards during development, it doesn't work, because you have to create /dev/console, /dev/null and /dev/zero and that works only for root.

On slow embedded systems (i.e. ARM 200 MHz), note that boot times are often much slower than on full-blown x86. So any speed improvement is welcome here as well.

rsc

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author
#73 lore raw
Quoted 9 lines · Robert Schwebel
Quoted 1 line · Greg KH

Here's the devtmpfs patch again.

As an embedded distro maintainer, I'd really like such an approach. With ptxdist, we can today build the complete rootfs for an embedded system without root permissions - just if we want to nfs-root boot the boards during development, it doesn't work, because you have to create /dev/console, /dev/null and /dev/zero and that works only for root.

Quoted 3 lines

On slow embedded systems (i.e. ARM 200 MHz), note that boot times are often much slower than on full-blown x86. So any speed improvement is welcome here as well.

That's good to hear, thanks for the response, I appreciate it.

greg k-h

#74 lore raw
In reply to Robert Schwebel
Quoted 8 lines · Robert Schwebel
Quoted 1 line · Greg KH

Here's the devtmpfs patch again.

As an embedded distro maintainer, I'd really like such an approach. With ptxdist, we can today build the complete rootfs for an embedded system without root permissions - just if we want to nfs-root boot the boards during development, it doesn't work, because you have to create /dev/console, /dev/null and /dev/zero and that works only for root.

Have you tried genext2fs ? It lets you create a filesystem image complete with device nodes as a normal user.

Xav

#75 lore raw
Quoted 4 lines · Xavier Bestel
Quoted 3 lines · Robert Schwebel
Quoted 1 line · Greg KH

Here's the devtmpfs patch again.

Quoted 8 lines
Quoted 5 lines

As an embedded distro maintainer, I'd really like such an approach. With ptxdist, we can today build the complete rootfs for an embedded system without root permissions - just if we want to nfs-root boot the boards during development, it doesn't work, because you have to create /dev/console, /dev/null and /dev/zero and that works only for root.

Have you tried genext2fs ? It lets you create a filesystem image complete with device nodes as a normal user.

Creating images is no problem, we use fakeroot to create all kinds of images (JFFS2, ext2, ext3 etc). But during development, embedded people often boot their boards with tftpboot/nfsroot in order to do quick development cycles without re-flashing the hardware, and creating devicenodes on nfs-exported filesystems doesn't work without root access.

Since udev, the whole system works almost without pre-created device nodes, but for console, null and zero there is no real alternative. We use sudo right now when they are created, but that's a rather uggly solution.

rsc

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author
#77 lore raw
Quoted 11 lines · Ming Lei

2009/8/6 Greg KH <[email protected]>:

Quoted 1 line

Here's the devtmpfs patch again.  For .32 it's a simple and clean patch.

I also prefer devtmpfs.

Base on devtmpfs, we can remove polling for being ready of some asynchronous root device(usb storage, mmc, ....) easily before mounting rootfs.

      http://marc.info/?l=linux-kernel&m=124955163908015&w=2
      http://marc.info/?l=linux-kernel&m=124955166508077&w=2

Yes, I like your patches, they are in my "to apply" queue, I wanted to make sure the devtmpfs original patch was all ok first before applying. I'll get to them later this week.

thanks,

greg k-h