* Doing kexec reboot right in systemd @ 2012-03-22 19:14 Marti Raudsepp 2012-03-22 22:36 ` Simon Horman 2012-03-23 9:35 ` Bouchard Louis 0 siblings, 2 replies; 8+ messages in thread From: Marti Raudsepp @ 2012-03-22 19:14 UTC (permalink / raw) To: kexec list; +Cc: Simon Horman, systemd-devel, Lennart Poettering Hi list, I was recently pondering how systemd could use kexec "properly", in a reasonably general way, to make reboots faster. I exchanged an email with Poettering on the systemd list and he suggested me to ask here. My current proposal: 1. Include a template 'kexec-load.service' with kexec-tools, which distros/users could customize to load the right kernel and initrd via /sbin/kexec 2. If the user does 'systemctl enable kexec-load.service', then this service would trigger before every reboot. Loading the kernel any earlier would waste memory (5+14 MB on Ubuntu Server). Also a common reason for rebooting is to boot into a newly-installed kernel. Loading it any earlier would boot you into an older kernel. 3. During a reboot, after systemd has finished shutting down, it detects via /sys/kernel/kexec_loaded whether the kexec kernel is loaded. If 1, it performs a 'kexec -e'. If not, it does a normal reboot. ---- Lennart commented on #2 that kexec might have problems finding contiguous memory to load the kernel into, this late in the lifecycle. Do you think this is a deal-breaker for such a feature? If it's rare enough, then it might not be a problem -- we can always fall back to a normal reboot. I'm also assuming that "kexec --load" will fail atomically -- that it won't try to boot a half-loaded kernel, or boot a kernel whose initrd failed to load. Also, #3 doesn't yet work that way in systemd (currently it detects before shutdown) and Poettering hasn't agreed yet. Does this proposal seem sane to kexec folks? Did I miss anything? ---- Here are my and Poettering's initial thoughts on this matter: http://lists.freedesktop.org/archives/systemd-devel/2012-March/004760.html http://lists.freedesktop.org/archives/systemd-devel/2012-March/004764.html PS: I hope I haven't broken any rules by cross-posting this. This question seems relevant to both projects. Regards, Marti _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doing kexec reboot right in systemd 2012-03-22 19:14 Doing kexec reboot right in systemd Marti Raudsepp @ 2012-03-22 22:36 ` Simon Horman 2012-03-26 18:07 ` Lennart Poettering 2012-03-23 9:35 ` Bouchard Louis 1 sibling, 1 reply; 8+ messages in thread From: Simon Horman @ 2012-03-22 22:36 UTC (permalink / raw) To: Marti Raudsepp; +Cc: systemd-devel, kexec list, Lennart Poettering On Thu, Mar 22, 2012 at 09:14:56PM +0200, Marti Raudsepp wrote: > Hi list, Hi Marti, > I was recently pondering how systemd could use kexec "properly", in a > reasonably general way, to make reboots faster. I exchanged an email > with Poettering on the systemd list and he suggested me to ask here. > > My current proposal: > 1. Include a template 'kexec-load.service' with kexec-tools, which > distros/users could customize to load the right kernel and initrd via > /sbin/kexec > > 2. If the user does 'systemctl enable kexec-load.service', then this > service would trigger before every reboot. Loading the kernel any > earlier would waste memory (5+14 MB on Ubuntu Server). Also a common > reason for rebooting is to boot into a newly-installed kernel. Loading > it any earlier would boot you into an older kernel. > > 3. During a reboot, after systemd has finished shutting down, it > detects via /sys/kernel/kexec_loaded whether the kexec kernel is > loaded. If 1, it performs a 'kexec -e'. If not, it does a normal > reboot. > > ---- > > Lennart commented on #2 that kexec might have problems finding > contiguous memory to load the kernel into, this late in the lifecycle. > Do you think this is a deal-breaker for such a feature? If it's rare > enough, then it might not be a problem -- we can always fall back to a > normal reboot. In general kexec doesn't store the kernel in contiguous memory at load-time. Rather, when kexec -e is called the kernel is copped from (most likely) discontiguous pages) into its destination location. > I'm also assuming that "kexec --load" will fail atomically -- that it > won't try to boot a half-loaded kernel, or boot a kernel whose initrd > failed to load. Yes, that is correct. However, I speculate that there is a greater chance of the boot of a kexeced kernel failing than the same kernel booting by more conventional means on the same hardware. Primarily because there are most likely shutdown/boot paths, especially in drivers, that have not been well exercised. So while it may work well on some hardware, perhaps even most hardware, I suspect there are cases where it will fail. I guess that is where systemctl enable/disable kexec-load.service comes into play. > Also, #3 doesn't yet work that way in systemd (currently it detects > before shutdown) and Poettering hasn't agreed yet. > > Does this proposal seem sane to kexec folks? Did I miss anything? If it is desirable to use kexec as a reboot mechanism then from a kexec point of view I think your proposal makes sense. _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doing kexec reboot right in systemd 2012-03-22 22:36 ` Simon Horman @ 2012-03-26 18:07 ` Lennart Poettering 2012-03-26 18:25 ` Marti Raudsepp 0 siblings, 1 reply; 8+ messages in thread From: Lennart Poettering @ 2012-03-26 18:07 UTC (permalink / raw) To: Simon Horman; +Cc: kexec list, Marti Raudsepp, systemd-devel On Fri, 23.03.12 07:36, Simon Horman (horms@verge.net.au) wrote: > > On Thu, Mar 22, 2012 at 09:14:56PM +0200, Marti Raudsepp wrote: > > Hi list, > > Hi Marti, > > > I was recently pondering how systemd could use kexec "properly", in a > > reasonably general way, to make reboots faster. I exchanged an email > > with Poettering on the systemd list and he suggested me to ask here. > > > > My current proposal: > > 1. Include a template 'kexec-load.service' with kexec-tools, which > > distros/users could customize to load the right kernel and initrd via > > /sbin/kexec Hmm, so since this would then belong in the shutdown path of systemd, and only be added for the kexec shutdown path I actually think it would make more sense to add this into systemd itself instead of kexec-tools, to ensure the right ordering. Marti, sorry for changing my mind on this: would be great if you could prep a patch for this for systemd itself. > > 3. During a reboot, after systemd has finished shutting down, it > > detects via /sys/kernel/kexec_loaded whether the kexec kernel is > > loaded. If 1, it performs a 'kexec -e'. If not, it does a normal > > reboot. I'd like to keep kexec.target different from reboot.target by default, so that people have both options available. So, how I'd envision this: a) we introduce kexec-load.service which is always in the kexec.target shutdown path, never in reboot.target. Doesn't need to be enabled. b) kexec-load.service becomes a NOP if a kernel is already loaded c) "systemctl reboot" continues to check whether a kernel is already loaded, and if so results in kexec.target being started rather than reboot.target d) If the user wants that the machine is always rebooted via kexec, never with traditional reboot, he can manually create a symlink /etc/systemd/system/reboot.target to /etc/systemd/system/kexec.target. That way, that in general both paths always exist, unless the admin manually loaded a kernel or manually redirected all reboots to kexec. Does that make sense? Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doing kexec reboot right in systemd 2012-03-26 18:07 ` Lennart Poettering @ 2012-03-26 18:25 ` Marti Raudsepp 2012-03-27 10:01 ` Lennart Poettering 0 siblings, 1 reply; 8+ messages in thread From: Marti Raudsepp @ 2012-03-26 18:25 UTC (permalink / raw) To: Lennart Poettering; +Cc: systemd-devel, Simon Horman, kexec list On Mon, Mar 26, 2012 at 21:07, Lennart Poettering <lennart@poettering.net> wrote: > Marti, sorry for changing my mind on this: would be great if you could > prep a patch for this for systemd itself. D'oh, I already prepared a patch for kexec, although I haven't sent it out yet. > Hmm, so since this would then belong in the shutdown path of systemd, > and only be added for the kexec shutdown path I actually think it would > make more sense to add this into systemd itself instead of kexec-tools, > to ensure the right ordering. Um, why is including in systemd necessary for guaranteeing order? Seems like this should do it... [Unit] DefaultDependencies=no Before=shutdown.target umount.target final.target [Install] WantedBy=kexec.target > I'd like to keep kexec.target different from reboot.target by > default, so that people have both options available. Fair enough. > a) we introduce kexec-load.service which is always in the kexec.target > shutdown path, never in reboot.target. Doesn't need to be enabled. > > b) kexec-load.service becomes a NOP if a kernel is already loaded > > c) "systemctl reboot" continues to check whether a kernel is already > loaded, and if so results in kexec.target being started rather than > reboot.target > > d) If the user wants that the machine is always rebooted via kexec, > never with traditional reboot, he can manually create a symlink > /etc/systemd/system/reboot.target to > /etc/systemd/system/kexec.target. Yeah, agreed. Regards, Marti _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doing kexec reboot right in systemd 2012-03-26 18:25 ` Marti Raudsepp @ 2012-03-27 10:01 ` Lennart Poettering 2012-03-27 23:19 ` Simon Horman 0 siblings, 1 reply; 8+ messages in thread From: Lennart Poettering @ 2012-03-27 10:01 UTC (permalink / raw) To: Marti Raudsepp; +Cc: systemd-devel, Simon Horman, kexec list On Mon, 26.03.12 21:25, Marti Raudsepp (marti@juffo.org) wrote: > > On Mon, Mar 26, 2012 at 21:07, Lennart Poettering > <lennart@poettering.net> wrote: > > Marti, sorry for changing my mind on this: would be great if you could > > prep a patch for this for systemd itself. > > D'oh, I already prepared a patch for kexec, although I haven't sent it > out yet. OK, I am fine with either. > > Hmm, so since this would then belong in the shutdown path of systemd, > > and only be added for the kexec shutdown path I actually think it would > > make more sense to add this into systemd itself instead of kexec-tools, > > to ensure the right ordering. > > Um, why is including in systemd necessary for guaranteeing order? It isn't, but it's easier to keep early boot and late shutdown stuff in systemd. Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doing kexec reboot right in systemd 2012-03-27 10:01 ` Lennart Poettering @ 2012-03-27 23:19 ` Simon Horman 0 siblings, 0 replies; 8+ messages in thread From: Simon Horman @ 2012-03-27 23:19 UTC (permalink / raw) To: Lennart Poettering; +Cc: kexec list, Marti Raudsepp, systemd-devel On Tue, Mar 27, 2012 at 12:01:36PM +0200, Lennart Poettering wrote: > On Mon, 26.03.12 21:25, Marti Raudsepp (marti@juffo.org) wrote: > > > > > On Mon, Mar 26, 2012 at 21:07, Lennart Poettering > > <lennart@poettering.net> wrote: > > > Marti, sorry for changing my mind on this: would be great if you could > > > prep a patch for this for systemd itself. > > > > D'oh, I already prepared a patch for kexec, although I haven't sent it > > out yet. > > OK, I am fine with either. FWIW, I think systemd is a better place for this change. > > > Hmm, so since this would then belong in the shutdown path of systemd, > > > and only be added for the kexec shutdown path I actually think it would > > > make more sense to add this into systemd itself instead of kexec-tools, > > > to ensure the right ordering. > > > > Um, why is including in systemd necessary for guaranteeing order? > > It isn't, but it's easier to keep early boot and late shutdown stuff in > systemd. > > Lennart > > -- > Lennart Poettering - Red Hat, Inc. > _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doing kexec reboot right in systemd 2012-03-22 19:14 Doing kexec reboot right in systemd Marti Raudsepp 2012-03-22 22:36 ` Simon Horman @ 2012-03-23 9:35 ` Bouchard Louis 2012-03-23 18:45 ` Marti Raudsepp 1 sibling, 1 reply; 8+ messages in thread From: Bouchard Louis @ 2012-03-23 9:35 UTC (permalink / raw) To: kexec Hello, Le 22/03/2012 20:14, Marti Raudsepp a écrit : > Hi list, > > I was recently pondering how systemd could use kexec "properly", in a > reasonably general way, to make reboots faster. I exchanged an email > with Poettering on the systemd list and he suggested me to ask here. > While not done by systemd, isn't is what is done on Debian when kexec-tools is installed ? It provides a 'coldreboot' script that does the following : #!/bin/sh NOKEXECFILE=/tmp/no-kexec-reboot /bin/rm -f $NOKEXECFILE touch $NOKEXECFILE /sbin/reboot $* FWIR, using reboot will quickly kexec into a new kernel. Kind regards, ...Louis -- Louis Bouchard Backline Support Analyst Canonical Ltd Ubuntu support: http://landscape.canonical.com _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doing kexec reboot right in systemd 2012-03-23 9:35 ` Bouchard Louis @ 2012-03-23 18:45 ` Marti Raudsepp 0 siblings, 0 replies; 8+ messages in thread From: Marti Raudsepp @ 2012-03-23 18:45 UTC (permalink / raw) To: Bouchard Louis; +Cc: kexec On Fri, Mar 23, 2012 at 11:35, Bouchard Louis <louis.bouchard@canonical.com> wrote: > While not done by systemd, isn't is what is done on Debian when > kexec-tools is installed ? Thanks for pointing that out. The approach is indeed pretty similar to what I described above. I guess that means we're all in agreement. Regards, Marti _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-03-27 23:19 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-03-22 19:14 Doing kexec reboot right in systemd Marti Raudsepp 2012-03-22 22:36 ` Simon Horman 2012-03-26 18:07 ` Lennart Poettering 2012-03-26 18:25 ` Marti Raudsepp 2012-03-27 10:01 ` Lennart Poettering 2012-03-27 23:19 ` Simon Horman 2012-03-23 9:35 ` Bouchard Louis 2012-03-23 18:45 ` Marti Raudsepp
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.