io_uring/mock: introduce poll wakeup cmd
PATCH RESEND 1/1 io_uring/mock: introduce poll wakeup cmd
Add IORING_MOCK_CMD_POLL_WAKE to issue a controlled number of immediate wakeups and to prep another batch for the next poll() call. The next batch is issued after poll_wait() installs the waiter, allowing a test to inject a wakeup from inside a vfs_poll() recheck.
---
Commit 937d38dcacd6 ("io_uring/poll: avoid retry wakeup loss when dropping ownership") fixed a race where a poll wakeup could be lost between consuming IO_POLL_RETRY_FLAG and dropping request ownership, stalling the request until another wakeup arrived.
Add a mock-file command that issues immediate wakeups and arms another batch for the next poll() call. This lets the liburing test trigger a wakeup from inside the vfs_poll() recheck and reproduce the race deterministically [1].
[1] https://github.com/axboe/liburing/compare/master...jlhe97:liburing:mock-poll-test
--- include/uapi/linux/io_uring/mock_file.h | 9 +++++ io_uring/mock_file.c | 61 +++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+)
include/uapi/linux/io_uring/mock_file.h +9 -0
@@ -9,6 +9,7 @@ enum {IORING_MOCK_FEAT_RW_NOWAIT ,IORING_MOCK_FEAT_RW_ASYNC ,IORING_MOCK_FEAT_POLL , +IORING_MOCK_FEAT_POLL_WAKE , IORING_MOCK_FEAT_END, };
@@ -38,6 +39,14 @@ enum {enum {IORING_MOCK_CMD_COPY_REGBUF , +IORING_MOCK_CMD_POLL_WAKE , +}; + +struct io_uring_mock_poll_wake { +__u32 events; +__u32 nr_wakeups; +__u32 nr_wakeups_on_poll; +__u32 __resv[5 ]; };enum {
io_uring/mock_file.c +61 -0
93 lines not on this page · raw message
---
base-commit: ecb6817b769fd7d71af2c9f446188649020b2e53
change-id: 20261020-mock-poll-kernel-3d2624fb7d28
Best regards,
Signature · 1 line
Juanlu Herrero