Skip to content

Comments

Auto buf reg(UBLK_F_AUTO_BUF_REG) for supporting zero copy#18

Closed
ming1 wants to merge 5 commits intomainfrom
auto-buf-reg
Closed

Auto buf reg(UBLK_F_AUTO_BUF_REG) for supporting zero copy#18
ming1 wants to merge 5 commits intomainfrom
auto-buf-reg

Conversation

@ming1
Copy link
Collaborator

@ming1 ming1 commented Aug 9, 2025

Support ublk zero copy feature of UBLK_F_AUTO_BUF_REG/UBLK_F_SUPPORT_ZERO_COPY.

ming1 and others added 3 commits August 9, 2025 11:44
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
This commit introduces support for the `UBLK_F_AUTO_BUF_REG` feature.
This allows for automatic registration and unregistration of I/O buffers
with the underlying `io_uring` instance, simplifying the implementation of
ublk server backends.

With this feature, the buffer registration information is encoded into the
`addr` field of the `io_uring` submission queue entry (SQE), avoiding
the need for separate commands to register and unregister buffers. This
can improve performance by reducing the number of `uring_cmd` calls.

Key changes include:
- A new `UBLK_F_AUTO_BUF_REG` device flag to enable the feature.
- `UBLK_U_IO_REGISTER_IO_BUF` and `UBLK_U_IO_UNREGISTER_IO_BUF` ioctls
  to support a fallback path for manual buffer registration.
- A new `submit_io_cmd_with_auto_buf_reg` method in `UblkQueue` to
  handle I/O submission with auto-registration data.
- A comprehensive test suite to validate the new zero-copy functionality,
  including success, failure, and fallback scenarios.

This simplifies the development of zero-copy ublk targets and provides
a more efficient data path.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
The build started failing with unresolved import errors related to
`zcrx` (zero-copy receive) types from the `io-uring` crate. This
is because a dependency update requires a newer version of `io-uring`
which in turn relies on features from a more recent `liburing` than
is available by default in the GitHub Actions runner.

This change fixes the build by adding a CI step to clone, configure,
and install the latest version of `liburing` from source before the
main build begins. This ensures the necessary definitions are
available to `bindgen` during compilation.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
ming1 added 2 commits August 9, 2025 12:43
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
@ming1 ming1 closed this Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant