Skip to contentSkip to conversation

xen/manage: allow forcing shutdown without a userspace helper

RFC PATCH New Huang Lei 1 participant 1 message Sep 14

Subsystems (2)
lore
Share & tools
lore

Huang Lei

author
#0 lore raw

RFC PATCH 1/1 xen/manage: allow forcing shutdown without a userspace helper

From: Lei Huang <[email protected]>

Xen poweroff, halt and reboot requests are normally forwarded to a userspace helper so that the guest can perform an orderly shutdown. Some guests cannot provide a functional helper, for example when their security policy prevents a kernel-initiated helper from completing the operation.

Add the xen.force_shutdown parameter to let such guests handle toolstack shutdown requests in workqueue context. Flush filesystems synchronously before performing the transition directly in the kernel.

This is an explicit bypass rather than a timeout fallback: once a userspace helper has been executed successfully, the kernel cannot determine whether it will eventually complete the shutdown.

Keep the parameter disabled by default so existing guests retain the opportunity to perform userspace cleanup or reject a shutdown request. Enabling the parameter explicitly accepts the risk of losing userspace data which has not been committed before the request.

---

Notes:
RFC:

This is an opt-in bypass rather than a timeout fallback. Once a userspace helper has been executed successfully, the kernel cannot determine whether it will eventually complete the shutdown.

Would a kernel command-line opt-in be acceptable for this case, or should the policy be represented through XenStore instead?

Test status:

This exact xen.force_shutdown=1 version was built and booted on a Celadon Android Xen PVH guest. An xl shutdown request successfully powered off the guest through the direct kernel shutdown path.

 .../admin-guide/kernel-parameters.txt         |  7 +++
 drivers/xen/manage.c                          | 45 +++++++++++++++++--
 2 files changed, 49 insertions(+), 3 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +7 -0
index b5493a7f8f2..6beda2f3d5b 100644
@@ -8623,6 +8623,13 @@ Kernel parameters
 			fairer and the number of possible event channels is
 			much higher. Default is on (use fifo events).
 
+	xen.force_shutdown=	[XEN]
+			Force Xen toolstack poweroff, halt and reboot requests in
+			the kernel instead of invoking a userspace helper. This can
+			cause the loss of uncommitted userspace data and should only
+			be enabled for guests without a functional userspace shutdown
+			helper. The default is off.
+
 	xirc2ps_cs=	[NET,PCMCIA]
 			Format:
 			<irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
drivers/xen/manage.c +42 -3

84 lines not on this page · raw message