xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC/WIP 0/4] toolstack-based approach to pvhvm guest kexec
@ 2014-08-25 13:42 Vitaly Kuznetsov
  2014-08-25 13:42 ` [PATCH RFC/WIP 1/4] Introduce SHUTDOWN_kexec shutdown reason Vitaly Kuznetsov
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Vitaly Kuznetsov @ 2014-08-25 13:42 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Jones, David Vrabel, Jan Beulich

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-08-26 13:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25 13:42 [PATCH RFC/WIP 0/4] toolstack-based approach to pvhvm guest kexec Vitaly Kuznetsov
2014-08-25 13:42 ` [PATCH RFC/WIP 1/4] Introduce SHUTDOWN_kexec shutdown reason Vitaly Kuznetsov
2014-08-25 14:03   ` Jan Beulich
2014-08-26 10:16   ` David Vrabel
2014-08-26 12:40     ` Jan Beulich
2014-08-26 13:25       ` David Vrabel
2014-08-25 13:42 ` [PATCH RFC/WIP 2/4] libxc: treat domain in SHUTDOWN_kexec state as being already suspended Vitaly Kuznetsov
2014-08-25 14:01   ` Andrew Cooper
2014-08-25 13:42 ` [PATCH RFC/WIP 3/4] libxl: add SHUTDOWN_kexec state support Vitaly Kuznetsov
2014-08-25 13:42 ` [PATCH RFC/WIP 4/4] libxl: rebuild guest domains on kexec Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).