[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC/WIP 0/4] toolstack-based approach to pvhvm guest kexec



Here is an early prototype/proof-of-concept of an idea that instead of taking
care of all things (event channels, shared/vcpu info, grants,... ) we can
rebuild the whole domain performing kexec with toolstack.

This is a 'naive and simple' solution leveraging save/restore path. It was
tested with the changes to linux kernel listed below.

Now I'm going to take a look at how we can avoid copying memory and just
reassign it. Any ideas, suggestions and pointers are more than welcome!

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c0cb11f..b3b8ff0 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -33,6 +33,10 @@
 #include <linux/memblock.h>
 #include <linux/edd.h>
 
+#ifdef CONFIG_KEXEC
+#include <linux/kexec.h>
+#endif
+
 #include <xen/xen.h>
 #include <xen/events.h>
 #include <xen/interface/xen.h>
@@ -1810,6 +1814,22 @@ static struct notifier_block xen_hvm_cpu_notifier = {
        .notifier_call  = xen_hvm_cpu_notify,
 };
 
+#ifdef CONFIG_KEXEC
+static void xen_pvhvm_kexec_shutdown(void)
+{
+       native_machine_shutdown();
+       if (kexec_in_progress) {
+               xen_reboot(SHUTDOWN_kexec);
+       }
+}
+
+static void xen_pvhvm_crash_shutdown(struct pt_regs *regs)
+{
+       native_machine_crash_shutdown(regs);
+       xen_reboot(SHUTDOWN_kexec);
+}
+#endif
+
 static void __init xen_hvm_guest_init(void)
 {
        init_hvm_pv_info();
@@ -1826,6 +1846,10 @@ static void __init xen_hvm_guest_init(void)
        x86_init.irqs.intr_init = xen_init_IRQ;
        xen_hvm_init_time_ops();
        xen_hvm_init_mmu_ops();
+#ifdef CONFIG_KEXEC
+       machine_ops.shutdown = xen_pvhvm_kexec_shutdown;
+       machine_ops.crash_shutdown = xen_pvhvm_crash_shutdown;
+#endif
 }
 
 static bool xen_nopv = false;
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
index 9ce0839..6ccf3c1 100644
--- a/include/xen/interface/sched.h
+++ b/include/xen/interface/sched.h
@@ -107,5 +107,6 @@ struct sched_watchdog {
 #define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
 #define SHUTDOWN_crash      3  /* Tell controller we've crashed.             */
 #define SHUTDOWN_watchdog   4  /* Restart because watchdog time expired.     */
+#define SHUTDOWN_kexec      5  /* Soft-reset for kexec.                      */
 
 #endif /* __XEN_PUBLIC_SCHED_H__ */

Vitaly Kuznetsov (4):
  Introduce SHUTDOWN_kexec shutdown reason
  libxc: treat domain in SHUTDOWN_kexec state as being already suspended
  libxl: add SHUTDOWN_kexec state support
  libxl: rebuild guest domains on kexec

 tools/libxc/xc_domain_save.c      |  3 +-
 tools/libxl/libxl.c               |  1 +
 tools/libxl/libxl.h               |  1 +
 tools/libxl/libxl_dom.c           |  6 ++++
 tools/libxl/libxl_internal.h      |  1 +
 tools/libxl/libxl_types.idl       |  1 +
 tools/libxl/xl_cmdimpl.c          | 62 +++++++++++++++++++++++++++++++++++++--
 tools/python/xen/lowlevel/xl/xl.c |  1 +
 xen/include/public/sched.h        |  3 +-
 9 files changed, 75 insertions(+), 4 deletions(-)

-- 
1.9.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.