From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Julien Grall <julien.grall@arm.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH for-4.9 2/4] tools/libxc: Avoid generating inappropriate zero-content records
Date: Thu, 30 Mar 2017 17:32:32 +0100 [thread overview]
Message-ID: <1490891554-28597-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1490891554-28597-1-git-send-email-andrew.cooper3@citrix.com>
The code as written attempted to elide zero-content records, as such records
serve no purpose but come with a performance hit. Unfortunately, in the case
where the hypervisor reported max size is non-zero, but the actual size is
zero, the record is not elided.
This previously tripped up the sanity checks in the restore side of migration,
but as the underlying reasons for eliding the records in the first place are
still valid, fix the elision logic.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Julien Grall <julien.grall@arm.com>
---
tools/libxc/xc_sr_save_x86_hvm.c | 4 ++++
tools/libxc/xc_sr_save_x86_pv.c | 12 ++++++++++++
2 files changed, 16 insertions(+)
diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_hvm.c
index e485928..fc5c6ea 100644
--- a/tools/libxc/xc_sr_save_x86_hvm.c
+++ b/tools/libxc/xc_sr_save_x86_hvm.c
@@ -112,6 +112,10 @@ static int write_hvm_params(struct xc_sr_context *ctx)
}
}
+ /* No params? Skip this record. */
+ if ( hdr.count == 0 )
+ return 0;
+
rc = write_split_record(ctx, &rec, entries, hdr.count * sizeof(*entries));
if ( rc )
PERROR("Failed to write HVM_PARAMS record");
diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xc_sr_save_x86_pv.c
index f218d17..36b1058 100644
--- a/tools/libxc/xc_sr_save_x86_pv.c
+++ b/tools/libxc/xc_sr_save_x86_pv.c
@@ -609,6 +609,10 @@ static int write_one_vcpu_extended(struct xc_sr_context *ctx, uint32_t id)
return -1;
}
+ /* No content? Skip the record. */
+ if ( domctl.u.ext_vcpucontext.size == 0 )
+ return 0;
+
return write_split_record(ctx, &rec, &domctl.u.ext_vcpucontext,
domctl.u.ext_vcpucontext.size);
}
@@ -664,6 +668,10 @@ static int write_one_vcpu_xsave(struct xc_sr_context *ctx, uint32_t id)
goto err;
}
+ /* No xsave state? Skip this record. */
+ if ( domctl.u.vcpuextstate.size == 0 )
+ goto out;
+
rc = write_split_record(ctx, &rec, buffer, domctl.u.vcpuextstate.size);
if ( rc )
goto err;
@@ -730,6 +738,10 @@ static int write_one_vcpu_msrs(struct xc_sr_context *ctx, uint32_t id)
goto err;
}
+ /* No MSRs? Skip this record. */
+ if ( domctl.u.vcpu_msrs.msr_count == 0 )
+ goto out;
+
rc = write_split_record(ctx, &rec, buffer,
domctl.u.vcpu_msrs.msr_count *
sizeof(xen_domctl_vcpu_msr_t));
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-03-30 16:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-30 16:32 [PATCH for-4.9 0/4] Fix migration of PV guests on modern AMD hardware Andrew Cooper
2017-03-30 16:32 ` [PATCH for-4.9 1/4] tools/libxc: Tolerate specific zero-content records in migration v2 streams Andrew Cooper
2017-03-30 16:32 ` Andrew Cooper [this message]
2017-03-31 7:46 ` [PATCH for-4.9 2/4] tools/libxc: Avoid generating inappropriate zero-content records Jan Beulich
2017-04-05 11:55 ` Wei Liu
2017-03-30 16:32 ` [PATCH for-4.9 3/4] tools/python: Adjust migration v2 library to warn about " Andrew Cooper
2017-03-30 16:32 ` [PATCH for-4.9 4/4] docs: Clarify the expected behaviour of " Andrew Cooper
2017-03-31 7:51 ` Jan Beulich
2017-04-06 9:35 ` Wei Liu
2017-04-05 11:55 ` Wei Liu
2017-04-05 11:23 ` [PATCH for-4.9 0/4] Fix migration of PV guests on modern AMD hardware Julien Grall
2017-04-05 11:25 ` Wei Liu
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=1490891554-28597-3-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=julien.grall@arm.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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).