A recent fix to virtio MMIO (72a7541ce305 ["kvm tools: virtio-mmio:
init_ioeventfd should use MMIO for ioeventfd__add_event()"]) highlighted
the confusing parameters expected by ioeventfd__add_event.
As per Pekka's suggestion, replace the bool parameters to this function
with a single `flags' argument instead.
Cc: Ying-Shiuan Pan <yingshiuan.pan@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Give threads a meaningful name. This makes debugging much easier, and
everything else much prettier.
Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
[ penberg@kernel.org: specify vcpu names ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Switch to using init/exit calls instead of the repeating call blocks in builtin-run.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
If vhost is enabled for a virtio device, vhost will poll the ioeventfd
in kernel side and there is no need to poll it in userspace. Otherwise,
both vhost kernel and userspace will race to poll.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Add is_pio flag to set KVM_IOEVENTFD_FLAG_PIO. This is useful for
attaching an ioeventfd to MMIO address as well as PIO address.
virtio-mmio needs an ioeventfd to MMIO address.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Since 44287dd (Repair running on non ioeventfd-capable platforms)
it's possible that ioeventfd__init() fails, but the VM still runs.
This means we end up calling ioeventfd__exit(), which writes()
and then reads() epoll_stop_fd. Because we failed the init,
epoll_stop_fd is 0, so we end up writing/reading stdin, which
exhibits as kvm-tool blocking until something is entered on the
console.
Once we break out of the read we close epoll_fd and epoll_stop_fd,
both 0, and so term_exit() fails to cleanup the terminal properly.
The fix is simply to check ioeventfd_avail in ioevetfd__exit() and
do nothing if it is false.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Commit d3923126a24212f1e746a84a575dadbd9f259418 added a bunch of
nice error checking around ioevent__init() but the init may gracefully
fail if ioevents simply aren't supported (PPC64 KVM).
This commit adds a new return code for the init -- positive, but
identifiable as 'not success 0'.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
kvm__supports_extension has been there before, and it's does it's job right
unlike kvm__has_cap.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>