public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ming Lei <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Cc: [email protected], Miklos Szeredi <[email protected]>,
	ZiyangZhang <[email protected]>,
	Xiaoguang Wang <[email protected]>,
	Bernd Schubert <[email protected]>,
	Ming Lei <[email protected]>
Subject: [RFC PATCH 00/12] io_uring: add IORING_OP_FUSED_CMD
Date: Wed,  1 Mar 2023 22:05:59 +0800	[thread overview]
Message-ID: <[email protected]> (raw)

Hello,

Add IORING_OP_FUSED_CMD, it is one special URING_CMD, which has to
be SQE128. The 1st SQE(master) is one 64byte URING_CMD, and the 2nd
64byte SQE(slave) is another normal 64byte OP. For any OP which needs
to support slave OP, io_issue_defs[op].fused_slave needs to be set as 1,
and its ->issue() can retrieve/import buffer from master request's
fused_cmd_kbuf. The slave OP is actually submitted from kernel, part of
this idea is from Xiaoguang's ublk ebpf patchset, but this patchset
submits slave OP just like normal OP issued from userspace, that said,
SQE order is kept, and batching handling is done too.

Please see detailed design in commit log of the 7th patch, and one big
point is how to handle buffer ownership.

With this way, it is easy to support zero copy for ublk/fuse device.

Basically userspace can specify any sub-buffer of the ublk block request
buffer from the fused command just by setting 'offset/len'
in the slave SQE for running slave OP. This way is flexible to implement
io mapping: mirror, stripped, ...

The 8th & 9th patches enable fused slave support for the following OPs:

	OP_READ/OP_WRITE
	OP_SEND/OP_RECV/OP_SEND_ZC

The last 3 patches implement fused command support for ublk driver.

Follows userspace code:

https://github.com/ming1/ubdsrv/tree/fused-cmd-zc

Both loop and nbd ublk targets have supported zero copy by passing:

	ublk add -t [loop|nbd] -z .... 

Basic fs mount/kernel building and builtin test are done.

Performance improvement is obvious on memory bandwidth
related workloads, such as, 1~2X improvement on 64K/512K BS
IO test on loop with ramfs backing file.

Any comments are welcome!


Ming Lei (12):
  io_uring: increase io_kiocb->flags into 64bit
  io_uring: define io_mapped_ubuf->acct_pages as unsigned integer
  io_uring: extend io_mapped_ubuf to cover external bvec table
  io_uring: rename io_mapped_ubuf as io_mapped_buf
  io_uring: export 'struct io_mapped_buf' for fused cmd buffer
  io_uring: add IO_URING_F_FUSED and prepare for supporting OP_FUSED_CMD
  io_uring: add IORING_OP_FUSED_CMD
  io_uring: support OP_READ/OP_WRITE for fused slave request
  io_uring: support OP_SEND_ZC/OP_RECV for fused slave request
  block: ublk_drv: mark device as LIVE before adding disk
  block: ublk_drv: add common exit handling
  block: ublk_drv: apply io_uring FUSED_CMD for supporting zero copy

 drivers/block/ublk_drv.c       | 189 ++++++++++++++++++++++++--
 drivers/char/mem.c             |   4 +
 drivers/nvme/host/ioctl.c      |   9 ++
 include/linux/io_uring.h       |  65 ++++++++-
 include/linux/io_uring_types.h |  26 +++-
 include/uapi/linux/io_uring.h  |   1 +
 include/uapi/linux/ublk_cmd.h  |   1 +
 io_uring/Makefile              |   2 +-
 io_uring/fdinfo.c              |   6 +-
 io_uring/fused_cmd.c           | 233 +++++++++++++++++++++++++++++++++
 io_uring/fused_cmd.h           |  11 ++
 io_uring/io_uring.c            |  24 +++-
 io_uring/io_uring.h            |   3 +
 io_uring/net.c                 |  23 +++-
 io_uring/opdef.c               |  17 +++
 io_uring/opdef.h               |   2 +
 io_uring/rsrc.c                |  31 ++---
 io_uring/rsrc.h                |  12 +-
 io_uring/rw.c                  |  20 +++
 19 files changed, 623 insertions(+), 56 deletions(-)
 create mode 100644 io_uring/fused_cmd.c
 create mode 100644 io_uring/fused_cmd.h

-- 
2.31.1


             reply	other threads:[~2023-03-01 14:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 14:05 Ming Lei [this message]
2023-03-01 14:06 ` [RFC PATCH 01/12] io_uring: increase io_kiocb->flags into 64bit Ming Lei
2023-03-01 14:06 ` [RFC PATCH 02/12] io_uring: define io_mapped_ubuf->acct_pages as unsigned integer Ming Lei
2023-03-01 14:06 ` [RFC PATCH 03/12] io_uring: extend io_mapped_ubuf to cover external bvec table Ming Lei
2023-03-01 14:06 ` [RFC PATCH 04/12] io_uring: rename io_mapped_ubuf as io_mapped_buf Ming Lei
2023-03-01 14:06 ` [RFC PATCH 05/12] io_uring: export 'struct io_mapped_buf' for fused cmd buffer Ming Lei
2023-03-01 14:06 ` [RFC PATCH 06/12] io_uring: add IO_URING_F_FUSED and prepare for supporting OP_FUSED_CMD Ming Lei
2023-03-01 14:06 ` [RFC PATCH 07/12] io_uring: add IORING_OP_FUSED_CMD Ming Lei
2023-03-01 14:06 ` [RFC PATCH 08/12] io_uring: support OP_READ/OP_WRITE for fused slave request Ming Lei
2023-03-01 14:06 ` [RFC PATCH 09/12] io_uring: support OP_SEND_ZC/OP_RECV " Ming Lei
2023-03-01 14:06 ` [RFC PATCH 10/12] block: ublk_drv: mark device as LIVE before adding disk Ming Lei
2023-03-03  2:25   ` Ziyang Zhang
2023-03-01 14:06 ` [RFC PATCH 11/12] block: ublk_drv: add common exit handling Ming Lei
2023-03-03  2:15   ` Ziyang Zhang
2023-03-01 14:06 ` [RFC PATCH 12/12] block: ublk_drv: apply io_uring FUSED_CMD for supporting zero copy Ming Lei
2023-03-03  2:52 ` [RFC PATCH 00/12] io_uring: add IORING_OP_FUSED_CMD Ziyang Zhang
2023-03-03  3:01   ` Ming Lei

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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