public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Joanne Koong <joannelkoong@gmail.com>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: miklos@szeredi.hu, axboe@kernel.dk,
	linux-fsdevel@vger.kernel.org,  bschubert@ddn.com,
	asml.silence@gmail.com, io-uring@vger.kernel.org,
	 xiaobing.li@samsung.com
Subject: Re: [PATCH v1 1/2] io-uring: add io_uring_cmd_get_buffer_info()
Date: Thu, 23 Oct 2025 17:00:01 -0700	[thread overview]
Message-ID: <CAJnrk1Y0LaP2htgQUN=NpmTf-Y25hSYM5ZoxNk08jU6ObAeDHA@mail.gmail.com> (raw)
In-Reply-To: <CAJnrk1YT=raaSxSt7cE6w2YW6isn-HuJb7HtcXSUsKNjUpMffg@mail.gmail.com>

On Thu, Oct 23, 2025 at 3:20 PM Joanne Koong <joannelkoong@gmail.com> wrote:
>
> On Wed, Oct 22, 2025 at 8:17 PM Caleb Sander Mateos
> <csander@purestorage.com> wrote:
> >
> > On Wed, Oct 22, 2025 at 1:23 PM Joanne Koong <joannelkoong@gmail.com> wrote:
> > > diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h
> > > index 7509025b4071..a92e810f37f9 100644
> > > --- a/io_uring/rsrc.c
> > > +++ b/io_uring/rsrc.c
> > > @@ -1569,3 +1569,24 @@ int io_prep_reg_iovec(struct io_kiocb *req, struct iou_vec *iv,
> > >         req->flags |= REQ_F_IMPORT_BUFFER;
> > >         return 0;
> > >  }
> > > +
> > > +int io_uring_cmd_get_buffer_info(struct io_uring_cmd *cmd, u64 *ubuf,
> > > +                                unsigned int *len)
> > > +{
> > > +       struct io_ring_ctx *ctx = cmd_to_io_kiocb(cmd)->ctx;
> > > +       struct io_rsrc_data *data = &ctx->buf_table;
> > > +       struct io_mapped_ubuf *imu;
> > > +       unsigned int buf_index;
> > > +
> > > +       if (!data->nr)
> > > +               return -EINVAL;
> > > +
> > > +       buf_index = cmd->sqe->buf_index;
> >
> > This is reading userspace-mapped memory, it should use READ_ONCE().
> > But why not just use cmd_to_io_kiocb(cmd)->buf_index? That's already
> > sampled from the SQE in io_uring_cmd_prep() if the
> > IORING_URING_CMD_FIXED flag is set. And it seems like the fuse
> > uring_cmd implementation requires that flag to be set.
>
> Thanks, I didn't realize the cmd->sqe is userspace-mapped. I'll look
> at what io_uring_cmd_prep() does.
>
> For v2 I am going to drop this patch entirely and pass in the ubuf
> address and len through the 80B sqe command area when the server
> registers the ring.

Actually, after looking at this some more and realizing that we can't
get away with recycling iters across requests, I like your
io_uring_cmd_import_fixed_relative() helper idea. I think I'll just do
it that way for v2 instead of having the libfuse server pass in the
buffer address and length, since otherwise we would need to pass that
info for every request (including commit/fetch, not just when
registering) or have to stash it somewhere.

Thanks,
Joanne

>
> Thanks,
> Joanne

  reply	other threads:[~2025-10-24  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 20:20 [PATCH v1 0/2] fuse io_uring: support registered buffers Joanne Koong
2025-10-22 20:20 ` [PATCH v1 1/2] io-uring: add io_uring_cmd_get_buffer_info() Joanne Koong
2025-10-23  3:16   ` Caleb Sander Mateos
2025-10-23 22:20     ` Joanne Koong
2025-10-24  0:00       ` Joanne Koong [this message]
2025-10-22 20:20 ` [PATCH v1 2/2] fuse: support io-uring registered buffers Joanne Koong
2025-10-23  3:22   ` Caleb Sander Mateos
2025-10-23 12:39   ` kernel test robot
2025-10-23 13:22   ` kernel test robot
2025-10-23 17:42     ` Joanne Koong
2025-10-23 23:44   ` Joanne Koong
2025-10-22 20:43 ` [PATCH v1 0/2] fuse io_uring: support " Bernd Schubert
2025-10-23 22:27   ` Joanne Koong
2025-10-24 18:12     ` Bernd Schubert
2025-10-24 19:37       ` Joanne Koong
     [not found] ` <CGME20251023114956epcas5p33a9384d06985dc5936fd355f1d580fb2@epcas5p3.samsung.com>
2025-10-23 11:45   ` Xiaobing Li
2025-10-24 18:02     ` 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='CAJnrk1Y0LaP2htgQUN=NpmTf-Y25hSYM5ZoxNk08jU6ObAeDHA@mail.gmail.com' \
    --to=joannelkoong@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bschubert@ddn.com \
    --cc=csander@purestorage.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=xiaobing.li@samsung.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