io_uring: hide eventfd assumptions in eventfd paths
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 20 Jun 2022 00:25:55 +0000 (01:25 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 22 Jun 2022 17:32:32 +0000 (11:32 -0600)
commitf154a840ae41fa9369887c67ab891cf89d4b3a40
tree0427920326040c9ae22aea7768838ee5d52afb07
parent33ac1f9427c606e7fa73df479102a9dc4ea2056f
io_uring: hide eventfd assumptions in eventfd paths

Some io_uring-eventfd users assume that there won't be spurious wakeups.
That assumption has to be honoured by all io_cqring_ev_posted() callers,
which is inconvenient and from time to time leads to problems but should
be maintained to not break the userspace.

Instead of making the callers track whether a CQE was posted or not, hide
it inside io_eventfd_signal(). It saves ->cached_cq_tail it saw last time
and triggers the eventfd only when ->cached_cq_tail changed since then.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/0ffc66bae37a2513080b601e4370e147faaa72c5.1655684496.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/io_uring_types.h
io_uring/io_uring.c
io_uring/timeout.c