Commit b59e00dd authored by David Woodhouse's avatar David Woodhouse Committed by Paolo Bonzini
Browse files

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: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
Message-Id: <20201027135523.646811-4-dwmw2@infradead.org>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b1b397ae
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);