Skip to contentSkip to conversation

xen/manage: Use orderly_reboot() to reboot

PATCH In review Ross Lagerwall 2 participants 2 messages Jun 27, 2022 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/manage: Use orderly_reboot() to reboot

Currently when the toolstack issues a reboot, it gets translated into a call to ctrl_alt_del(). But tying reboot to ctrl-alt-del means rebooting may fail if e.g. the user has masked the ctrl-alt-del.target under systemd.

A previous attempt to fix this set the flag to force rebooting when ctrl_alt_del() is called. However, this doesn't give userspace the opportunity to block rebooting or even do any cleanup or syncing.

Instead, call orderly_reboot() which will call the "reboot" command, giving userspace the opportunity to block it or perform the usual reboot process while being independent of the ctrl-alt-del behaviour. It also matches what happens in the shutdown case.

---
 drivers/xen/manage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/manage.c +1 -1
index 3d5a384d65f7..c16df629907e 100644
@@ -205,7 +205,7 @@ static void do_poweroff(void)
 static void do_reboot(void)
 {
 	shutting_down = SHUTDOWN_POWEROFF; /* ? */
-	ctrl_alt_del();
+	orderly_reboot();
 }
 
 static struct shutdown_handler shutdown_handlers[] = {
Signature · 1 line
2.31.1
maintainer
#1 lore raw
Quoted 7 lines · Ross Lagerwall

Currently when the toolstack issues a reboot, it gets translated into a call to ctrl_alt_del(). But tying reboot to ctrl-alt-del means rebooting may fail if e.g. the user has masked the ctrl-alt-del.target under systemd.

A previous attempt to fix this set the flag to force rebooting when ctrl_alt_del() is called.

Sorry, I have problems parsing this sentence.

Quoted 18 lines

However, this doesn't give userspace the
opportunity to block rebooting or even do any cleanup or syncing.

Instead, call orderly_reboot() which will call the "reboot" command, giving userspace the opportunity to block it or perform the usual reboot process while being independent of the ctrl-alt-del behaviour. It also matches what happens in the shutdown case.

---
  drivers/xen/manage.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/manage.c +0 -0
index 3d5a384d65f7..c16df629907e 100644

drivers/xen/manage.c static void do_poweroff(void) · line 211

Quoted 8 lines
drivers/xen/manage.c +1 -1
@@ -205,7 +205,7 @@ static void do_poweroff(void)
  static void do_reboot(void)
  {
  	shutting_down = SHUTDOWN_POWEROFF; /* ? */
-	ctrl_alt_del();
+	orderly_reboot();
  }
 
  static struct shutdown_handler shutdown_handlers[] = {

The code seems to be fine.

Albeit I wonder whether we shouldn't turn shutting_down into a bool, as all that seems to be needed is "shutting_down != SHUTDOWN_INVALID" today. But this could be part of another patch.

Juergen