]> 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>
Wed, 28 Oct 2020 15:32:51 +0000 (15:32 +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 c2323c27a28b52dd14c6405dcbc8d54b1356efe0..2b93893657fc968fc87034b6d9e35339d09932e3 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);