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

[Xen-devel] [RFC PATCH v2 09/14] Add basic lu_save_all() shell



From: David Woodhouse <dwmw@xxxxxxxxxxxx>

---
 xen/common/kexec.c     |  6 ++++++
 xen/common/lu/Makefile |  2 +-
 xen/common/lu/save.c   | 45 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/lu.h   |  3 +++
 4 files changed, 55 insertions(+), 1 deletion(-)
 create mode 100644 xen/common/lu/save.c

diff --git a/xen/common/kexec.c b/xen/common/kexec.c
index a78aa4f5b0..658fe3d3d4 100644
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -29,6 +29,7 @@
 #include <public/elfnote.h>
 #include <xsm/xsm.h>
 #include <xen/cpu.h>
+#include <xen/lu.h>
 #ifdef CONFIG_COMPAT
 #include <compat/kexec.h>
 #endif
@@ -407,6 +408,11 @@ static long kexec_reboot(void *_image)
 static long kexec_live_update(void *_image)
 {
     struct kexec_image *image = _image;
+    int ret;
+
+    ret = lu_save_all(image);
+    if (ret)
+        return ret;
 
     kexecing = TRUE;
 
diff --git a/xen/common/lu/Makefile b/xen/common/lu/Makefile
index 68991b3ca4..7b7d975f65 100644
--- a/xen/common/lu/Makefile
+++ b/xen/common/lu/Makefile
@@ -1 +1 @@
-obj-y += stream.o
+obj-y += stream.o save.o
diff --git a/xen/common/lu/save.c b/xen/common/lu/save.c
new file mode 100644
index 0000000000..c767abd8f4
--- /dev/null
+++ b/xen/common/lu/save.c
@@ -0,0 +1,45 @@
+
+#include <xen/types.h>
+#include <xen/vmap.h>
+#include <xen/lu.h>
+#include <xen/kimage.h>
+#include <xen/sched.h>
+
+int lu_save_global(struct lu_stream *stream)
+{
+       return 0;
+}
+
+
+int lu_save_domain(struct lu_stream *stream, struct domain *d)
+{
+       return 0;
+}
+
+int lu_save_all(struct kexec_image *image)
+{
+       struct lu_stream stream;
+       struct domain *d;
+       int ret;
+
+       memset(&stream, 0, sizeof(stream));
+
+       ret = lu_save_global(&stream);
+
+       for_each_domain ( d ) {
+               if (ret)
+                       break;
+
+               ret = lu_save_domain(&stream, d);
+       }
+
+       if (!ret)
+               ret = kimage_add_live_update_data(image,
+                                                 virt_to_mfn(stream.pagelist),
+                                                 stream.nr_pages);
+
+       if (ret)
+               lu_stream_free(&stream);
+
+       return ret;
+}
diff --git a/xen/include/xen/lu.h b/xen/include/xen/lu.h
index cb2f1dbe06..6e8377b6c3 100644
--- a/xen/include/xen/lu.h
+++ b/xen/include/xen/lu.h
@@ -10,3 +10,6 @@ void *lu_stream_reserve(struct lu_stream *stream, size_t 
size);
 void lu_stream_end_reservation(struct lu_stream *stream, size_t size);
 int lu_stream_append(struct lu_stream *stream, void *data, size_t size);
 void lu_stream_free(struct lu_stream *stream);
+
+struct kexec_image;
+int lu_save_all(struct kexec_image *image);
-- 
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®.