udevd: respect the value of TIMEOUT in uevents
PATCH 1/2 udevd: respect the value of TIMEOUT in uevents
I believe this is the correct behaviour. I'm highlighting this change by making it a separate commit (even though the specific code will be removed in the following commit).
udev/test-udev.c +4 -1
@@ -70,7 +70,10 @@ int main(int argc, char *argv[])sigaction (SIGTERM , &act,NULL );/* trigger timeout to prevent hanging processes */ -alarm (UDEV_EVENT_TIMEOUT ); +if (udev_device_get_timeout (event->dev) >0 ) +alarm (udev_device_get_timeout (event->dev)); +else +alarm (UDEV_EVENT_TIMEOUT ); action =getenv ("ACTION" ); devpath =getenv ("DEVPATH" );
udev/udevd.c +4 -1
@@ -156,7 +156,10 @@ static void event_fork(struct udev_event *event)sigaction (SIGHUP , &act,NULL );/* set timeout to prevent hanging processes */ -alarm (UDEV_EVENT_TIMEOUT ); +if (udev_device_get_timeout (event->dev) >0 ) +alarm (udev_device_get_timeout (event->dev)); +else +alarm (UDEV_EVENT_TIMEOUT );/* apply rules, create node, symlinks */ err =udev_event_execute_rules (event, rules);
Quoted 9 lines · Alan Jenkins
I believe this is the correct behaviour. I'm highlighting this change by making it a separate commit (even though the specific code will be removed in the following commit).
-
alarm(UDEV_EVENT_TIMEOUT);
+ if (udev_device_get_timeout(event->dev)> 0)
+ alarm(udev_device_get_timeout(event->dev));
+ else
+alarm(UDEV_EVENT_TIMEOUT);
That's the kernel supplied timeout value used for the firmware loader. You really don't want to kill the event when this timeout expires. :)
The event_timeout is what we want, but that comes from the rules and is not set at this time in the daemon.
Kay
Quoted 15 lines · Kay Sievers
udev/test-udev.c int main(int argc, char *argv[]) · line 76
Quoted 12 lines · Alan Jenkins
I believe this is the correct behaviour. I'm highlighting this change by making it a separate commit (even though the specific code will be removed in the following commit).
udev/test-udev.c +4
-1-alarm (UDEV_EVENT_TIMEOUT ); +if (udev_device_get_timeout (event->dev) >0 ) +alarm (udev_device_get_timeout (event->dev)); +else +alarm (UDEV_EVENT_TIMEOUT );
Quoted 8 lines
That's the kernel supplied timeout value used for the firmware loader. You really don't want to kill the event when this timeout expires. :)
The
event_timeoutis what we want, but that comes from the rules and is not set at this time in the daemon.Kay
Ok, I'm glad I kept this separate. Don't apply patch 2 then :-). I'll remove this and resubmit.
Thanks
Alan
Quoted 1 line · Alan Jenkins
Don't apply patch 2 then :-).
No worry, we can not be that fast here. :) We need to get numbers first.
Threads don't come for free, they make udev much less reliable and harder to debug, compared to the current model. When all events share the same address space, and the memory for the events gets reused for forever, a simple bug will likely bring down the entire service, unlike today where an event process may crash, but the event management daemon will survive. Actually, I don't remember that the main udev ever crashed, and that will definitely change with the threads. :)
I'm not against a threaded udevd, but we should have a good reason to do it that way. We also need to get numbers on bigger boxes. Udev runs on boxes with many thousands of events at bootup. we've seen boxes with 20.000+ disks, where every disk has ~10 devices in sysfs. Some of the SUSE customers requested to be able to run 4000+ events in parallel, to bring the bootup time on such boxes down to a reasonable time. That all works fine with today's udev and we need to be really careful here.
Thanks,
Kay
Quoted 26 lines · Kay Sievers
Quoted 2 lines · Alan Jenkins
Don't apply patch 2 then :-).
No worry, we can not be that fast here. :) We need to get numbers first.
Threads don't come for free, they make udev much less reliable and harder to debug, compared to the current model. When all events share the same address space, and the memory for the events gets reused for forever, a simple bug will likely bring down the entire service, unlike today where an event process may crash, but the event management daemon will survive. Actually, I don't remember that the main udev ever crashed, and that will definitely change with the threads. :)
I'm not against a threaded udevd, but we should have a good reason to do it that way. We also need to get numbers on bigger boxes. Udev runs on boxes with many thousands of events at bootup. we've seen boxes with 20.000+ disks, where every disk has ~10 devices in sysfs. Some of the SUSE customers requested to be able to run 4000+ events in parallel, to bring the bootup time on such boxes down to a reasonable time. That all works fine with today's udev and we need to be really careful here.
Quoted 3 lines
Thanks,
Kay
Noted and agreed. I'll work towards a complete series which can be tested and reviewed as a whole.
Thanks
Alan