diff mbox

[v2,1/9] exec: check kvm mmu notifiers earlier

Message ID 20170111113347.7577-2-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Jan. 11, 2017, 11:33 a.m. UTC
Move kvm mmu notifiers check before calling file_ram_alloc(), with the
other xen precondition. (the function will be reused in other cases than
-mem-path).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 exec.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/exec.c b/exec.c
index 47835c1dc1..172baba30e 100644
--- a/exec.c
+++ b/exec.c
@@ -1273,12 +1273,6 @@  static void *file_ram_alloc(RAMBlock *block,
     int fd = -1;
     int64_t file_size;
 
-    if (kvm_enabled() && !kvm_has_sync_mmu()) {
-        error_setg(errp,
-                   "host lacks kvm mmu notifiers, -mem-path unsupported");
-        return NULL;
-    }
-
     for (;;) {
         fd = open(path, O_RDWR);
         if (fd >= 0) {
@@ -1703,6 +1697,12 @@  RAMBlock *qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
         return NULL;
     }
 
+    if (kvm_enabled() && !kvm_has_sync_mmu()) {
+        error_setg(errp,
+                   "host lacks kvm mmu notifiers, -mem-path unsupported");
+        return NULL;
+    }
+
     if (phys_mem_alloc != qemu_anon_ram_alloc) {
         /*
          * file_ram_alloc() needs to allocate just like