]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
live update: define LU_VERSION record and add it to live update stream
authorDavid Woodhouse <dwmw@amazon.co.uk>
Fri, 31 Jan 2020 23:43:44 +0000 (23:43 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 18 Mar 2020 23:42:36 +0000 (23:42 +0000)
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
xen/common/lu/restore.c
xen/common/lu/save.c
xen/include/public/migration_stream.h

index a506b99643a96825720ee0e46bafb25d4dddf198..b2ec3bb80b01561199c2bbb525abed0d35d9b5b0 100644 (file)
@@ -4,12 +4,28 @@
 #include <xen/sched.h>
 #include <xen/lu.h>
 
+#include <public/migration_stream.h>
+
 void lu_reserve_pages(struct lu_stream *stream)
 {
 }
 
 struct domain *lu_restore_domains(struct lu_stream *stream)
 {
+    struct mr_rhdr *hdr;
+
+    while ( (hdr = lu_next_record(stream)) && hdr->type != REC_TYPE_END )
+    {
+        if ( hdr->type == REC_TYPE_LU_VERSION &&
+             hdr->length == sizeof(struct mr_lu_version) )
+        {
+            const struct mr_lu_version *vers = LU_REC_DATA(hdr);
+
+            printk("Live update from Xen %d.%d\n",
+                   vers->xen_major, vers->xen_minor);
+        }
+    }
+
     panic("Implement me!\n");
 }
 
index dc5d1d75eee7e3b8d88a5d2f84139a8c7eb09ebf..10966e04e5b507434c6e0282ddf76aa8bc853626 100644 (file)
@@ -4,8 +4,20 @@
 #include <xen/lu.h>
 #include <xen/kimage.h>
 #include <xen/sched.h>
+#include <xen/version.h>
 #include <public/migration_stream.h>
 
+int lu_save_version(struct lu_stream *stream)
+{
+    struct mr_lu_version ver_rec;
+
+    ver_rec.xen_major = xen_major_version();
+    ver_rec.xen_minor = xen_minor_version();
+    return lu_stream_append_record(stream, REC_TYPE_LU_VERSION,
+                                   &ver_rec, sizeof(ver_rec));
+}
+
+
 int lu_save_domain(struct lu_stream *stream, struct domain *d)
 {
     return 0;
@@ -19,6 +31,11 @@ int lu_save_all(struct kexec_image *image)
 
     memset(&stream, 0, sizeof(stream));
 
+    rc = lu_save_version(&stream);
+
+    if ( rc )
+        goto err_notpaused;
+
     /*
      * Pause all the domains before saving the state.
      *
@@ -64,6 +81,7 @@ err:
 
     rcu_read_unlock(&domlist_read_lock);
 
+err_notpaused:
     lu_stream_free(&stream);
 
     return rc;
index de5b736362239cd35ffd3c9c8962dd5e6c2ed916..7dda153439bb6589682d22422d367a7db3386117 100644 (file)
@@ -50,6 +50,8 @@ struct mr_rhdr
 #define REC_TYPE_CHECKPOINT                 0x0000000eU
 #define REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST  0x0000000fU
 
+#define REC_TYPE_LU_VERSION                 0x40000000U
+
 #define REC_TYPE_OPTIONAL             0x80000000U
 #define REC_TYPE_LIVE_UPDATE          0x40000000U
 
@@ -112,6 +114,13 @@ struct mr_hvm_params
     struct mr_hvm_params_entry param[0];
 };
 
+/* LU_VERSION */
+struct mr_lu_version
+{
+    uint32_t xen_major;
+    uint32_t xen_minor;
+};
+
 #endif /* __XEN_MIGRATION_STREAM_H__ */
 
 /*