From 4fe6d78b2e241f41208dfb07605aace4becfc747 Mon Sep 17 00:00:00 2001 From: Gal Hammer Date: Sun, 14 Jan 2018 12:06:55 +0200 Subject: virtio: postpone the execution of event_notifier_cleanup function Use the EventNotifier's cleanup callback function to execute the event_notifier_cleanup function after kvm unregistered the eventfd. This change supports running the virtio_bus_set_host_notifier function inside a memory region transaction. Otherwise, a closed fd is sent to kvm, which results in a failure. Signed-off-by: Gal Hammer Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- accel/kvm/kvm-all.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'accel') diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index f290f487a5..071f4f57c0 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -812,6 +812,10 @@ static void kvm_mem_ioeventfd_del(MemoryListener *listener, if (r < 0) { abort(); } + + if (e->cleanup) { + e->cleanup(e); + } } static void kvm_io_ioeventfd_add(MemoryListener *listener, -- cgit v1.2.1