eventfd: Export eventfd_ctx_do_read()
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 27 Oct 2020 13:55:21 +0000 (13:55 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 15 Nov 2020 14:49:10 +0000 (09:49 -0500)
commit28f1326710555bbe666f64452d08f2d7dd657cae
tree0500d5c7ff66eda5051b0221b04c73b28c8d8942
parente8dbf19508a112d125190df77ee0464b7ba56192
eventfd: Export eventfd_ctx_do_read()

Where events are consumed in the kernel, for example by KVM's
irqfd_wakeup() and VFIO's virqfd_wakeup(), they currently lack a
mechanism to drain the eventfd's counter.

Since the wait queue is already locked while the wakeup functions are
invoked, all they really need to do is call eventfd_ctx_do_read().

Add a check for the lock, and export it for them.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Message-Id: <20201027135523.646811-2-dwmw2@infradead.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
fs/eventfd.c
include/linux/eventfd.h