[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201027135523.646811-4-dwmw2@infradead.org>
Date: Tue, 27 Oct 2020 13:55:23 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: bonzini@...hat.com
Cc: Alex Williamson <alex.williamson@...hat.com>,
Cornelia Huck <cohuck@...hat.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Jens Axboe <axboe@...nel.dk>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH 3/3] kvm/eventfd: Drain events from eventfd in irqfd_wakeup()
From: David Woodhouse <dwmw@...zon.co.uk>
Don't allow the events to accumulate in the eventfd counter, drain them
as they are handled.
Signed-off-by: David Woodhouse <dwmw@...zon.co.uk>
---
virt/kvm/eventfd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index d6408bb497dc..98b5cfa1d69f 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);
--
2.26.2
Powered by blists - more mailing lists