From: David Woodhouse Date: Tue, 27 Oct 2020 13:43:46 +0000 (+0000) Subject: kvm/eventfd: Drain events from eventfd in irqfd_wakeup() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6703ffb9553e36fe0ebc0f9d3aa03f45ad22187b;p=users%2Fdwmw2%2Flinux.git kvm/eventfd: Drain events from eventfd in irqfd_wakeup() Don't allow the events to accumulate in the eventfd counter, drain them as they are handled. Signed-off-by: David Woodhouse --- diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index c2323c27a28b5..2b93893657fc9 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -193,6 +193,9 @@ irqfd_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) int idx; if (flags & EPOLLIN) { + u64 cnt; + eventfd_ctx_do_read(irqfd->eventfd, &cnt); + idx = srcu_read_lock(&kvm->irq_srcu); do { seq = read_seqcount_begin(&irqfd->irq_entry_sc);