|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 5/6] tools/migration: Specification update for 'checkpointed' flag
From: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
This allows different types of streams to be distinguished from the Image
Header alone, at the start of day.
In addition, update the save and restore code to:
* Collect checkpointed-ness from their callers
* Use the new stream flag
* Sanity check their environment
Based on an eariler patch from Yang Hongyang
Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: David Vrabel <david.vrabel@xxxxxxxxxx>
CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
---
docs/specs/libxc-migration-stream.pandoc | 5 ++++-
tools/libxc/include/xenguest.h | 1 +
tools/libxc/xc_sr_common.h | 6 ++++++
tools/libxc/xc_sr_restore.c | 9 +++++++++
tools/libxc/xc_sr_save.c | 8 +++++++-
tools/libxc/xc_sr_stream_format.h | 6 +++++-
tools/libxl/libxl_dom.c | 1 +
7 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/docs/specs/libxc-migration-stream.pandoc
b/docs/specs/libxc-migration-stream.pandoc
index fa501e7..031a1d5 100644
--- a/docs/specs/libxc-migration-stream.pandoc
+++ b/docs/specs/libxc-migration-stream.pandoc
@@ -131,7 +131,10 @@ version 0x00000002. The version of this specification.
options bit 0: Endianness. 0 = little-endian, 1 = big-endian.
- bit 1-15: Reserved. (Must be zero)
+ bit 1: Checkpointed. 0 = plain stream with single VM,
+ 1 = stream with VM checkpoints.
+
+ bit 2-15: Reserved. (Must be zero)
--------------------------------------------------------------------
The endianness shall be 0 (little-endian) for images generated on an
diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index 8e39075..7581263 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -30,6 +30,7 @@
#define XCFLAGS_HVM (1 << 2)
#define XCFLAGS_STDVGA (1 << 3)
#define XCFLAGS_CHECKPOINT_COMPRESS (1 << 4)
+#define XCFLAGS_CHECKPOINTED (1 << 5)
#define X86_64_B_SIZE 64
#define X86_32_B_SIZE 32
diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index c4fe92c..a16fe22 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -174,6 +174,9 @@ struct xc_sr_context
/* Live migrate vs non live suspend. */
bool live;
+ /* Plain VM, or checkpoints over time. */
+ bool checkpointed;
+
/* Further debugging information in the stream. */
bool debug;
@@ -197,6 +200,9 @@ struct xc_sr_context
/* From Image Header. */
uint32_t format_version;
+ /* Plain VM, or checkpoints over time. */
+ bool checkpointed;
+
/* From Domain Header. */
uint32_t guest_type;
uint32_t guest_page_size;
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index 7d65a29..b815db9 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -48,6 +48,14 @@ static int read_headers(struct xc_sr_context *ctx)
ERROR("Unable to handle big endian streams");
return -1;
}
+ else if ( (ihdr.options & IHDR_OPT_CHECKPOINTED) !=
+ ctx->restore.checkpointed )
+ {
+ ERROR("Caller (%c) and stream (%c) disagree over checkpointed-ness",
+ (ihdr.options & IHDR_OPT_CHECKPOINTED) ? 'y' : 'n',
+ ctx->restore.checkpointed ? 'y' : 'n');
+ return -1;
+ }
ctx->restore.format_version = ihdr.version;
@@ -589,6 +597,7 @@ int xc_domain_restore2(xc_interface *xch, int io_fd,
uint32_t dom,
ctx.restore.console_domid = console_domid;
ctx.restore.xenstore_evtchn = store_evtchn;
ctx.restore.xenstore_domid = store_domid;
+ ctx.restore.checkpointed = checkpointed_stream;
ctx.restore.callbacks = callbacks;
IPRINTF("In experimental %s", __func__);
diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c
index 66fcd3e..2730000 100644
--- a/tools/libxc/xc_sr_save.c
+++ b/tools/libxc/xc_sr_save.c
@@ -15,7 +15,10 @@ static int write_headers(struct xc_sr_context *ctx, uint16_t
guest_type)
.marker = IHDR_MARKER,
.id = htonl(IHDR_ID),
.version = htonl(IHDR_VERSION),
- .options = htons(IHDR_OPT_LITTLE_ENDIAN),
+ .options = htons(
+ IHDR_OPT_LITTLE_ENDIAN |
+ (ctx->save.checkpointed ? IHDR_OPT_CHECKPOINTED : 0)
+ ),
};
struct xc_sr_dhdr dhdr =
{
@@ -732,6 +735,7 @@ int xc_domain_save2(xc_interface *xch, int io_fd, uint32_t
dom,
ctx.save.callbacks = callbacks;
ctx.save.live = !!(flags & XCFLAGS_LIVE);
ctx.save.debug = !!(flags & XCFLAGS_DEBUG);
+ ctx.save.checkpointed = !!(flags & XCFLAGS_CHECKPOINTED);
/*
* TODO: Find some time to better tweak the live migration algorithm.
@@ -745,6 +749,8 @@ int xc_domain_save2(xc_interface *xch, int io_fd, uint32_t
dom,
/* Sanity checks for callbacks. */
if ( hvm )
assert(callbacks->switch_qemu_logdirty);
+ if ( ctx.save.checkpointed )
+ assert(callbacks->checkpoint && callbacks->postcopy);
IPRINTF("In experimental %s", __func__);
DPRINTF("fd %d, dom %u, max_iters %u, max_factor %u, flags %u, hvm %d",
diff --git a/tools/libxc/xc_sr_stream_format.h
b/tools/libxc/xc_sr_stream_format.h
index 9d8c128..c35dcbd 100644
--- a/tools/libxc/xc_sr_stream_format.h
+++ b/tools/libxc/xc_sr_stream_format.h
@@ -29,7 +29,11 @@ struct xc_sr_ihdr
#define IHDR_OPT_LITTLE_ENDIAN (0 << _IHDR_OPT_ENDIAN)
#define IHDR_OPT_BIG_ENDIAN (1 << _IHDR_OPT_ENDIAN)
-#define IHDR_OPT_RSVD_MASK (~(IHDR_OPT_BIG_ENDIAN))
+#define _IHDR_OPT_CHECKPOINTED 1
+#define IHDR_OPT_CHECKPOINTED (1 << _IHDR_OPT_CHECKPOINTED)
+
+#define IHDR_OPT_RSVD_MASK (~(IHDR_OPT_BIG_ENDIAN | \
+ IHDR_OPT_CHECKPOINTED))
/*
* Domain Header
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index f408646..a0c9850 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -2003,6 +2003,7 @@ void libxl__domain_suspend(libxl__egc *egc,
libxl__domain_suspend_state *dss)
if (r_info != NULL) {
dss->interval = r_info->interval;
+ dss->xcflags |= XCFLAGS_CHECKPOINTED;
if (libxl_defbool_val(r_info->compression))
dss->xcflags |= XCFLAGS_CHECKPOINT_COMPRESS;
}
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |