Skip to content

ublk: io_desc optimizations

Caleb Sander Mateos linux-block linux-kselftest lkml 2 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest8 patches 1 replyApplied
  2. v16 patches 8 repliesSuperseded

Changes in v2 from the cover letter

- Cap io_desc_size arbitrarily at 256 (Ming)
- Add kublk list support, selftest (Ming)
- Add Reviewed-by tags, Suggested-by tag (Ming)

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/8ublk: consistently use u16 for queue and tag numbersdrivers/block/ublk_drv.c+41 -390 replies
2/8ublk: remove struct ublk_zoned_report_desc's operation fielddrivers/block/ublk_drv.c+3 -110 replies
3/8ublk: split request validation from io_desc initdrivers/block/ublk_drv.c+48 -220 replies
4/8ublk: initialize io_desc on daemon taskdrivers/block/ublk_drv.c+2 -10 replies
5/8ublk: add UBLK_F_IO_DESC_SIZEdrivers/block/ublk_drv.c include/uapi/linux/ublk_cmd.h tools/testing/selftests/ublk/kublk.c+32 -120 replies
6/8selftests: ublk: add support for --io_desc_sizetools/testing/selftests/ublk/kublk.c tools/testing/selftests/ublk/kublk.h+24 -110 replies
7/8selftests: ublk: add UBLK_F_IO_DESC_SIZE testtools/testing/selftests/ublk/Makefile tools/testing/selftests/ublk/test_loop_08.sh+26 -00 replies
8/8ublk: lift checks out of ublk_{,un}map_io()drivers/block/ublk_drv.c+19 -510 replies

Reviews trailers per patch

5 of 8 patches have a Reviewed-by or Acked-by.

PatchMing Lei
1/8R-b
2/8R-b
3/8R-b
4/8R-b
5/8
6/8
7/8
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/8] ublk: io_desc optimizations

This series is based on the "ublk: harden user buffer handling" series.

ublk passes the parameters of incoming I/O in memory shared between the kernel ublk driver and userspace ublk server in struct ublksrv_io_desc.

The thread submitting the ublk I/O writes to the io_desc, while the ublk server thread handling the I/O reads the io_desc. This basically guarantees a cache miss on both threads for each ublk I/O. Avoid the cache misses by writing the io_desc on the server thread in the kernel before dispatching the I/O to userspace.

The size of each io_desc is currently fixed to 24 bytes, which has been an obstacle to extending it with additional fields [1]. Additionally, with multiple ublk server threads handling I/Os from the same ublk queue (possible with UBLK_F_PER_IO_DAEMON or UBLK_F_BATCH_IO), false sharing results from adjacent io_descs sharing the same cache line. Add a UBLK_F_IO_DESC_SIZE feature allowing the ublk server to increase the size of the io_descs for its ublk devices.

[1]: https://lore.kernel.org/linux-block/aV8QfvaNO5P6vOs6@fedora/

v2:
- Cap io_desc_size arbitrarily at 256 (Ming)
- Add kublk list support, selftest (Ming)
- Add Reviewed-by tags, Suggested-by tag (Ming)

v1: https://lore.kernel.org/linux-block/[email protected]/

Caleb Sander Mateos (8):
ublk: consistently use u16 for queue and tag numbers
ublk: remove struct ublk_zoned_report_desc's operation field
ublk: split request validation from io_desc init
ublk: initialize io_desc on daemon task
ublk: add UBLK_F_IO_DESC_SIZE
selftests: ublk: add support for --io_desc_size
selftests: ublk: add UBLK_F_IO_DESC_SIZE test
ublk: lift checks out of ublk_{,un}map_io()

 drivers/block/ublk_drv.c                     | 261 ++++++++++---------
 include/uapi/linux/ublk_cmd.h                |   5 +-
 tools/testing/selftests/ublk/Makefile        |   1 +
 tools/testing/selftests/ublk/kublk.c         |  30 ++-
 tools/testing/selftests/ublk/kublk.h         |   6 +-
 tools/testing/selftests/ublk/test_loop_08.sh |  25 ++
 6 files changed, 188 insertions(+), 140 deletions(-)
 create mode 100755 tools/testing/selftests/ublk/test_loop_08.sh
Signature · 1 line
2.54.0