diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-06-02 18:12:21 +0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-06-15 11:04:04 +0200 |
commit | e45e7ae281221de48148477fd4f066091995653e (patch) | |
tree | 171cef00aefba7439be6edb2152e1bcd1a03a5ca /exec.c | |
parent | 3f0602927b120a480b35dcf58cf6f95435b3ae91 (diff) |
exec: check kvm mmu notifiers earlier
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.lureau@redhat.com>
Message-Id: <20170602141229.15326-2-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1495,12 +1495,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) { @@ -1943,6 +1937,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 |