Re: [PATCHv2 0/6] ublk zero-copy support

Ming Lei
2025-02-12T02:29:51Z

On Mon, Feb 10, 2025 at 04:56:40PM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> Previous version was discussed here:
>
> https://lore.kernel.org/linux-block/20250203154517.937623-1-kbusch@meta.com/
>
> The same ublksrv reference code in that link was used to test the kernel
> side changes.
>
> Before listing what has changed, I want to mention what is the same: the
> reliance on the ring ctx lock to serialize the register ahead of any
> use. I'm not ignoring the feedback; I just don't have a solid answer
> right now, and want to progress on the other fronts in the meantime.

It is explained in the following links:

https://lore.kernel.org/linux-block/b6211101-3f74-4dea-a880-81bb75575dbd@gmail.com/

- node kbuffer is registered in ublk uring_cmd's ->issue(), but lookup
in RW_FIXED OP's ->prep(), and ->prep() is always called before calling
->issue() when the two are submitted in same io_uring_enter(), so you
need to move io_rsrc_node_lookup() & buffer importing from RW_FIXED's ->prep()
to ->issue() first.

- secondly, ->issue() order is only respected by IO_LINK, and io_uring
can't provide such guarantee without using IO_LINK:

Pavel explained it in the following link:

https://lore.kernel.org/linux-block/68256da6-bb13-4498-a0e0-dce88bb32242@gmail.com/

There are also other examples, such as, register buffer stays in one
link chain, and the consumer OP isn't in this chain, the consumer OP
can still be issued before issuing register_buffer.

Thanks,
Ming