]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
kexec: add KEXEC_TYPE_LIVE_UPDATE
authorDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 15 Jan 2020 16:57:08 +0000 (17:57 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 18 Mar 2020 23:42:31 +0000 (23:42 +0000)
This is identical to the default case... for now.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
xen/common/kexec.c
xen/common/kimage.c
xen/include/public/kexec.h

index 9af7de4df3c85a491bb01fa2aca5f388490d6297..c199d9abbd62ff6d0d184c0fe9ff1f6a7babac16 100644 (file)
@@ -405,6 +405,21 @@ static long kexec_reboot(void *_image)
     return 0;
 }
 
+#ifdef CONFIG_LIVE_UPDATE
+static long kexec_live_update(void *_image)
+{
+    struct kexec_image *image = _image;
+
+    kexecing = TRUE;
+
+    kexec_common_shutdown();
+    machine_reboot_kexec(image);
+
+    BUG();
+    return 0;
+}
+#endif /* CONFIG_LIVE_UPDATE */
+
 static void do_crashdump_trigger(unsigned char key)
 {
     printk("'%c' pressed -> triggering crashdump\n", key);
@@ -737,6 +752,9 @@ static int kexec_load_get_bits(int type, int *base, int *bit)
     switch ( type )
     {
     case KEXEC_TYPE_DEFAULT:
+#ifdef CONFIG_LIVE_UPDATE
+    case KEXEC_TYPE_LIVE_UPDATE:
+#endif
         *base = KEXEC_IMAGE_DEFAULT_BASE;
         *bit = KEXEC_FLAG_DEFAULT_POS;
         break;
@@ -838,6 +856,12 @@ 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;
+#ifdef CONFIG_LIVE_UPDATE
+    case KEXEC_TYPE_LIVE_UPDATE:
+        image = kexec_image[base + pos];
+        ret = continue_hypercall_on_cpu(0, kexec_live_update, image);
+        break;
+#endif
     case KEXEC_TYPE_CRASH:
         kexec_crash(); /* Does not return */
         break;
index 210241dfb76c3bbd1dbc2e54f4293d429edd5d99..8d55d3e8252dc5a04482bb5a2c08fbd59135676f 100644 (file)
@@ -420,6 +420,7 @@ struct page_info *kimage_alloc_control_page(struct kexec_image *image,
     switch ( image->type )
     {
     case KEXEC_TYPE_DEFAULT:
+    case KEXEC_TYPE_LIVE_UPDATE:
         pages = kimage_alloc_normal_control_page(image, memflags);
         break;
     case KEXEC_TYPE_CRASH:
@@ -774,6 +775,7 @@ static int kimage_load_segment(struct kexec_image *image, xen_kexec_segment_t *s
         switch ( image->type )
         {
         case KEXEC_TYPE_DEFAULT:
+        case KEXEC_TYPE_LIVE_UPDATE:
             result = kimage_load_normal_segment(image, segment);
             break;
         case KEXEC_TYPE_CRASH:
@@ -802,6 +804,7 @@ int kimage_alloc(struct kexec_image **rimage, uint8_t type, uint16_t arch,
     switch( type )
     {
     case KEXEC_TYPE_DEFAULT:
+    case KEXEC_TYPE_LIVE_UPDATE:
         result = kimage_normal_alloc(rimage, entry_maddr, nr_segments, segment);
         break;
     case KEXEC_TYPE_CRASH:
index 298381af8d784323e23898b6b3c021b65dba88c3..f5230286d36d63bb81b8b67cc9d08a499d7cbe4d 100644 (file)
  */
 
 /*
- * 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.