From: David Woodhouse Date: Wed, 15 Jan 2020 16:57:08 +0000 (+0100) Subject: Add KEXEC_TYPE_LIVE_UPDATE X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8b973d0c44ac0cf86bf1285d5029784abc698f12;p=people%2Fdwmw2%2Fxen.git Add KEXEC_TYPE_LIVE_UPDATE This is identical to the default case... for now. Signed-off-by: David Woodhouse --- diff --git a/xen/common/kexec.c b/xen/common/kexec.c index a262cc5a18..a78aa4f5b0 100644 --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -404,6 +404,19 @@ static long kexec_reboot(void *_image) return 0; } +static long kexec_live_update(void *_image) +{ + struct kexec_image *image = _image; + + kexecing = TRUE; + + kexec_common_shutdown(); + machine_reboot_kexec(image); + + BUG(); + return 0; +} + static void do_crashdump_trigger(unsigned char key) { printk("'%c' pressed -> triggering crashdump\n", key); @@ -736,6 +749,7 @@ static int kexec_load_get_bits(int type, int *base, int *bit) switch ( type ) { case KEXEC_TYPE_DEFAULT: + case KEXEC_TYPE_LIVE_UPDATE: *base = KEXEC_IMAGE_DEFAULT_BASE; *bit = KEXEC_FLAG_DEFAULT_POS; break; @@ -837,6 +851,10 @@ static int kexec_exec(XEN_GUEST_HANDLE_PARAM(void) uarg) image = kexec_image[base + pos]; ret = continue_hypercall_on_cpu(0, kexec_reboot, image); break; + case KEXEC_TYPE_LIVE_UPDATE: + image = kexec_image[base + pos]; + ret = continue_hypercall_on_cpu(0, kexec_live_update, image); + break; case KEXEC_TYPE_CRASH: kexec_crash(); /* Does not return */ break; diff --git a/xen/include/public/kexec.h b/xen/include/public/kexec.h index 298381af8d..f5230286d3 100644 --- a/xen/include/public/kexec.h +++ b/xen/include/public/kexec.h @@ -71,18 +71,22 @@ */ /* - * Kexec supports two types of operation: + * Kexec supports three types of operation: * - kexec into a regular kernel, very similar to a standard reboot * - KEXEC_TYPE_DEFAULT is used to specify this type * - kexec into a special "crash kernel", aka kexec-on-panic * - KEXEC_TYPE_CRASH is used to specify this type * - parts of our system may be broken at kexec-on-panic time * - the code should be kept as simple and self-contained as possible + * - Live update into a new Xen, preserving all running domains + * - KEXEC_TYPE_LIVE_UPDATE is used to specify this type + * - Xen performs guest-transparent live migration and stores live + * update state in memory, passing it to the new Xen. */ -#define KEXEC_TYPE_DEFAULT 0 -#define KEXEC_TYPE_CRASH 1 - +#define KEXEC_TYPE_DEFAULT 0 +#define KEXEC_TYPE_CRASH 1 +#define KEXEC_TYPE_LIVE_UPDATE 2 /* The kexec implementation for Xen allows the user to load two * types of kernels, KEXEC_TYPE_DEFAULT and KEXEC_TYPE_CRASH.