Page MenuHomeFreeBSD

D55507.diff
No OneTemporary

D55507.diff

Index: sys/dev/xen/control/control.c
===================================================================
--- sys/dev/xen/control/control.c
+++ sys/dev/xen/control/control.c
@@ -89,7 +89,6 @@
#include <sys/vnode.h>
#include <sys/sched.h>
#include <sys/smp.h>
-#include <sys/eventhandler.h>
#include <sys/timetc.h>
#include <sys/power.h>
@@ -312,22 +311,6 @@
panic("Xen directed crash");
}
-static void
-xctrl_shutdown_final(void *arg, int howto)
-{
- /*
- * Inform the hypervisor that shutdown is complete, and specify the
- * nature of the shutdown. RB_HALT is not handled by this function.
- */
- if (KERNEL_PANICKED())
- HYPERVISOR_shutdown(SHUTDOWN_crash);
- else if ((howto & RB_POWEROFF) != 0)
- HYPERVISOR_shutdown(SHUTDOWN_poweroff);
- else if ((howto & RB_HALT) == 0)
- /* RB_POWERCYCLE or regular reset. */
- HYPERVISOR_shutdown(SHUTDOWN_reboot);
-}
-
/*------------------------------ Event Reception -----------------------------*/
static void
xctrl_on_watch_event(struct xs_watch *watch, const char **vec, unsigned int len)
@@ -434,9 +417,6 @@
xctrl->xctrl_watch.max_pending = 1;
xs_register_watch(&xctrl->xctrl_watch);
- EVENTHANDLER_REGISTER(shutdown_final, xctrl_shutdown_final, NULL,
- SHUTDOWN_PRI_LAST);
-
notify_support();
return (0);
Index: sys/xen/xen_common.c
===================================================================
--- sys/xen/xen_common.c
+++ sys/xen/xen_common.c
@@ -29,6 +29,9 @@
*/
#include <sys/param.h> /* required by xen/xen-os.h */
+#include <sys/eventhandler.h>
+#include <sys/kernel.h>
+#include <sys/reboot.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -97,3 +100,38 @@
} else
panic("Unable to register vCPU %u, rc=%d\n", cpu, rc);
}
+
+static void
+xen_shutdown_final(void *arg, int howto)
+{
+
+ /*
+ * Inform the hypervisor that shutdown is complete, and specify the
+ * nature of the shutdown. RB_HALT is not handled by this function.
+ */
+ if (KERNEL_PANICKED())
+ HYPERVISOR_shutdown(SHUTDOWN_crash);
+ else if ((howto & RB_POWEROFF) != 0)
+ HYPERVISOR_shutdown(SHUTDOWN_poweroff);
+ else if ((howto & RB_HALT) == 0)
+ /* RB_POWERCYCLE or regular reset. */
+ HYPERVISOR_shutdown(SHUTDOWN_reboot);
+}
+
+static void
+xen_setup_shutdown(void *arg)
+{
+
+ if (!xen_domain())
+ return;
+
+ /* Use the same priority as the generic shutdown_halt() handler. */
+ EVENTHANDLER_REGISTER(shutdown_final, xen_shutdown_final, NULL,
+ SHUTDOWN_PRI_LAST + 200);
+}
+/*
+ * Register the Xen hypercall based shutdown hook, the hypercall page must be
+ * initialized by now.
+ */
+SYSINIT(xen_shutdown, SI_SUB_EVENTHANDLER, SI_ORDER_ANY, xen_setup_shutdown,
+ NULL);

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 2, 11:05 AM (11 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34594384
Default Alt Text
D55507.diff (2 KB)

Event Timeline