From: Jens Axboe <axboe@kernel.dk>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: csander@purestorage.com, asml.silence@gmail.com,
io-uring@vger.kernel.org
Subject: Re: [PATCH v3 5/5] io_uring/rsrc: add io_uring_registered_mem_region_get()
Date: Wed, 25 Mar 2026 08:56:56 -0600 [thread overview]
Message-ID: <78925323-89b4-4def-aa5a-6138b4aa5d1c@kernel.dk> (raw)
In-Reply-To: <20260324221426.3436334-6-joannelkoong@gmail.com>
On 3/24/26 4:14 PM, Joanne Koong wrote:
> diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
> index cf5638406a0c..c706324fd66d 100644
> --- a/io_uring/rsrc.c
> +++ b/io_uring/rsrc.c
> @@ -1182,6 +1182,24 @@ int io_import_reg_buf(struct io_kiocb *req, struct iov_iter *iter,
> return io_import_fixed(ddir, iter, node->buf, buf_addr, len);
> }
>
> +void *io_uring_registered_mem_region_get(struct io_uring_cmd *cmd,
> + unsigned *nr_pages,
> + unsigned issue_flags)
> +{
> + struct io_ring_ctx *ctx = cmd_to_io_kiocb(cmd)->ctx;
> + void *ptr;
> +
> + io_ring_submit_lock(ctx, issue_flags);
> +
> + ptr = ctx->param_region.ptr;
> + *nr_pages = ctx->param_region.nr_pages;
> +
> + io_ring_submit_unlock(ctx, issue_flags);
> +
> + return ptr;
> +}
> +EXPORT_SYMBOL_GPL(io_uring_registered_mem_region_get);
This looks suspicious, but I actually think it looks suspicious because
you add the submit locking around it. For patterns like that, it makes
the brain go "hmm, what protects this from going invalid the instant
io_ring_submit_unlock() is called??". But this should be stable for the
duration of the ring, hence the locking should not be needed at all?
I'd probably also prefer wrapping this in some kind of return struct, so
that you just return that rather than having one part returned directly
and one stuffed in a pointer to an unsigned for number of pages.
--
Jens Axboe
next prev parent reply other threads:[~2026-03-25 14:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 22:14 [PATCH v3 0/5] io_uring: extend bvec registration and add mem region lookup Joanne Koong
2026-03-24 22:14 ` [PATCH v3 1/5] io_uring/rsrc: rename io_buffer_register_bvec()/io_buffer_unregister_bvec() Joanne Koong
2026-03-24 22:14 ` [PATCH v3 2/5] io_uring/rsrc: split io_buffer_register_request() logic Joanne Koong
2026-03-24 22:14 ` [PATCH v3 3/5] io_uring/rsrc: add io_buffer_register_bvec() Joanne Koong
2026-03-24 22:14 ` [PATCH v3 4/5] io_uring/rsrc: rename and export IO_IMU_DEST / IO_IMU_SOURCE Joanne Koong
2026-03-24 22:14 ` [PATCH v3 5/5] io_uring/rsrc: add io_uring_registered_mem_region_get() Joanne Koong
2026-03-25 14:56 ` Jens Axboe [this message]
2026-03-25 17:24 ` Joanne Koong
2026-03-25 17:27 ` Jens Axboe
2026-03-25 19:56 ` Joanne Koong
2026-03-25 20:15 ` Jens Axboe
2026-03-24 22:51 ` [PATCH v3 0/5] io_uring: extend bvec registration and add mem region lookup Joanne Koong
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=78925323-89b4-4def-aa5a-6138b4aa5d1c@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=csander@purestorage.com \
--cc=io-uring@vger.kernel.org \
--cc=joannelkoong@gmail.com \
/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