Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfio/virqfd: Drain events from eventfd in virqfd_wakeup()

Don't allow the events to accumulate in the eventfd counter, drain them
as they are handled.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Message-Id: <20201027135523.646811-3-dwmw2@infradead.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>

authored by

David Woodhouse and committed by
Paolo Bonzini
b1b397ae 28f13267

+3
+3
drivers/vfio/virqfd.c
··· 46 46 __poll_t flags = key_to_poll(key); 47 47 48 48 if (flags & EPOLLIN) { 49 + u64 cnt; 50 + eventfd_ctx_do_read(virqfd->eventfd, &cnt); 51 + 49 52 /* An event has been signaled, call function */ 50 53 if ((!virqfd->handler || 51 54 virqfd->handler(virqfd->opaque, virqfd->data)) &&