|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v7 6/9] tools/libxc: split restore handler handle_shared_info() functionality
From: Paul Durrant <pdurrant@xxxxxxxxxx>
The code is invoked when a SHARED_INFO record is processed but actually
performs two functions:
[1] Copy the 'vcpu_info' and 'arch' substructures from the record into the
new domain's shared_info
[2] Clear out any pending event channel state, mask all channels and also
clear 'arch.pfn_to_mfn_frame_list_list'
To facilitate deprecation of the SHARED_INFO record in version 4 of the
migration stream, this patch splits the functionality, leaving [1] in
handle_shared_info() and adding update_shared_info() (called from
x86_pv_stream_complete()) to deal with [2].
Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
---
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Wei Liu <wl@xxxxxxx>
v7:
- New in v7
---
tools/libxc/xc_sr_restore_x86_pv.c | 31 +++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/tools/libxc/xc_sr_restore_x86_pv.c
b/tools/libxc/xc_sr_restore_x86_pv.c
index d086271efb..1ed8cc66ca 100644
--- a/tools/libxc/xc_sr_restore_x86_pv.c
+++ b/tools/libxc/xc_sr_restore_x86_pv.c
@@ -880,7 +880,6 @@ static int handle_shared_info(struct xc_sr_context *ctx,
struct xc_sr_record *rec)
{
xc_interface *xch = ctx->xch;
- unsigned int i;
int rc = -1;
shared_info_any_t *guest_shinfo = NULL;
const shared_info_any_t *old_shinfo = rec->data;
@@ -911,6 +910,32 @@ static int handle_shared_info(struct xc_sr_context *ctx,
MEMCPY_FIELD(guest_shinfo, old_shinfo, vcpu_info, ctx->x86.pv.width);
MEMCPY_FIELD(guest_shinfo, old_shinfo, arch, ctx->x86.pv.width);
+ rc = 0;
+
+ err:
+ if ( guest_shinfo )
+ munmap(guest_shinfo, PAGE_SIZE);
+
+ return rc;
+}
+
+static int update_shared_info(struct xc_sr_context *ctx)
+{
+ xc_interface *xch = ctx->xch;
+ unsigned int i;
+ int rc = -1;
+ shared_info_any_t *guest_shinfo = NULL;
+
+ guest_shinfo = xc_map_foreign_range(
+ xch, ctx->domid, PAGE_SIZE, PROT_READ | PROT_WRITE,
+ ctx->dominfo.shared_info_frame);
+ if ( !guest_shinfo )
+ {
+ PERROR("Failed to map Shared Info at mfn %#lx",
+ ctx->dominfo.shared_info_frame);
+ goto err;
+ }
+
SET_FIELD(guest_shinfo, arch.pfn_to_mfn_frame_list_list,
0, ctx->x86.pv.width);
@@ -1122,6 +1147,10 @@ static int x86_pv_stream_complete(struct xc_sr_context
*ctx)
xc_interface *xch = ctx->xch;
int rc;
+ rc = update_shared_info(ctx);
+ if ( rc )
+ return rc;
+
rc = update_vcpu_context(ctx);
if ( rc )
return rc;
--
2.20.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |