linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Cc: Uday Shankar <ushankar@purestorage.com>,
	Caleb Sander Mateos <csander@purestorage.com>,
	Ming Lei <ming.lei@redhat.com>
Subject: [PATCH V5 0/6] ublk: support to register bvec buffer automatically
Date: Tue, 20 May 2025 12:54:30 +0800	[thread overview]
Message-ID: <20250520045455.515691-1-ming.lei@redhat.com> (raw)

Hello Jens,

This patch tries to address limitation from in-tree ublk zero copy:

- one IO needs two extra uring_cmd for register/unregister bvec buffer, not
  efficient

- introduced dependency on the two buffer register/unregister uring_cmd, so
  buffer consumer has to linked with the two uring_cmd, hard to use & less
  efficient

This patchset adds feature UBLK_F_AUTO_BUF_REG:

- register request buffer automatically before delivering io command to ublk server

- unregister request buffer automatically when completing the request

- buffer index is specified from ublk uring_cmd header

With this way, 'fio/t/io_uring -p0 /dev/ublkb0' shows that IOPS is improved
by 50% compared with F_SUPPORT_ZERO_COPY in my test VM.

kernel selftests are added for covering both function & stress test.

V5:
	- move ublk_set_auto_buf_reg() before completing ublk request (Caleb Sander
	  Mateos)
	- improve uapi document a bit
	- small improvement on the last patch for adding
	  UBLK_AUTO_BUF_REG_FALLBACK test

V4:
	- drop patch "ublk: allow io buffer register/unregister command issued
	  from other task contexts", which doesn't belong to this patchset

	- split out 'ublk: support UBLK_AUTO_BUF_REG_FALLBACK' (Caleb Sander
	  Mateos)

	- patch style & cleanup & document for addressing Caleb Sander Mateos's
	  comment

V3:
	- simplify UAPI interface by passing auto-buf-reg data via sqe->addr

	- cleanup implementation & document

V2:
	- drop RFC
	- not cover buffer registering to external io_uring, so drop io_uring
	  changes, and it can be done in future, the defined UAPI interface
	  provides this extension
	- add one extra patch for relaxing context constraint for buffer register/
	unregister command
	- support to fallback to ublk server for registering buffer in case of auto
	buffer register failure, add tests for covering this feature
	- code cleanup & comment improvement(Caleb Sander Mateos) 

Link: https://lore.kernel.org/linux-block/20250428094420.1584420-1-ming.lei@redhat.com/

Ming Lei (6):
  ublk: convert to refcount_t
  ublk: prepare for supporting to register request buffer automatically
  ublk: register buffer to local io_uring with provided buf index via
    UBLK_F_AUTO_BUF_REG
  ublk: support UBLK_AUTO_BUF_REG_FALLBACK
  selftests: ublk: support UBLK_F_AUTO_BUF_REG
  selftests: ublk: add test for covering UBLK_AUTO_BUF_REG_FALLBACK

 drivers/block/ublk_drv.c                      | 153 +++++++++++++++---
 include/uapi/linux/ublk_cmd.h                 |  97 +++++++++++
 tools/testing/selftests/ublk/Makefile         |   3 +
 tools/testing/selftests/ublk/fault_inject.c   |   5 +
 tools/testing/selftests/ublk/file_backed.c    |  17 +-
 tools/testing/selftests/ublk/kublk.c          |  59 ++++++-
 tools/testing/selftests/ublk/kublk.h          |  18 +++
 tools/testing/selftests/ublk/null.c           |  55 +++++--
 tools/testing/selftests/ublk/stripe.c         |  26 +--
 .../testing/selftests/ublk/test_generic_08.sh |  32 ++++
 .../testing/selftests/ublk/test_generic_09.sh |  28 ++++
 .../testing/selftests/ublk/test_stress_03.sh  |   7 +
 .../testing/selftests/ublk/test_stress_04.sh  |   7 +
 .../testing/selftests/ublk/test_stress_05.sh  |   9 ++
 14 files changed, 462 insertions(+), 54 deletions(-)
 create mode 100755 tools/testing/selftests/ublk/test_generic_08.sh
 create mode 100755 tools/testing/selftests/ublk/test_generic_09.sh

-- 
2.47.0


             reply	other threads:[~2025-05-20  4:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20  4:54 Ming Lei [this message]
2025-05-20  4:54 ` [PATCH V5 1/6] ublk: convert to refcount_t Ming Lei
2025-05-20  4:54 ` [PATCH V5 2/6] ublk: prepare for supporting to register request buffer automatically Ming Lei
2025-05-20 15:59   ` Jens Axboe
2025-05-20 17:40   ` Caleb Sander Mateos
2025-05-21  1:42     ` Ming Lei
2025-05-20  4:54 ` [PATCH V5 3/6] ublk: register buffer to local io_uring with provided buf index via UBLK_F_AUTO_BUF_REG Ming Lei
2025-05-20 17:40   ` Caleb Sander Mateos
2025-05-20  4:54 ` [PATCH V5 4/6] ublk: support UBLK_AUTO_BUF_REG_FALLBACK Ming Lei
2025-05-20 17:40   ` Caleb Sander Mateos
2025-05-20  4:54 ` [PATCH V5 5/6] selftests: ublk: support UBLK_F_AUTO_BUF_REG Ming Lei
2025-05-20  4:54 ` [PATCH V5 6/6] selftests: ublk: add test for covering UBLK_AUTO_BUF_REG_FALLBACK Ming Lei
2025-05-20 16:25 ` [PATCH V5 0/6] ublk: support to register bvec buffer automatically Jens Axboe

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 \
    --in-reply-to=20250520045455.515691-1-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ushankar@purestorage.com \
    /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;
as well as URLs for NNTP newsgroup(s).