From: Stefano Garzarella Date: Fri, 15 May 2020 16:38:05 +0000 (+0200) Subject: io_uring: add IORING_CQ_EVENTFD_DISABLED to the CQ ring flags X-Git-Tag: v5.10.7~2494^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e55a19cf6e70ce08964b46dbbfbdb07fbc995fc;p=platform%2Fkernel%2Flinux-rpi.git io_uring: add IORING_CQ_EVENTFD_DISABLED to the CQ ring flags This new flag should be set/clear from the application to disable/enable eventfd notifications when a request is completed and queued to the CQ ring. Before this patch, notifications were always sent if an eventfd is registered, so IORING_CQ_EVENTFD_DISABLED is not set during the initialization. It will be up to the application to set the flag after initialization if no notifications are required at the beginning. Signed-off-by: Stefano Garzarella Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 0225069..f800b0b 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1153,6 +1153,8 @@ static inline bool io_should_trigger_evfd(struct io_ring_ctx *ctx) { if (!ctx->cq_ev_fd) return false; + if (READ_ONCE(ctx->rings->cq_flags) & IORING_CQ_EVENTFD_DISABLED) + return false; if (!ctx->eventfd_async) return true; return io_wq_current_is_worker(); diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 602bb0e..8c5775d 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -210,6 +210,13 @@ struct io_cqring_offsets { }; /* + * cq_ring->flags + */ + +/* disable eventfd notifications */ +#define IORING_CQ_EVENTFD_DISABLED (1U << 0) + +/* * io_uring_enter(2) flags */ #define IORING_ENTER_GETEVENTS (1U << 0)