Re: [PATCH V10 11/12] io_uring/uring_cmd: support leasing device kernel buffer to io_uring

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 7, 2024 at 7:02 PM Ming Lei <ming.lei@xxxxxxxxxx> wrote:
>
> Add API of io_uring_cmd_lease_kbuf() for driver to lease its kernel
> buffer to io_uring.
>
> The leased buffer can only be consumed by io_uring OPs in group wide,
> and the uring_cmd has to be one group leader.
>
> This way can support generic device zero copy over device buffer in
> userspace:
>
> - create one sqe group
> - lease one device buffer to io_uring by the group leader of uring_cmd
> - io_uring member OPs consume this kernel buffer by passing IOSQE_IO_DRAIN
>   which isn't used for group member, and mapped to GROUP_BUF.
> - the kernel buffer is returned back after all member OPs are completed
>
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
> ---
>  include/linux/io_uring/cmd.h |  7 +++++++
>  io_uring/uring_cmd.c         | 10 ++++++++++
>  2 files changed, 17 insertions(+)
>
> diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h
> index 578a3fdf5c71..0997ea247188 100644
> --- a/include/linux/io_uring/cmd.h
> +++ b/include/linux/io_uring/cmd.h
> @@ -60,6 +60,8 @@ void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
>  /* Execute the request from a blocking context */
>  void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd);
>
> +int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd,
> +                           struct io_rsrc_node *node);
>  #else
>  static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
>                               struct iov_iter *iter, void *ioucmd)
> @@ -82,6 +84,11 @@ static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
>  static inline void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd)
>  {
>  }
> +static inline int io_uring_cmd_lease_kbuf(struct io_uring_cmd *ioucmd,
> +                                         struct io_rsrc_node *node);

ops, the above ";" needs to be removed, :-(

> +{
> +       return -EOPNOTSUPP;
> +}
>  #endif






[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux