memfd: fix vhost-user-test on non-memfd capable host
commit648abbfbaa4462bc015b15dd335068638bee4246
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 28 Mar 2018 12:18:04 +0000 (28 14:18 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 9 Apr 2018 10:57:06 +0000 (9 12:57 +0200)
treeedd66fa38ebf98d2e7b0b3c7287511eccefdf5cb
parent053e45d2f3d3eb51799f371a39434699984e9019
memfd: fix vhost-user-test on non-memfd capable host

On RHEL7, memfd is not supported, and vhost-user-test fails:
TEST: tests/vhost-user-test... (pid=10248)
  /x86_64/vhost-user/migrate:
  qemu-system-x86_64: -object memory-backend-memfd,id=mem,size=2M,: failed to create memfd
FAIL

There is a qemu_memfd_check() to prevent running memfd path, but it
also checks for fallback implementation. Let's specialize
qemu_memfd_check() to check memfd only, while qemu_memfd_alloc_check()
checks for the qemu_memfd_alloc() API.

Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
Tested-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180328121804.16203-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
hw/virtio/vhost.c
include/qemu/memfd.h
util/memfd.c