]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
kvm/eventfd: Drain events from eventfd in irqfd_wakeup()
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 27 Oct 2020 13:43:46 +0000 (13:43 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 27 Oct 2020 14:22:58 +0000 (14:22 +0000)
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>
virt/kvm/eventfd.c

index d6408bb497dc196469e96a1e7d2e07a264d35dc5..87fe943553508285016481e9bcd7c37e08788d8d 100644 (file)
@@ -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);