libxc: migrate migration stream definitions into Xen public headers
PATCH 1/1 libxc: migrate migration stream definitions into Xen public headers
From: David Woodhouse <[email protected]>
These data structures will be used for live update, which is basically just live migration from one Xen to the next on the same machine via in-memory data structures, instead of across the network.
--- tools/libxc/xc_sr_common.c | 20 ++--- tools/libxc/xc_sr_common_x86.c | 4 +- tools/libxc/xc_sr_restore.c | 2 +- tools/libxc/xc_sr_restore_x86_hvm.c | 4 +- tools/libxc/xc_sr_restore_x86_pv.c | 8 +- tools/libxc/xc_sr_save.c | 2 +- tools/libxc/xc_sr_save_x86_hvm.c | 4 +- tools/libxc/xc_sr_save_x86_pv.c | 12 +-- tools/libxc/xc_sr_stream_format.h | 97 +------------------- xen/include/Makefile | 2 +- xen/include/public/migration_stream.h | 125 ++++++++++++++++++++++++++ 11 files changed, 156 insertions(+), 124 deletions(-) create mode 100644 xen/include/public/migration_stream.h
tools/libxc/xc_sr_common.c +10 -10
@@ -91,7 +91,7 @@ int write_split_record(struct xc_sr_context *ctx, struct xc_sr_record *rec,int read_record (struct xc_sr_context *ctx,int fd,struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rhdr rhdr; +struct mr_rhdr rhdr;size_t datasz;if (read_exact (fd, &rhdr,sizeof (rhdr)) )
@@ -142,15 +142,15 @@ static void __attribute__((unused)) build_assertions(void) {BUILD_BUG_ON (sizeof (struct xc_sr_ihdr ) !=24 );BUILD_BUG_ON (sizeof (struct xc_sr_dhdr ) !=16 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rhdr ) !=8 ); - -BUILD_BUG_ON (sizeof (struct xc_sr_rec_page_data_header ) !=8 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_x86_pv_info ) !=8 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_x86_pv_p2m_frames ) !=8 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_x86_pv_vcpu_hdr ) !=8 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_x86_tsc_info ) !=24 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_hvm_params_entry ) !=16 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_hvm_params ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_rhdr ) !=8 ); + +BUILD_BUG_ON (sizeof (struct mr_page_data_header ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_x86_pv_info ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_x86_pv_p2m_frames ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_x86_pv_vcpu_hdr ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_x86_tsc_info ) !=24 ); +BUILD_BUG_ON (sizeof (struct mr_hvm_params_entry ) !=16 ); +BUILD_BUG_ON (sizeof (struct mr_hvm_params ) !=8 ); }/*
tools/libxc/xc_sr_common_x86.c +2 -2
@@ -3,7 +3,7 @@int write_x86_tsc_info (struct xc_sr_context *ctx) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_tsc_info tsc = {}; +struct mr_x86_tsc_info tsc = {};struct xc_sr_record rec = { .type =REC_TYPE_X86_TSC_INFO , .length =sizeof (tsc),
@@ -23,7 +23,7 @@ int write_x86_tsc_info(struct xc_sr_context *ctx)int handle_x86_tsc_info (struct xc_sr_context *ctx,struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_tsc_info *tsc = rec->data; +struct mr_x86_tsc_info *tsc = rec->data;if ( rec->length !=sizeof (*tsc) ) {
tools/libxc/xc_sr_restore.c +1 -1
@@ -335,7 +335,7 @@ static int process_page_data(struct xc_sr_context *ctx, unsigned int count,static int handle_page_data (struct xc_sr_context *ctx,struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_page_data_header *pages = rec->data; +struct mr_page_data_header *pages = rec->data;unsigned int i, pages_of_data =0 ;int rc =-1 ;
tools/libxc/xc_sr_restore_x86_hvm.c +2 -2
@@ -25,8 +25,8 @@ static int handle_hvm_params(struct xc_sr_context *ctx, struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_hvm_params *hdr = rec->data; -struct xc_sr_rec_hvm_params_entry *entry = hdr->param; +struct mr_hvm_params *hdr = rec->data; +struct mr_hvm_params_entry *entry = hdr->param;unsigned int i;int rc;
tools/libxc/xc_sr_restore_x86_pv.c +4 -4
@@ -585,7 +585,7 @@ static int update_guest_p2m(struct xc_sr_context *ctx)* Cross-check the legitimate combinations. */ static bool valid_x86_pv_info_combination ( -const struct xc_sr_rec_x86_pv_info *info) +const struct mr_x86_pv_info *info) {switch ( info->guest_width ) {
@@ -602,7 +602,7 @@ static int handle_x86_pv_info(struct xc_sr_context *ctx, struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_pv_info *info = rec->data; +struct mr_x86_pv_info *info = rec->data;if ( ctx->x86.pv.restore.seen_pv_info ) {
@@ -675,7 +675,7 @@ static int handle_x86_pv_p2m_frames(struct xc_sr_context *ctx, struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_pv_p2m_frames *data = rec->data; +struct mr_x86_pv_p2m_frames *data = rec->data;unsigned int start, end, x, fpp =PAGE_SIZE / ctx->x86.pv.width;int rc;
@@ -734,7 +734,7 @@ static int handle_x86_pv_vcpu_blob(struct xc_sr_context *ctx, struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_pv_vcpu_hdr *vhdr = rec->data; +struct mr_x86_pv_vcpu_hdr *vhdr = rec->data;struct xc_sr_x86_pv_restore_vcpu *vcpu;const char *rec_name;size_t blobsz;
tools/libxc/xc_sr_save.c +1 -1
@@ -87,7 +87,7 @@ static int write_batch(struct xc_sr_context *ctx)void *page, *orig_page;uint64_t *rec_pfns =NULL ;struct iovec *iov =NULL ;int iovcnt =0 ; -struct xc_sr_rec_page_data_header hdr = {0 }; +struct mr_page_data_header hdr = {0 };struct xc_sr_record rec = { .type =REC_TYPE_PAGE_DATA , };
tools/libxc/xc_sr_save_x86_hvm.c +2 -2
@@ -80,8 +80,8 @@ static int write_hvm_params(struct xc_sr_context *ctx) };xc_interface *xch = ctx->xch; -struct xc_sr_rec_hvm_params_entry entries[ARRAY_SIZE (params)]; -struct xc_sr_rec_hvm_params hdr = { +struct mr_hvm_params_entry entries[ARRAY_SIZE (params)]; +struct mr_hvm_params hdr = { .count =0 , };struct xc_sr_record rec = {
tools/libxc/xc_sr_save_x86_pv.c +6 -6
@@ -485,7 +485,7 @@ static int write_one_vcpu_basic(struct xc_sr_context *ctx, uint32_t id)unsigned int i, gdt_count;int rc =-1 ;vcpu_guest_context_any_t vcpu; -struct xc_sr_rec_x86_pv_vcpu_hdr vhdr = { +struct mr_x86_pv_vcpu_hdr vhdr = { .vcpu_id = id, };struct xc_sr_record rec = {
@@ -583,7 +583,7 @@ static int write_one_vcpu_basic(struct xc_sr_context *ctx, uint32_t id)static int write_one_vcpu_extended (struct xc_sr_context *ctx,uint32_t id) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_pv_vcpu_hdr vhdr = { +struct mr_x86_pv_vcpu_hdr vhdr = { .vcpu_id = id, };struct xc_sr_record rec = {
@@ -620,7 +620,7 @@ static int write_one_vcpu_xsave(struct xc_sr_context *ctx, uint32_t id)xc_interface *xch = ctx->xch;int rc =-1 ;DECLARE_HYPERCALL_BUFFER (void, buffer); -struct xc_sr_rec_x86_pv_vcpu_hdr vhdr = { +struct mr_x86_pv_vcpu_hdr vhdr = { .vcpu_id = id, };struct xc_sr_record rec = {
@@ -686,7 +686,7 @@ static int write_one_vcpu_msrs(struct xc_sr_context *ctx, uint32_t id)int rc =-1 ;size_t buffersz;DECLARE_HYPERCALL_BUFFER (void, buffer); -struct xc_sr_rec_x86_pv_vcpu_hdr vhdr = { +struct mr_x86_pv_vcpu_hdr vhdr = { .vcpu_id = id, };struct xc_sr_record rec = {
@@ -793,7 +793,7 @@ static int write_all_vcpu_information(struct xc_sr_context *ctx)*/ static int write_x86_pv_info (struct xc_sr_context *ctx) { -struct xc_sr_rec_x86_pv_info info = { +struct mr_x86_pv_info info = { .guest_width = ctx->x86.pv.width, .pt_levels = ctx->x86.pv.levels, };
@@ -816,7 +816,7 @@ static int write_x86_pv_p2m_frames(struct xc_sr_context *ctx)int rc;unsigned int i;size_t datasz = ctx->x86.pv.p2m_frames *sizeof (uint64_t );uint64_t *data =NULL ; -struct xc_sr_rec_x86_pv_p2m_frames hdr = { +struct mr_x86_pv_p2m_frames hdr = { .end_pfn = ctx->x86.pv.max_pfn, };struct xc_sr_record rec = {
tools/libxc/xc_sr_stream_format.h +2 -95
109 lines not on this page · raw message
xen/include/Makefile +1 -1
@@ -101,7 +101,7 @@ all: headers.chk headers99.chk headers++.chk PUBLIC_HEADERS := $(filter-out public/arch-% public/dom0_ops.h, $(wildcard public/*.h public/*/*.h) $(public-y)) PUBLIC_C99_HEADERS := public/io/9pfs.h public/io/pvcalls.h -PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS)) +PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/migration_stream.h public/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS)) public/io/9pfs.h-prereq := string public/io/pvcalls.h-prereq := string
xen/include/public/migration_stream.h new file +125 -0
125 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 15 lines
-----Original Message-----
From: David Woodhouse <[email protected]>
Sent: 01 February 2020 00:40
To: xen-devel <[email protected]>
Cc: Ian Jackson <[email protected]>; Wei Liu <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Jan Beulich <[email protected]>; Julien Grall <[email protected]>; Konrad Rzeszutek Wilk <[email protected]>; Stefano Stabellini <[email protected]>; Gautam, Varad <[email protected]>; Durrant, Paul <[email protected]>
Subject: [PATCH] libxc: migrate migration stream definitions into Xen public headersFrom: David Woodhouse <[email protected]>
Quoted 7 lines
These data structures will be used for live update, which is basically just live migration from one Xen to the next on the same machine via in-memory data structures, instead of across the network.
Signed-off-by David Woodhouse <[email protected]>Well-excellent-carry-on-then-by Ian Jackson <[email protected]>Go-with-that-for-now-by Andrew Cooper <[email protected]>
This is probably fine but may need some re-structuring when we consider non-cooperative migration. I have not yet had time to post a design document but my thoughts are along the lines of generalising the idea of 'hvm_context' records into 'domain_context' (or some suitable name). Then we can add the necessary 'PV' save records, such as event channel state, grant table state, etc. We may then want to consider using the same mechanism for PV shared info and maybe some of the other records that are currently 'top level' in the XC migration stream.
Paul
Quoted 507 lines
--- tools/libxc/xc_sr_common.c | 20 ++--- tools/libxc/xc_sr_common_x86.c | 4 +- tools/libxc/xc_sr_restore.c | 2 +- tools/libxc/xc_sr_restore_x86_hvm.c | 4 +- tools/libxc/xc_sr_restore_x86_pv.c | 8 +- tools/libxc/xc_sr_save.c | 2 +- tools/libxc/xc_sr_save_x86_hvm.c | 4 +- tools/libxc/xc_sr_save_x86_pv.c | 12 +-- tools/libxc/xc_sr_stream_format.h | 97 +------------------- xen/include/Makefile | 2 +- xen/include/public/migration_stream.h | 125 ++++++++++++++++++++++++++ 11 files changed, 156 insertions(+), 124 deletions(-) create mode 100644 xen/include/public/migration_stream.htools/libxc/xc_sr_common.c +1
-1@@ -91,7 +91,7 @@ int write_split_record(struct xc_sr_context *ctx, structxc_sr_record *rec, int read_record(struct xc_sr_context *ctx, int fd, struct xc_sr_record *rec) { xc_interface *xch = ctx->xch; -struct xc_sr_rhdr rhdr; +struct mr_rhdr rhdr;size_t datasz;if (
read_exact(fd, &rhdr, sizeof(rhdr)))tools/libxc/xc_sr_common.c +9
-9@@ -142,15 +142,15 @@ static void __attribute__((unused))build_assertions (void) {BUILD_BUG_ON (sizeof (struct xc_sr_ihdr ) !=24 );BUILD_BUG_ON (sizeof (struct xc_sr_dhdr ) !=16 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rhdr ) !=8 ); - -BUILD_BUG_ON (sizeof (struct xc_sr_rec_page_data_header ) !=8 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_x86_pv_info ) !=8 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_x86_pv_p2m_frames ) !=8 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_x86_pv_vcpu_hdr ) !=8 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_x86_tsc_info ) !=24 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_hvm_params_entry ) !=16 ); -BUILD_BUG_ON (sizeof (struct xc_sr_rec_hvm_params ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_rhdr ) !=8 ); + +BUILD_BUG_ON (sizeof (struct mr_page_data_header ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_x86_pv_info ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_x86_pv_p2m_frames ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_x86_pv_vcpu_hdr ) !=8 ); +BUILD_BUG_ON (sizeof (struct mr_x86_tsc_info ) !=24 ); +BUILD_BUG_ON (sizeof (struct mr_hvm_params_entry ) !=16 ); +BUILD_BUG_ON (sizeof (struct mr_hvm_params ) !=8 ); }/*
tools/libxc/xc_sr_common_x86.c +2
-2@@ -3,7 +3,7 @@int write_x86_tsc_info (struct xc_sr_context *ctx) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_tsc_info tsc = {}; +struct mr_x86_tsc_info tsc = {};struct xc_sr_record rec = { .type =REC_TYPE_X86_TSC_INFO , .length =sizeof (tsc),@@ -23,7 +23,7 @@ int write_x86_tsc_info(struct xc_sr_context *ctx)int handle_x86_tsc_info (struct xc_sr_context *ctx,struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_tsc_info *tsc = rec->data; +struct mr_x86_tsc_info *tsc = rec->data;if ( rec->length !=sizeof (*tsc) ){tools/libxc/xc_sr_restore.c +1
-1@@ -335,7 +335,7 @@ static int process_page_data(struct xc_sr_context *ctx, unsigned int count, static int handle_page_data(struct xc_sr_context *ctx, struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_page_data_header *pages = rec->data; +struct mr_page_data_header *pages = rec->data;unsigned int i, pages_of_data =0 ;int rc = -1;tools/libxc/xc_sr_restore_x86_hvm.c +2
-2@@ -25,8 +25,8 @@ static int handle_hvm_params(struct xc_sr_context *ctx, struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_hvm_params *hdr = rec->data; -struct xc_sr_rec_hvm_params_entry *entry = hdr->param; +struct mr_hvm_params *hdr = rec->data; +struct mr_hvm_params_entry *entry = hdr->param;unsigned int i;int rc;tools/libxc/xc_sr_restore_x86_pv.c +2
-2@@ -585,7 +585,7 @@ static int update_guest_p2m(struct xc_sr_context *ctx)* Cross-check the legitimate combinations. */ static bool valid_x86_pv_info_combination ( -const struct xc_sr_rec_x86_pv_info *info) +const struct mr_x86_pv_info *info) {switch ( info->guest_width ) {@@ -602,7 +602,7 @@ static int handle_x86_pv_info(struct xc_sr_context *ctx, struct xc_sr_record *rec) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_pv_info *info = rec->data; +struct mr_x86_pv_info *info = rec->data;if ( ctx->x86.pv.restore.seen_pv_info ){tools/libxc/xc_sr_restore_x86_pv.c +2
-2@@ -675,7 +675,7 @@ static int handle_x86_pv_p2m_frames(structxc_sr_context *ctx, struct xc_sr_record *rec) { xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_pv_p2m_frames *data = rec->data; +struct mr_x86_pv_p2m_frames *data = rec->data;unsigned int start, end, x, fpp =PAGE_SIZE / ctx->x86.pv.width;int rc;@@ -734,7 +734,7 @@ static int handle_x86_pv_vcpu_blob(structxc_sr_context *ctx, struct xc_sr_record *rec) { xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_pv_vcpu_hdr *vhdr = rec->data; +struct mr_x86_pv_vcpu_hdr *vhdr = rec->data;struct xc_sr_x86_pv_restore_vcpu *vcpu;const char *rec_name;size_t blobsz;tools/libxc/xc_sr_save.c +1
-1@@ -87,7 +87,7 @@ static int write_batch(struct xc_sr_context *ctx)void *page, *orig_page;uint64_t *rec_pfns =NULL ;struct iovec *iov =NULL ;int iovcnt =0 ; -struct xc_sr_rec_page_data_header hdr = {0 }; +struct mr_page_data_header hdr = {0 };struct xc_sr_record rec = { .type =REC_TYPE_PAGE_DATA , };tools/libxc/xc_sr_save_x86_hvm.c +2
-2@@ -80,8 +80,8 @@ static int write_hvm_params(struct xc_sr_context *ctx) };xc_interface *xch = ctx->xch; -struct xc_sr_rec_hvm_params_entry entries[ARRAY_SIZE (params)]; -struct xc_sr_rec_hvm_params hdr = { +struct mr_hvm_params_entry entries[ARRAY_SIZE (params)]; +struct mr_hvm_params hdr = { .count =0 , };struct xc_sr_record rec = {tools/libxc/xc_sr_save_x86_pv.c +1
-1@@ -485,7 +485,7 @@ static int write_one_vcpu_basic(struct xc_sr_context *ctx, uint32_t id)unsigned int i, gdt_count;int rc =-1 ;vcpu_guest_context_any_t vcpu; -struct xc_sr_rec_x86_pv_vcpu_hdr vhdr = { +struct mr_x86_pv_vcpu_hdr vhdr = { .vcpu_id = id, };struct xc_sr_record rec = {tools/libxc/xc_sr_save_x86_pv.c +1
-1@@ -583,7 +583,7 @@ static int write_one_vcpu_basic(struct xc_sr_context *ctx, uint32_t id)static int write_one_vcpu_extended (struct xc_sr_context *ctx,uint32_t id) {xc_interface *xch = ctx->xch; -struct xc_sr_rec_x86_pv_vcpu_hdr vhdr = { +struct mr_x86_pv_vcpu_hdr vhdr = { .vcpu_id = id,}; struct xc_sr_record rec = {tools/libxc/xc_sr_save_x86_pv.c +1
-1@@ -620,7 +620,7 @@ static int write_one_vcpu_xsave(struct xc_sr_context *ctx, uint32_t id) xc_interface *xch = ctx->xch;int rc =-1 ;DECLARE_HYPERCALL_BUFFER (void, buffer); -struct xc_sr_rec_x86_pv_vcpu_hdr vhdr = { +struct mr_x86_pv_vcpu_hdr vhdr = { .vcpu_id = id, };struct xc_sr_record rec = {tools/libxc/xc_sr_save_x86_pv.c +1
-1@@ -686,7 +686,7 @@ static int write_one_vcpu_msrs(struct xc_sr_context *ctx, uint32_t id)int rc =-1 ;size_t buffersz;DECLARE_HYPERCALL_BUFFER (void, buffer); -struct xc_sr_rec_x86_pv_vcpu_hdr vhdr = { +struct mr_x86_pv_vcpu_hdr vhdr = { .vcpu_id = id, };struct xc_sr_record rec = {tools/libxc/xc_sr_save_x86_pv.c +1
-1@@ -793,7 +793,7 @@ static int write_all_vcpu_information(structxc_sr_context *ctx) */ static int write_x86_pv_info (struct xc_sr_context *ctx) { -struct xc_sr_rec_x86_pv_info info = { +struct mr_x86_pv_info info = { .guest_width = ctx->x86.pv.width, .pt_levels = ctx->x86.pv.levels,};tools/libxc/xc_sr_save_x86_pv.c +1
-1@@ -816,7 +816,7 @@ static int write_x86_pv_p2m_frames(struct xc_sr_context *ctx)int rc;unsigned int i;size_t datasz = ctx->x86.pv.p2m_frames *sizeof (uint64_t );uint64_t *data =NULL ; -struct xc_sr_rec_x86_pv_p2m_frames hdr = { +struct mr_x86_pv_p2m_frames hdr = { .end_pfn = ctx->x86.pv.max_pfn, };struct xc_sr_record rec = {tools/libxc/xc_sr_stream_format.h +2
-95@@ -1,6 +1,8 @@#ifndef __STREAM_FORMAT__H#define __STREAM_FORMAT__H +#include <xen/migration_stream.h> +/* * C structures for the Migration v2 stream format. * See docs/specs/libxc-migration-stream.pandoc @@ -41,101 +43,6 @@ struct xc_sr_dhdr uint32_t xen_minor; }; -#define DHDR_TYPE_X86_PV 0x00000001U -#define DHDR_TYPE_X86_HVM 0x00000002U - -/* -* Record Header -*/ -struct xc_sr_rhdr -{ -uint32_t type; -uint32_t length; -}; - -/* All records must be aligned up to an 8 octet boundary */ -#define REC_ALIGN_ORDER (3U) -/* Somewhat arbitrary - 128MB */ -#define REC_LENGTH_MAX (128U << 20) - -#define REC_TYPE_END 0x00000000U -#define REC_TYPE_PAGE_DATA 0x00000001U -#define REC_TYPE_X86_PV_INFO 0x00000002U -#define REC_TYPE_X86_PV_P2M_FRAMES 0x00000003U -#define REC_TYPE_X86_PV_VCPU_BASIC 0x00000004U -#define REC_TYPE_X86_PV_VCPU_EXTENDED 0x00000005U -#define REC_TYPE_X86_PV_VCPU_XSAVE 0x00000006U -#define REC_TYPE_SHARED_INFO 0x00000007U -#define REC_TYPE_X86_TSC_INFO 0x00000008U -#define REC_TYPE_HVM_CONTEXT 0x00000009U -#define REC_TYPE_HVM_PARAMS 0x0000000aU -#define REC_TYPE_TOOLSTACK 0x0000000bU -#define REC_TYPE_X86_PV_VCPU_MSRS 0x0000000cU -#define REC_TYPE_VERIFY 0x0000000dU -#define REC_TYPE_CHECKPOINT 0x0000000eU -#define REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST 0x0000000fU - -#define REC_TYPE_OPTIONAL 0x80000000U - -/* PAGE_DATA */ -struct xc_sr_rec_page_data_header -{ -uint32_t count; -uint32_t _res1; -uint64_t pfn[0 ]; -}; - -#define PAGE_DATA_PFN_MASK 0x000fffffffffffffULL -#define PAGE_DATA_TYPE_MASK 0xf000000000000000ULL - -/* X86_PV_INFO */ -struct xc_sr_rec_x86_pv_info -{ -uint8_t guest_width; -uint8_t pt_levels; -uint8_t _res[6 ]; -}; - -/* X86_PV_P2M_FRAMES */ -struct xc_sr_rec_x86_pv_p2m_frames -{ -uint32_t start_pfn; -uint32_t end_pfn; -uint64_t p2m_pfns[0 ]; -}; - -/* X86_PV_VCPU_{BASIC,EXTENDED,XSAVE,MSRS} */ -struct xc_sr_rec_x86_pv_vcpu_hdr -{ -uint32_t vcpu_id; -uint32_t _res1; -uint8_t context[0 ]; -}; - -/* X86_TSC_INFO */ -struct xc_sr_rec_x86_tsc_info -{ -uint32_t mode; -uint32_t khz; -uint64_t nsec; -uint32_t incarnation; -uint32_t _res1; -}; - -/* HVM_PARAMS */ -struct xc_sr_rec_hvm_params_entry -{ -uint64_t index; -uint64_t value; -}; - -struct xc_sr_rec_hvm_params -{ -uint32_t count; -uint32_t _res1; -struct xc_sr_rec_hvm_params_entry param[0 ]; -}; -#endif /* * Local variables: xen/include/Makefile +1
-1@@ -101,7 +101,7 @@ all: headers.chk headers99.chk headers++.chk PUBLIC_HEADERS := $(filter-out public/arch-% public/dom0_ops.h, $(wildcard public/*.h public/*/*.h) $(public-y)) PUBLIC_C99_HEADERS := public/io/9pfs.h public/io/pvcalls.h -PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS)) +PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h
public/migration_stream.hpublic/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))public/io/9pfs.h-prereq := string
public/io/pvcalls.h-prereq := stringxen/include/public/migration_stream.h new file +5
-0@@ -0,0 +1,125 @@ +#ifndef __XEN_MIGRATION_STREAM_H__ +#define __XEN_MIGRATION_STREAM_H__ + +#if !defined(__XEN__) && !defined(__XEN_TOOLS__) +#error "Migration stream definitions are intended for use by node controltools only"
xen/include/public/migration_stream.h new file +11
-0+#endif + +/* +* C structures for the Migration and Live Update. +* See docs/specs/libxc-migration-stream.pandoc +*/ + +#include "xen.h" + +/* +* The domain types are used in the libxc stream domain header and will also
+ * be used in corresponding records for live update.
+ */xen/include/public/migration_stream.h new file +97
-0+#define DHDR_TYPE_X86_PV 0x00000001U +#define DHDR_TYPE_X86_HVM 0x00000002U + +/* +* Record Header +*/ +struct mr_rhdr +{ +uint32_t type; +uint32_t length; +}; + +/* All records must be aligned up to an 8 octet boundary */ +#define REC_ALIGN_ORDER (3U) +/* Somewhat arbitrary - 128MB */ +#define REC_LENGTH_MAX (128U << 20) + +#define REC_TYPE_END 0x00000000U +#define REC_TYPE_PAGE_DATA 0x00000001U +#define REC_TYPE_X86_PV_INFO 0x00000002U +#define REC_TYPE_X86_PV_P2M_FRAMES 0x00000003U +#define REC_TYPE_X86_PV_VCPU_BASIC 0x00000004U +#define REC_TYPE_X86_PV_VCPU_EXTENDED 0x00000005U +#define REC_TYPE_X86_PV_VCPU_XSAVE 0x00000006U +#define REC_TYPE_SHARED_INFO 0x00000007U +#define REC_TYPE_X86_TSC_INFO 0x00000008U +#define REC_TYPE_HVM_CONTEXT 0x00000009U +#define REC_TYPE_HVM_PARAMS 0x0000000aU +#define REC_TYPE_TOOLSTACK 0x0000000bU +#define REC_TYPE_X86_PV_VCPU_MSRS 0x0000000cU +#define REC_TYPE_VERIFY 0x0000000dU +#define REC_TYPE_CHECKPOINT 0x0000000eU +#define REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST 0x0000000fU + +#define REC_TYPE_OPTIONAL 0x80000000U +#define REC_TYPE_LIVE_UPDATE 0x40000000U + +/* PAGE_DATA */ +struct mr_page_data_header +{ +uint32_t count; +uint32_t _res1; +uint64_t pfn[0 ]; +}; + +#define PAGE_DATA_PFN_MASK 0x000fffffffffffffULL +#define PAGE_DATA_TYPE_MASK 0xf000000000000000ULL + +/* X86_PV_INFO */ +struct mr_x86_pv_info +{ +uint8_t guest_width; +uint8_t pt_levels; +uint8_t _res[6 ]; +}; + +/* X86_PV_P2M_FRAMES */ +struct mr_x86_pv_p2m_frames +{ +uint32_t start_pfn; +uint32_t end_pfn; +uint64_t p2m_pfns[0 ]; +}; + +/* X86_PV_VCPU_{BASIC,EXTENDED,XSAVE,MSRS} */ +struct mr_x86_pv_vcpu_hdr +{ +uint32_t vcpu_id; +uint32_t _res1; +uint8_t context[0 ]; +}; + +/* X86_TSC_INFO */ +struct mr_x86_tsc_info +{ +uint32_t mode; +uint32_t khz; +uint64_t nsec; +uint32_t incarnation; +uint32_t _res1; +}; + +/* HVM_PARAMS */ +struct mr_hvm_params_entry +{ +uint64_t index; +uint64_t value; +}; + +struct mr_hvm_params +{ +uint32_t count; +uint32_t _res1; +struct mr_hvm_params_entry param[0 ]; +}; + +#endif /* __XEN_MIGRATION_STREAM_H__ */
xen/include/public/migration_stream.h line 125
Quoted 10 lines
xen/include/public/migration_stream.h new file +10
-0+ +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* tab-width: 4 +* indent-tabs-mode: nil +* End: +*/
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 28 lines · Paul
Quoted 5 lines
-----Original Message-----
From: David Woodhouse <[email protected]>
Sent: 01 February 2020 00:40
To: xen-devel <[email protected]>
Cc: Ian Jackson <[email protected]>; Wei Liu <[email protected]>;Andrew
Quoted 2 lines
Cooper <[email protected]>; George Dunlap <[email protected]>; Jan Beulich <[email protected]>;
Julien
Quoted 1 line
Grall <[email protected]>; Konrad Rzeszutek Wilk
Quoted 8 lines
Stefano Stabellini <[email protected]>; Gautam, Varad <[email protected]>; Durrant, Paul <[email protected]>
Subject: [PATCH] libxc: migrate migration stream definitions into Xen public headersFrom: David Woodhouse <[email protected]>
These data structures will be used for live update, which is
basically
Quoted 5 lines
just live migration from one Xen to the next on the same machine via in-memory data structures, instead of across the network.
Signed-off-by David Woodhouse <[email protected]>Well-excellent-carry-on-then-by Ian JacksonQuoted 1 line
Go-with-that-for-now-by Andrew Cooper <[email protected]>
Quoted 8 lines
This is probably fine but may need some re-structuring when we consider non-cooperative migration. I have not yet had time to post a design document but my thoughts are along the lines of generalising the idea of '
hvm_context' records into 'domain_context' (or some suitable name). Then we can add the necessary 'PV' save records, such as event channel state, grant table state, etc. We may then want to consider using the same mechanism for PV shared info and maybe some of the other records that are currently 'top level' in the XC migration stream.
Right. This is just the existing ABI; structures that exist on the wire and are in some cases exported by existing domctls.
As we build upon it for live update and GT migration, we need to carefully consider how we do that — and whether any of the new or indeed existing fields in the HVM_CONTEXT should actually be top-level migration records in their own right, which I think is what you're suggesting.
This patch is just the basis for that work, as it's precisely the structures we have already; just renamed and moved into scope for what comes next.
Signature · 6 lines
dwmw2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel