From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Jones <drjones@redhat.com>,
David Vrabel <david.vrabel@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH RFC/WIP 0/4] toolstack-based approach to pvhvm guest kexec
Date: Mon, 25 Aug 2014 15:42:22 +0200 [thread overview]
Message-ID: <1408974146-6519-1-git-send-email-vkuznets@redhat.com> (raw)
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
next reply other threads:[~2014-08-25 13:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-25 13:42 Vitaly Kuznetsov [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408974146-6519-1-git-send-email-vkuznets@redhat.com \
--to=vkuznets@redhat.com \
--cc=JBeulich@suse.com \
--cc=david.vrabel@citrix.com \
--cc=drjones@redhat.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).