From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Subject: [PATCHSET 0/2] Add support for sending sync MSG_RING
Date: Mon, 23 Sep 2024 22:59:52 -0600 [thread overview]
Message-ID: <20240924050531.39427-1-axboe@kernel.dk> (raw)
Hi,
Over the last 6 months, several people have asked for if it's possible
to send a MSG_RING request to a ring without having a source ring to do
it from. The answer is no, as you'd need a source ring to submit such a
request in the first place. However, we can easily support this use case
of allowing someone to send a message to a ring that their own, without
needing to setup a source ring just for that alone.
This adds support for "blind" register opcodes for io_uring_register(2),
which simply means that there's no io_uring ring fd being passed in. The
'fd' must be set to -1. IORING_REGISTER_SEND_MSG_RING is added, which
simply takes a pointer to an io_uring_sqe. That sqe must be setup just
like an sqe that would have been otherwise prepared via sending over a
normal ring. An sqe pointer is used to keep the app side trivial, as
they can just put an sqe on the stack, initialize it to zeroes, and then
call io_uring_prep_msg_ring() on it like they would for an async
MSG_RING.
Once setup, the app can call:
io_uring_register(-1, IORING_REGISTER_SEND_MSG_RING, &sqe, 1);
which would like like:
io_uring_send_msg_ring_sync(&sqe);
if using linuring. The return value of this syscall is what would have
been in cqe->res using the async approach - 0 on success, or a negative
error value in case of failure.
Patches can also be found in a kernel branch here:
https://git.kernel.dk/cgit/linux/log/?h=io_uring-sync-msg_ring
and a liburing branch with support (and test cases) is here:
https://git.kernel.dk/cgit/liburing/log/?h=sync-msg
include/uapi/linux/io_uring.h | 3 ++
io_uring/msg_ring.c | 60 ++++++++++++++++++++++++++++-------
io_uring/msg_ring.h | 1 +
io_uring/register.c | 27 ++++++++++++++++
4 files changed, 80 insertions(+), 11 deletions(-)
--
Jens Axboe
next reply other threads:[~2024-09-24 5:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 4:59 Jens Axboe [this message]
2024-09-24 4:59 ` [PATCH 1/2] io_uring/msg_ring: refactor a few helper functions Jens Axboe
2024-09-24 4:59 ` [PATCH 2/2] io_uring/msg_ring: add support for sending a sync message Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240924050531.39427-1-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox