aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_save_msgs_gen.pl
diff options
context:
space:
mode:
authorIan Jackson <ian.jackson@eu.citrix.com>2012-06-28 18:43:23 +0100
committerIan Jackson <ian.jackson@eu.citrix.com>2012-06-28 18:43:23 +0100
commit0d176cc71600d74b2bd7dcb437ce4ce8c0033275 (patch)
tree000838c166c010ccd058f3b83c8d5e8922758c31 /tools/libxl/libxl_save_msgs_gen.pl
parent68c6062f0cbfd61dbf8839a1b721ea3c00072f26 (diff)
downloadxen-0d176cc71600d74b2bd7dcb437ce4ce8c0033275.tar.gz
xen-0d176cc71600d74b2bd7dcb437ce4ce8c0033275.tar.bz2
xen-0d176cc71600d74b2bd7dcb437ce4ce8c0033275.zip
libxl: wait for qemu to acknowledge logdirty command
The current migration code in libxl instructs qemu to start or stop logdirty, but it does not wait for an acknowledgement from qemu before continuing. This might lead to memory corruption (!) Fix this by waiting for qemu to acknowledge the command. Unfortunately the necessary ao arrangements for waiting for this command are unique because qemu has a special protocol for this particular operation. Also, this change means that the switch_qemu_logdirty callback implementation in libxl can no longer synchronously produce its return value, as it now needs to wait for xenstore. So we tell the marshalling code generator that it is a message which does not need a reply. This turns the callback function called by the marshaller into one which returns void; the callback function arranges to later explicitly sends the reply to the helper, when the xs watch triggers and the appropriate value is read from xenstore. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl_save_msgs_gen.pl')
-rwxr-xr-xtools/libxl/libxl_save_msgs_gen.pl7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/libxl/libxl_save_msgs_gen.pl b/tools/libxl/libxl_save_msgs_gen.pl
index c45986ed74..a9ac808ff0 100755
--- a/tools/libxl/libxl_save_msgs_gen.pl
+++ b/tools/libxl/libxl_save_msgs_gen.pl
@@ -14,6 +14,7 @@ our @msgs = (
# x - function pointer is in struct {save,restore}_callbacks
# and its null-ness needs to be passed through to the helper's xc
# W - needs a return value; callback is synchronous
+ # A - needs a return value; callback is asynchronous
[ 1, 'sr', "log", [qw(uint32_t level
uint32_t errnoval
STRING context
@@ -25,7 +26,7 @@ our @msgs = (
[ 3, 'scxW', "suspend", [] ],
[ 4, 'scxW', "postcopy", [] ],
[ 5, 'scxW', "checkpoint", [] ],
- [ 6, 'scxW', "switch_qemu_logdirty", [qw(int domid
+ [ 6, 'scxA', "switch_qemu_logdirty", [qw(int domid
unsigned enable)] ],
# toolstack_save done entirely `by hand'
[ 7, 'rcxW', "toolstack_restore", [qw(uint32_t domid
@@ -262,7 +263,7 @@ foreach my $msginfo (@msgs) {
$f_more_sr->(" int r;\n");
}
- my $c_rtype_helper = $flags =~ m/W/ ? 'int' : 'void';
+ my $c_rtype_helper = $flags =~ m/[WA]/ ? 'int' : 'void';
my $c_rtype_callout = $flags =~ m/W/ ? 'int' : 'void';
my $c_decl = '(';
my $c_callback_args = '';
@@ -351,7 +352,7 @@ END_ALWAYS
assert(len == allocd);
${transmit}(buf, len, user);
");
- if ($flags =~ m/W/) {
+ if ($flags =~ m/[WA]/) {
f_more("${encode}_$name",
(<<END_ALWAYS.($debug ? <<END_DEBUG : '').<<END_ALWAYS));
int r = ${helper}_getreply(user);