Move kvm mmu notifiers check before calling file_ram_alloc(), with the other xen precondition. (file_ram_alloc() will be reused in other cases than -mem-path).
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- exec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index b1db12fe36..9c6c3cfe87 100644 --- a/exec.c +++ b/exec.c @@ -1496,12 +1496,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) { @@ -1944,6 +1938,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 -- 2.13.0.91.g00982b8dd