xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>, "Wei Liu" <wl@xen.org>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	"George Dunlap" <George.Dunlap@eu.citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Varad Gautam" <vrd@amazon.de>,
	paul@xen.org, "Ian Jackson" <ian.jackson@eu.citrix.com>,
	"Hongyan Xia" <hongyxia@amazon.com>, "Amit Shah" <aams@amazon.de>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [RFC PATCH v2 09/14] Add basic lu_save_all() shell
Date: Wed, 22 Jan 2020 08:53:52 +0000	[thread overview]
Message-ID: <20200122085357.2092778-9-dwmw2@infradead.org> (raw)
In-Reply-To: <20200122085357.2092778-1-dwmw2@infradead.org>

From: David Woodhouse <dwmw@amazon.co.uk>

---
 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2020-01-22  8:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22  8:53 [Xen-devel] [RFC PATCH v2 0/14] Live update: boot memory management, data stream handling David Woodhouse
2020-01-22  8:53 ` [Xen-devel] [RFC PATCH v2 01/14] x86/setup: Don't skip 2MiB underneath relocated Xen image David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 02/14] x86/boot: Reserve live update boot memory David Woodhouse
2020-01-28 14:55     ` Wei Liu
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 03/14] Don't add unused parts of live update reserved bootmem to heap David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 04/14] Add KEXEC_RANGE_MA_LIVEUPDATE David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 05/14] Add KEXEC_TYPE_LIVE_UPDATE David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 06/14] Add IND_WRITE64 primitive to kexec kimage David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 07/14] Add kimage_add_live_update_data() David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 08/14] Add basic live update stream creation David Woodhouse
2020-01-22  8:53   ` David Woodhouse [this message]
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 10/14] Put *something* into LU data David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 11/14] Don't panic if no multiboot modules are provided on live update boot David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 12/14] Don't add bad pages above HYPERVISOR_VIRT_END to the domheap David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 13/14] Basic shell of lu_reserve_all() from breadcrumb at boot David Woodhouse
2020-01-22  8:53   ` [Xen-devel] [RFC PATCH v2 14/14] debug hacks David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200122085357.2092778-9-dwmw2@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=aams@amazon.de \
    --cc=andrew.cooper3@citrix.com \
    --cc=hongyxia@amazon.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=paul@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=vrd@amazon.de \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).