[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH v3 21/22] x86/setup: finish plumbing in live update path through __start_xen()



From: David Woodhouse <dwmw@xxxxxxxxxxxx>

With this we are fairly much done hacking up __start_xen() to support
live update. The live update functions themselves are still stubs,
but now we can start populating those with actual save/restore of
domain information.

Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
 xen/arch/x86/setup.c    | 52 +++++++++++++++++++++++++++--------------
 xen/common/lu/restore.c |  5 ++++
 xen/include/xen/lu.h    |  2 ++
 3 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ac93965be4..53f7b9ced4 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -816,7 +816,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     unsigned int initrdidx, num_parked = 0;
     multiboot_info_t *mbi;
     module_t *mod;
-    unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1];
+    unsigned long nr_pages, raw_max_page, modules_headroom = 0, module_map[1];
     int i, j, e820_warn = 0, bytes = 0;
     bool acpi_boot_table_init_done = false, relocated = false, lu_reserved = 
false;
     int ret;
@@ -992,7 +992,8 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     }
 
     bitmap_fill(module_map, mbi->mods_count);
-    __clear_bit(0, module_map); /* Dom0 kernel is always first */
+    if ( !lu_breadcrumb_phys )
+        __clear_bit(0, module_map); /* Dom0 kernel is always first */
 
     if ( pvh_boot )
     {
@@ -1151,8 +1152,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         mod[mbi->mods_count].mod_end = __2M_rwdata_end - _stext;
     }
 
-    modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
-    bootstrap_map(NULL);
+
+    if ( !lu_breadcrumb_phys )
+    {
+        modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
+        bootstrap_map(NULL);
+    }
 
 #ifndef highmem_start
     /* Don't allow split below 4Gb. */
@@ -1976,21 +1981,32 @@ void __init noreturn __start_xen(unsigned long mbi_p)
            cpu_has_nx ? XENLOG_INFO : XENLOG_WARNING "Warning: ",
            cpu_has_nx ? "" : "not ");
 
-    initrdidx = find_first_bit(module_map, mbi->mods_count);
-    if ( bitmap_weight(module_map, mbi->mods_count) > 1 )
-        printk(XENLOG_WARNING
-               "Multiple initrd candidates, picking module #%u\n",
-               initrdidx);
 
-    /*
-     * We're going to setup domain0 using the module(s) that we stashed safely
-     * above our heap. The second module, if present, is an initrd ramdisk.
-     */
-    dom0 = create_dom0(mod, modules_headroom,
-                       (initrdidx > 0) && (initrdidx < mbi->mods_count)
-                       ? mod + initrdidx : NULL, kextra, loader);
-    if ( dom0 == NULL )
-        panic("Could not set up DOM0 guest OS\n");
+    if ( lu_breadcrumb_phys )
+    {
+        dom0 = lu_restore_domains(&lu_stream);
+        if ( dom0 == NULL )
+            panic("No DOM0 found in live update data\n");
+
+        lu_stream_free(&lu_stream);
+    }
+    else
+    {
+        initrdidx = find_first_bit(module_map, mbi->mods_count);
+        if ( bitmap_weight(module_map, mbi->mods_count) > 1 )
+            printk(XENLOG_WARNING
+                   "Multiple initrd candidates, picking module #%u\n",
+                   initrdidx);
+        /*
+         * We're going to setup domain0 using the module(s) that we stashed
+         * safely above our heap. The second module, if present, is an initrd.
+         */
+        dom0 = create_dom0(mod, modules_headroom,
+                           (initrdidx > 0) && (initrdidx < mbi->mods_count)
+                           ? mod + initrdidx : NULL, kextra, loader);
+        if ( dom0 == NULL )
+            panic("Could not set up DOM0 guest OS\n");
+    }
 
     heap_init_late();
 
diff --git a/xen/common/lu/restore.c b/xen/common/lu/restore.c
index f52bb660d2..163827f5de 100644
--- a/xen/common/lu/restore.c
+++ b/xen/common/lu/restore.c
@@ -23,6 +23,11 @@ void lu_reserve_pages(struct lu_stream *stream)
     }
 }
 
+struct domain *lu_restore_domains(struct lu_stream *stream)
+{
+    panic("Implement me!\n");
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/lu.h b/xen/include/xen/lu.h
index 588f2dd137..817a88b77a 100644
--- a/xen/include/xen/lu.h
+++ b/xen/include/xen/lu.h
@@ -31,6 +31,8 @@ int lu_save_all(struct kexec_image *image);
 
 void lu_stream_map(struct lu_stream *stream, unsigned long mfns_phys, int 
nr_pages);
 void lu_reserve_pages(struct lu_stream *stream);
+/* Returns Dom0 in case the architecture needs to do anything special to it */
+struct domain *lu_restore_domains(struct lu_stream *stream);
 
 /* Pointer to the data immediately following a record header */
 #define LU_REC_DATA(hdr) ((void *)&(hdr)[1])
-- 
2.21.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.