From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vitaly Kuznetsov Subject: [PATCH RFC/WIP 0/4] toolstack-based approach to pvhvm guest kexec Date: Mon, 25 Aug 2014 15:42:22 +0200 Message-ID: <1408974146-6519-1-git-send-email-vkuznets@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XLuXd-0006q7-Rb for xen-devel@lists.xenproject.org; Mon, 25 Aug 2014 13:42:37 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Andrew Jones , David Vrabel , Jan Beulich List-Id: xen-devel@lists.xenproject.org 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 #include +#ifdef CONFIG_KEXEC +#include +#endif + #include #include #include @@ -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