invalidating udev cache, how?
Hi,
The udev 124 has cache (/etc/dev.tar) to avoid doing the coldplug udev dance that can take a few seconds to a minute depending on machine speed and kernel options. It is working a bit too well at the moment:
* user boots image with 2.6.26 kernel on an omap board
* user gets /dev/fb0
* user fixes the bootargs in uboot to enable the overlay
* user doesn't get /dev/fb1
so remove /etc/dev.tar and reboot: /dev/fb1 appears.
I also encountered a case where the permissions on /dev/null where wrong during first boot (it's a mystery why that happened) and udev cached those making ssh daemons fail on boot.
My current ideas:
1) remove /etc/dev.tar if its > x weeks old
2) recreate it on shutdown
3) remove it after x times
option 1) breaks on systems without an RTC and/or no /etc/timestamp option 2) moves the slowness to shutdown
option 3) requires extra logic and filesystem access
and all options don't fix the first case I mentioned, they all take a while to make /dev/fb1 appear.
The key is that it should be transparent to users, so adding a check for .e.g 'ignore_dev.tar=1' in bootargs wouldn't work, since that implies that users are aware of the problem and know how to 'fix' it.
Does anyone have other ways to invalidate the cache, and if not, which option would get your vote?
regards,
Koen
Quoted 23 lines · Koen Kooi
Hi,
The udev 124 has cache (
/etc/dev.tar) to avoid doing the coldplug udev dance that can take a few seconds to a minute depending on machine speed and kernel options. It is working a bit too well at the moment:* user boots image with 2.6.26 kernel on an omap board
* user gets/dev/fb0
* user fixes the bootargs in uboot to enable the overlay
* user doesn't get/dev/fb1so remove
/etc/dev.tarand reboot:/dev/fb1appears.I also encountered a case where the permissions on
/dev/nullwhere wrong during first boot (it's a mystery why that happened) and udev cached those making ssh daemons fail on boot.My current ideas:
1) remove
/etc/dev.tarif its > x weeks old
2) recreate it on shutdown
3) remove it after x timesoption 1) breaks on systems without an RTC and/or no
/etc/timestampoption 2) moves the slowness to shutdown
option 3) requires extra logic and filesystem access
Quoted 5 lines
and all options don't fix the first case I mentioned, they all take a while to make
/dev/fb1appear.The key is that it should be transparent to users, so adding a check for .e.g 'ignore_dev.tar=1' in bootargs wouldn't work, since that implies that users are aware of the problem and know how to 'fix' it.
Does anyone have other ways to invalidate the cache, and if not, which option would get your vote?
I don't think it should be invalidated automagically. Problems only happen if some bootloader args are changed, don't they? In this case its ok to let the user unvalidate the cache. (A user who changes bootloader arguments should be able to do this. )
But maybe we should add a message to udev script like:
udev: no coldplugging, using /etc/udev.tar as cache
to make it more obvious that udev uses a cache.
Regards,
Thomas
Koen Kooi wrote:
...
Quoted 13 lines
My current ideas:
1) remove
/etc/dev.tarif its > x weeks old
2) recreate it on shutdown
3) remove it after x timesoption 1) breaks on systems without an RTC and/or no
/etc/timestampoption 2) moves the slowness to shutdown
option 3) requires extra logic and filesystem accessand all options don't fix the first case I mentioned, they all take a while to make
/dev/fb1appear.
Quoted 6 lines
The key is that it should be transparent to users, so adding a check for .e.g 'ignore_dev.tar=1' in bootargs wouldn't work, since that implies that users are aware of the problem and know how to 'fix' it.
Does anyone have other ways to invalidate the cache, and if not, which option would get your vote?
A slight improvement would be to make the dev.tar file dependent upon the bootargs; i.e. invalidate /etc/dev.tar file if the boot command line doesn't match the current command line. This could be a very fast operation, just "cmp /proc/cmdline /etc/dev_cmdline" or similar.
Mike (mwester)
Quoted 37 lines · Thomas Kunze
Quoted 30 lines · Koen Kooi
Hi,
The udev 124 has cache (
/etc/dev.tar) to avoid doing the coldplug udev dance that can take a few seconds to a minute depending on machine speed and kernel options. It is working a bit too well at the moment:* user boots image with 2.6.26 kernel on an omap board
* user gets/dev/fb0
* user fixes the bootargs in uboot to enable the overlay
* user doesn't get/dev/fb1so remove
/etc/dev.tarand reboot:/dev/fb1appears.I also encountered a case where the permissions on
/dev/nullwhere wrong during first boot (it's a mystery why that happened) and udev cached those making ssh daemons fail on boot.My current ideas:
1) remove
/etc/dev.tarif its > x weeks old
2) recreate it on shutdown
3) remove it after x timesoption 1) breaks on systems without an RTC and/or no
/etc/timestampoption 2) moves the slowness to shutdown
option 3) requires extra logic and filesystem accessand all options don't fix the first case I mentioned, they all take a while to make
/dev/fb1appear.Quoted 6 lines
The key is that it should be transparent to users, so adding a check for .e.g 'ignore_dev.tar=1' in bootargs wouldn't work, since that implies that users are aware of the problem and know how to 'fix' it.
Does anyone have other ways to invalidate the cache, and if not, which option would get your vote?
Quoted 7 lines
I don't think it should be invalidated automagically. Problems only happen if some bootloader args are changed, don't they? In this case its ok to let the user unvalidate the cache. (A user who changes bootloader arguments should be able to do this. )
But maybe we should add a message to udev script like:
udev: no coldplugging, using/etc/udev.taras cache
to make it more obvious that udev uses a cache.
Bootloader args, kernel updates and even changing a powersupply or usb hub can change the dev nodes, so putting the burden on the (usually unsuspecting) user is not an option. Or imagine things like the BUG where coldplugging your modules won't work, only hot-plugging.
regards,
Koen
Quoted 4 lines · Mike (mwester)
A slight improvement would be to make the dev.tar file dependent upon the bootargs; i.e. invalidate
/etc/dev.tarfile if the boot command line doesn't match the current command line. This could be a very fast operation, just "cmp/proc/cmdline/etc/dev_cmdline" or similar.
As I consider this further, we could actually just save and compare /proc/atags if that's present on the device in question (falling back to /proc/cmdline if not present). That would catch *any* changes passed in to the kernel via the bootloader.
Flashing a new kernel would seem to be another logical place to invalidate the cache, so adding a comparison of "uname -rv" would be a reasonable way to catch that.
Mike (mwester)
Quoted 30 lines · Koen Kooi
Hi,
The udev 124 has cache (
/etc/dev.tar) to avoid doing the coldplug udev dance that can take a few seconds to a minute depending on machine speed and kernel options. It is working a bit too well at the moment:* user boots image with 2.6.26 kernel on an omap board
* user gets/dev/fb0
* user fixes the bootargs in uboot to enable the overlay
* user doesn't get/dev/fb1so remove
/etc/dev.tarand reboot:/dev/fb1appears.I also encountered a case where the permissions on
/dev/nullwhere wrong during first boot (it's a mystery why that happened) and udev cached those making ssh daemons fail on boot.My current ideas:
1) remove
/etc/dev.tarif its > x weeks old
2) recreate it on shutdown
3) remove it after x timesoption 1) breaks on systems without an RTC and/or no
/etc/timestampoption 2) moves the slowness to shutdown
option 3) requires extra logic and filesystem accessand all options don't fix the first case I mentioned, they all take a while to make
/dev/fb1appear.
Quoted 6 lines
The key is that it should be transparent to users, so adding a check for .e.g 'ignore_dev.tar=1' in bootargs wouldn't work, since that implies that users are aware of the problem and know how to 'fix' it.
Does anyone have other ways to invalidate the cache, and if not, which option would get your vote?
2 is a different (and perhaps not as) slow. Also, prepopulate the cache with fb1? Or is this all done on the live system with nothing done during image creation?
Signature · 1 line
Tom Rini
Quoted 19 lines · Mike (mwester)
Koen Kooi wrote:
...Quoted 17 lines
My current ideas:
1) remove
/etc/dev.tarif its> x weeks old
2) recreate it on shutdown
3) remove it after x timesoption 1) breaks on systems without an RTC and/or no
/etc/timestampoption 2) moves the slowness to shutdown
option 3) requires extra logic and filesystem accessand all options don't fix the first case I mentioned, they all take a while to make
/dev/fb1appear.The key is that it should be transparent to users, so adding a check for .e.g 'ignore_dev.tar=1' in bootargs wouldn't work, since that implies that users are aware of the problem and know how to 'fix' it.
Quoted 7 lines
Quoted 2 lines
Does anyone have other ways to invalidate the cache, and if not, which option would get your vote?
A slight improvement would be to make the dev.tar file dependent upon the bootargs; i.e. invalidate
/etc/dev.tarfile if the boot command line doesn't match the current command line. This could be a very fast operation, just "cmp/proc/cmdline/etc/dev_cmdline" or similar.
That solves only part of the problem, since on omap3 we enable a different fb driver that doesn't require any bootargs (and safely ignores the ones for the old driver) and gives you an additional overlay (/dev/fb2).
But I think combining the 'cmp /proc/cmdline /etc/dev_cmdline' with option 2) would solve most of the problems I'm seeing in a not-too-ugly way :)
Thanks for the suggestion!
regards,
Koen
Quoted 35 lines · Tom Rini
Quoted 34 lines · Koen Kooi
Hi,
The udev 124 has cache (
/etc/dev.tar) to avoid doing the coldplug udev dance that can take a few seconds to a minute depending on machine speed and kernel options. It is working a bit too well at the moment:* user boots image with 2.6.26 kernel on an omap board
* user gets/dev/fb0
* user fixes the bootargs in uboot to enable the overlay
* user doesn't get/dev/fb1so remove
/etc/dev.tarand reboot:/dev/fb1appears.I also encountered a case where the permissions on
/dev/nullwhere wrong during first boot (it's a mystery why that happened) and udev cached those making ssh daemons fail on boot.My current ideas:
1) remove
/etc/dev.tarif its> x weeks old
2) recreate it on shutdown
3) remove it after x timesoption 1) breaks on systems without an RTC and/or no
/etc/timestampoption 2) moves the slowness to shutdown
option 3) requires extra logic and filesystem accessand all options don't fix the first case I mentioned, they all take a while to make
/dev/fb1appear.The key is that it should be transparent to users, so adding a check for .e.g 'ignore_dev.tar=1' in bootargs wouldn't work, since that implies that users are aware of the problem and know how to 'fix' it.
Quoted 6 lines
Quoted 2 lines
Does anyone have other ways to invalidate the cache, and if not, which option would get your vote?
2 is a different (and perhaps not as) slow. Also, prepopulate the cache with fb1? Or is this all done on the live system with nothing done during image creation?
It's done during first boot, since as the problem points out everything is highly dependant on bootloader/kernel/moonphase.
regards,
Koen
Quoted 7 lines · Mike (mwester)
Quoted 4 lines · Mike (mwester)
A slight improvement would be to make the dev.tar file dependent upon the bootargs; i.e. invalidate
/etc/dev.tarfile if the boot command line doesn't match the current command line. This could be a very fast operation, just "cmp/proc/cmdline/etc/dev_cmdline" or similar.
Quoted 8 lines
As I consider this further, we could actually just save and compare
/proc/atagsif that's present on the device in question (falling back to/proc/cmdlineif not present). That would catch *any* changes passed in to the kernel via the bootloader.Flashing a new kernel would seem to be another logical place to invalidate the cache, so adding a comparison of "uname -rv" would be a reasonable way to catch that.
That should indeed take care of bootargs and kernel version changes. I'm still tempted to add option 2) to all that :)
regards,
Koen
Quoted 39 lines · Koen Kooi
Quoted 38 lines · Tom Rini
Quoted 36 lines · Koen Kooi
Hi,
The udev 124 has cache (
/etc/dev.tar) to avoid doing the coldplug udev dance that can take a few seconds to a minute depending on machine speed and kernel options. It is working a bit too well at the moment:* user boots image with 2.6.26 kernel on an omap board
* user gets/dev/fb0
* user fixes the bootargs in uboot to enable the overlay
* user doesn't get/dev/fb1so remove
/etc/dev.tarand reboot:/dev/fb1appears.I also encountered a case where the permissions on
/dev/nullwhere wrong during first boot (it's a mystery why that happened) and udev cached those making ssh daemons fail on boot.My current ideas:
1) remove
/etc/dev.tarif its> x weeks old
2) recreate it on shutdown
3) remove it after x timesoption 1) breaks on systems without an RTC and/or no
/etc/timestampoption 2) moves the slowness to shutdown
option 3) requires extra logic and filesystem accessand all options don't fix the first case I mentioned, they all take a while to make
/dev/fb1appear.The key is that it should be transparent to users, so adding a check for .e.g 'ignore_dev.tar=1' in bootargs wouldn't work, since that implies that users are aware of the problem and know how to 'fix' it.
Does anyone have other ways to invalidate the cache, and if not, which option would get your vote?
Quoted 6 lines
Quoted 3 lines
2 is a different (and perhaps not as) slow. Also, prepopulate the cache with fb1? Or is this all done on the live system with nothing done during image creation?
It's done during first boot, since as the problem points out everything is highly dependant on bootloader/kernel/moonphase.
Right. I was thinking about this more. That's why internally we do this differently. First, what you want cached is only the stuff that will be cold-plugged (ie whats built into the kernel only, not the modules to be loaded up after we start udev). The easy way out is what we do, provide the full cache as part of the image (and it's OK if you have fb[012]), and the board guy says "OK, this is ready, here's the udev cache".
Signature · 1 line
Tom Rini
Quoted 13 lines · Koen Kooi
Quoted 12 lines · Mike (mwester)
Quoted 4 lines · Mike (mwester)
A slight improvement would be to make the dev.tar file dependent upon the bootargs; i.e. invalidate
/etc/dev.tarfile if the boot command line doesn't match the current command line. This could be a very fast operation, just "cmp/proc/cmdline/etc/dev_cmdline" or similar.As I consider this further, we could actually just save and compare
/proc/atagsif that's present on the device in question (falling back to/proc/cmdlineif not present). That would catch *any* changes passed in to the kernel via the bootloader.
Quoted 6 lines
Quoted 3 lines
Flashing a new kernel would seem to be another logical place to invalidate the cache, so adding a comparison of "uname -rv" would be a reasonable way to catch that.
That should indeed take care of bootargs and kernel version changes. I'm still tempted to add option 2) to all that :)
Updating the cache at shutdown means you can end up with random hotplugged junk sticking around. It's probably not much messier than just starting out with a few maybe nodes in your cache, but it's worth noting.
Signature · 1 line
Tom Rini
Quoted 45 lines · Tom Rini
Quoted 36 lines · Koen Kooi
Quoted 35 lines · Tom Rini
Quoted 34 lines · Koen Kooi
Hi,
The udev 124 has cache (
/etc/dev.tar) to avoid doing the coldplug udev dance that can take a few seconds to a minute depending on machine speed and kernel options. It is working a bit too well at the moment:* user boots image with 2.6.26 kernel on an omap board
* user gets/dev/fb0
* user fixes the bootargs in uboot to enable the overlay
* user doesn't get/dev/fb1so remove
/etc/dev.tarand reboot:/dev/fb1appears.I also encountered a case where the permissions on
/dev/nullwhere wrong during first boot (it's a mystery why that happened) and udev cached those making ssh daemons fail on boot.My current ideas:
1) remove
/etc/dev.tarif its> x weeks old
2) recreate it on shutdown
3) remove it after x timesoption 1) breaks on systems without an RTC and/or no
/etc/timestampoption 2) moves the slowness to shutdown
option 3) requires extra logic and filesystem accessand all options don't fix the first case I mentioned, they all take a while to make
/dev/fb1appear.The key is that it should be transparent to users, so adding a check for .e.g 'ignore_dev.tar=1' in bootargs wouldn't work, since that implies that users are aware of the problem and know how to 'fix' it.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Does anyone have other ways to invalidate the cache, and if not, which option would get your vote?
2 is a different (and perhaps not as) slow. Also, prepopulate the cache with fb1? Or is this all done on the live system with nothing done during image creation?
It's done during first boot, since as the problem points out everything is highly dependant on bootloader/kernel/moonphase.
Quoted 7 lines
Right. I was thinking about this more. That's why internally we do this differently. First, what you want cached is only the stuff that will be cold-plugged (ie whats built into the kernel only, not the modules to be loaded up after we start udev). The easy way out is what we do, provide the full cache as part of the image (and it's OK if you have fb[012]), and the board guy says "OK, this is ready, here's the udev cache".
That also makes it pretty much machines specific, which is something I'd like to avoid. But you're right, it would make things slightly better, but it doesn't scale with kernel versions, bootargs variations, board variations and general appearances of Murphy. And the boards I'm working with now have a lot of usb drivers builtin, and I will need to spend a lot of time on google to work out all the devnodes.
regards,
Koen
Quoted 1 line · Koen Kooi
On 04-12-08 19:49, Tom Rini wrote:
[snip]
Quoted 8 lines
Quoted 7 lines
Right. I was thinking about this more. That's why internally we do this differently. First, what you want cached is only the stuff that will be cold-plugged (ie whats built into the kernel only, not the modules to be loaded up after we start udev). The easy way out is what we do, provide the full cache as part of the image (and it's OK if you have fb[012]), and the board guy says "OK, this is ready, here's the udev cache".
Quoted 7 lines
That also makes it pretty much machines specific, which is something I'd like to avoid. But you're right, it would make things slightly better, but it doesn't scale with kernel versions, bootargs variations, board variations and general appearances of Murphy.
And the boards I'm working with now have a lot of usb drivers builtin, and I will need to spend a lot of time on google to work out all the devnodes.
I'm not sure it won't scale, but honestly I do have a much more controlled environment. But, I see it being a generic hook (if it exists, use it) that's machine specific (so it's always machine correct) being a feature, not a bug. bootargs and board variations don't matter here, your machine-specific cache should have every cold-plug device present (again, wasting space on a few extra dev nodes saves sanity and prevents non-working situations later).
Also, USB is exactly what you don't want to have cached. When I was investigating this a while back, it was ptys and other very common stuff that was 95% of the nodes being created. The rest was framebuffer, UBI control and so on. But even with USB, it comes down to what's going to get a coldplug faked hotplug, not what will be plugged in later. External devices that stay plugged in through a reset can be re-created in the background and will exist before the user can really do anything, I'm willing to be (as that's what I saw on our boards).
Quoted 11 lines
regards,
Koen
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Signature · 1 line
Tom Rini
Quoted 13 lines · Koen Kooi
Quoted 12 lines · Mike (mwester)
Quoted 4 lines · Mike (mwester)
A slight improvement would be to make the dev.tar file dependent upon the bootargs; i.e. invalidate
/etc/dev.tarfile if the boot command line doesn't match the current command line. This could be a very fast operation, just "cmp/proc/cmdline/etc/dev_cmdline" or similar.As I consider this further, we could actually just save and compare
/proc/atagsif that's present on the device in question (falling back to/proc/cmdlineif not present). That would catch *any* changes passed in to the kernel via the bootloader.
Quoted 6 lines
Quoted 3 lines
Flashing a new kernel would seem to be another logical place to invalidate the cache, so adding a comparison of "uname -rv" would be a reasonable way to catch that.
That should indeed take care of bootargs and kernel version changes. I'm still tempted to add option 2) to all that :)
Sorry for bringing up this old discussion. Are there any plans to implement the above checks in udev?
Signature · 1 line
Denys
Quoted 13 lines · Denys Dmytriyenko
Quoted 12 lines · Koen Kooi
Quoted 11 lines · Mike (mwester)
Quoted 4 lines · Mike (mwester)
A slight improvement would be to make the dev.tar file dependent upon the bootargs; i.e. invalidate
/etc/dev.tarfile if the boot command line doesn't match the current command line. This could be a very fast operation, just "cmp/proc/cmdline/etc/dev_cmdline" or similar.As I consider this further, we could actually just save and compare
/proc/atagsif that's present on the device in question (falling back to/proc/cmdlineif not present). That would catch *any* changes passed in to the kernel via the bootloader.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Flashing a new kernel would seem to be another logical place to invalidate the cache, so adding a comparison of "uname -rv" would be a reasonable way to catch that.
That should indeed take care of bootargs and kernel version changes. I'm still tempted to add option 2) to all that :)
Sorry for bringing up this old discussion. Are there any plans to implement the above checks in udev?
Plans yes, time no :(
regards,
Koen
Quoted 17 lines · Koen Kooi
Quoted 16 lines · Denys Dmytriyenko
Quoted 15 lines · Koen Kooi
Quoted 14 lines · Mike (mwester)
Quoted 4 lines · Mike (mwester)
A slight improvement would be to make the dev.tar file dependent upon the bootargs; i.e. invalidate
/etc/dev.tarfile if the boot command line doesn't match the current command line. This could be a very fast operation, just "cmp/proc/cmdline/etc/dev_cmdline" or similar.As I consider this further, we could actually just save and compare
/proc/atagsif that's present on the device in question (falling back to/proc/cmdlineif not present). That would catch *any* changes passed in to the kernel via the bootloader.Flashing a new kernel would seem to be another logical place to invalidate the cache, so adding a comparison of "uname -rv" would be a reasonable way to catch that.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
That should indeed take care of bootargs and kernel version changes. I'm still tempted to add option 2) to all that :)
Sorry for bringing up this old discussion. Are there any plans to implement the above checks in udev?
Plans yes, time no :(
Can we make sure they're optional?
Signature · 1 line
Tom Rini