summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2017-02-24 18:28:44 +0000
committerDr. David Alan Gilbert <dgilbert@redhat.com>2017-02-28 11:30:24 +0000
commit665414ad06aa1bc92e615db9641e58fb13d07de1 (patch)
tree3eb2c360c674a94203e08f9b110c9a1eba6137ba
parent0c1f4036db0a166fb74885c377a3691edb9ad659 (diff)
downloadfocaccia-qemu-665414ad06aa1bc92e615db9641e58fb13d07de1.tar.gz
focaccia-qemu-665414ad06aa1bc92e615db9641e58fb13d07de1.zip
postcopy: Add extra check for COPY function
As an extra sanity check, make sure the region we're registering
can perform UFFDIO_COPY;  the COPY will fail later but this
gives a cleaner failure.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20170224182844.32452-17-dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-rw-r--r--migration/postcopy-ram.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 102fb61485..effbeb64fb 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -378,6 +378,10 @@ static int ram_block_enable_notify(const char *block_name, void *host_addr,
         error_report("%s userfault register: %s", __func__, strerror(errno));
         return -1;
     }
+    if (!(reg_struct.ioctls & ((__u64)1 << _UFFDIO_COPY))) {
+        error_report("%s userfault: Region doesn't support COPY", __func__);
+        return -1;
+    }
 
     return 0;
 }