[PATCH 0/3] io_uring: Fix user_data misuse and align helpers with liburing API
Sebastian Chlad <[email protected]>
| Newsgroups | gmane.linux.ltp |
|---|---|
| Message-ID | <[email protected]> |
The existing io_uring_common.h helpers had a fundamental correctness bug: user_data was set to the opcode value. user_data is returned verbatim in the CQE and is the only mechanism for correlating a completion back to its submission - setting it to the opcode is meaningless. Another problem was that the old helpers coupled submission and completion into a single call, making it impossible to submit multiple SQEs before waiting. The fix is to separate the two concerns - which is exactly what liburing does. Modelling the new helpers after liburing's API is therefore the natural choice: io_uring_get_sqe(), io_uring_prep_rw(), io_uring_prep_read/write/readv/writev(), io_uring_sqe_set_data64(), io_uring_submit(), io_uring_wait_cqe(), io_uring_cqe_seen(). The caller is now responsible for setting user_data explicitly at the call site. An open question worth discussing: why model after liburing rather than take it as a direct dependency? liburing is well-tested, so we might use it directly. This series takes the conservative path - a small self-contained wrapper in a header - to keep LTP free of the external dependency. If the consensus is that liburing should be a proper LTP dependency, these helpers could be removed in favour of linking against it directly otherwise we shall review those and make them good enough to merge, so the io)uring tests are funcationally correct. Patches: 1/3 - Redesign io_uring_common.h helpers 2/3 - Update io_uring01 to use new helpers 3/3 - Update io_uring03 to use new helpers Sebastian Chlad (3): io_uring: Redesign common helpers to follow liburing API conventions io_uring01: Update to use new io_uring_common.h helpers io_uring03: Update to use new io_uring_common.h helpers .../kernel/syscalls/io_uring/io_uring01.c | 64 +++--- .../kernel/syscalls/io_uring/io_uring03.c | 77 +++++-- .../syscalls/io_uring/io_uring_common.h | 193 ++++++++---------- 3 files changed, 171 insertions(+), 163 deletions(-) base-commit: 2ec3ac0f96fd3d80f1f44630ec8e399e4ab1f51c -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp