summaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw@amazon.co.uk>2020-10-27 14:55:23 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-11-15 15:49:11 +0100
commitb59e00dd8cda75fc8303c9f6847ac720b10664e3 (patch)
tree50e3d41ce27544337acfe76e03568b8f1d2a0561 /virt/kvm
parentvfio/virqfd: Drain events from eventfd in virqfd_wakeup() (diff)
downloadlinux-b59e00dd8cda75fc8303c9f6847ac720b10664e3.tar.xz
linux-b59e00dd8cda75fc8303c9f6847ac720b10664e3.zip
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 <dwmw@amazon.co.uk> Message-Id: <20201027135523.646811-4-dwmw2@infradead.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/eventfd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index efa8a5ae7a95..e996989cd580 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -194,6 +194,9 @@ irqfd_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void *key)
int ret = 0;
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);