On 2/27/25 22:45, Keith Busch wrote:
On Thu, Feb 27, 2025 at 03:54:31PM +0000, Pavel Begunkov wrote:
On 2/26/25 18:20, Keith Busch wrote:
From: Keith Busch <kbusch@xxxxxxxxxx>
Provide an interface for the kernel to leverage the existing
pre-registered buffers that io_uring provides. User space can reference
these later to achieve zero-copy IO.
User space must register an empty fixed buffer table with io_uring in
order for the kernel to make use of it.
Can you also fail rw.c:loop_rw_iter()? Something like:
loop_rw_iter() {
if ((req->flags & REQ_F_BUF_NODE) &&
req->buf_node->buf->release)
return -EFAULT;
}
For posterity: the suggestion is because this function uses the
file_operations' .read/.write callbacks, which expect __user pointers.
Playing devil's advocate here, I don't see how user space might know
ahead of time if the file they opened implements the supported _iter
versions. I think only esoteric and legacy interfaces still use it, so
maybe we don't care.
Sure, but it's not like we can do anything about it anyway, we're
not going temporarily mmap the buffer into userspace for that. Normal
registered buffers use user ptrs we stashed during registration,
but I don't think even that is the right thing to do.
Reminds me that Jens was trying to completely get rid of the ->read/write
callbacks in favour of *iter variants, maybe that will happen at some
point.
--
Pavel Begunkov