Recent changes (master)
The following changes since commit 5ceed0be62f3ce8903d5747674f9f70f44e736d6:
docs: update language setting for Sphinx build (2022-05-31 20:58:00 -0600)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 26faead0f3c6e7608b89a51373f1455b91377fcb:
t/zbd: skip test case #13 when max_open_zones is too small (2022-06-02 03:58:31 -0600)
----------------------------------------------------------------
Ankit Kumar (5):
configure: check nvme uring command support
nvme: add nvme opcodes, structures and helper functions
docs: document options for io_uring_cmd I/O engine
zbd: Check for direct flag only if its block device engines/io_uring: Enable zone device support for io_uring_cmd I/O engine
Anuj Gupta (4):
io_uring.h: add IORING_SETUP_SQE128 and IORING_SETUP_CQE32
init: return error incase an invalid value is passed as option engines/io_uring: add new I/O engine for uring passthrough support
examples: add 2 example job file for io_uring_cmd engine
Jens Axboe (3):
engines/io_uring: cleanup supported case engines/nvme: fix 'fd' leak in error handling engines/nvme: ioctl return value is an int
Shin'ichiro Kawasaki (1):
t/zbd: skip test case #13 when max_open_zones is too small
HOWTO.rst | 41 +++-- Makefile | 4 +- configure | 21 +++ engines/io_uring.c | 346 +++++++++++++++++++++++++++++++++++++++++- engines/nvme.c | 347 +++++++++++++++++++++++++++++++++++++++++++ engines/nvme.h | 214 ++++++++++++++++++++++++++ examples/uring-cmd-ng.fio | 25 ++++ examples/uring-cmd-zoned.fio | 31 ++++ file.h | 12 +- fio.1 | 33 +++- init.c | 9 ++ os/linux/io_uring.h | 45 +++++- t/zbd/test-zbd-support | 23 ++- zbd.c | 4 +- 14 files changed, 1123 insertions(+), 32 deletions(-) create mode 100644 engines/nvme.c create mode 100644 engines/nvme.h create mode 100644 examples/uring-cmd-ng.fio create mode 100644 examples/uring-cmd-zoned.fio
---
Diff of recent changes:
HOWTO.rst +31 -10
@@ -1952,6 +1952,10 @@ I/O engine for both direct and buffered IO. This engine defines engine specific options. + **io_uring_cmd** + Fast Linux native asynchronous I/O for pass through commands. + This engine defines engine specific options. + **libaio** Linux native asynchronous I/O. Note that Linux may only support queued behavior with non-buffered I/O (set ``direct=1`` or
@@ -2255,22 +2259,34 @@ with the caveat that when used on the command line, they must come after the values for trim IOs are ignored. This option is mutually exclusive with the :option:`cmdprio_percentage` option. -.. option:: fixedbufs : [io_uring] +.. option:: fixedbufs : [io_uring] [io_uring_cmd] + + If fio is asked to do direct IO, then Linux will map pages for each + IO call, and release them when IO is done. If this option is set, the + pages are pre-mapped before IO is started. This eliminates the need to + map and release for each IO. This is more efficient, and reduces the + IO latency as well. + +.. option:: nonvectored : [io_uring] [io_uring_cmd] - If fio is asked to do direct IO, then Linux will map pages for each - IO call, and release them when IO is done. If this option is set, the - pages are pre-mapped before IO is started. This eliminates the need to - map and release for each IO. This is more efficient, and reduces the - IO latency as well. + With this option, fio will use non-vectored read/write commands, where + address must contain the address directly. Default is -1. -.. option:: registerfiles : [io_uring] +.. option:: force_async=int : [io_uring] [io_uring_cmd] + + Normal operation for io_uring is to try and issue an sqe as + non-blocking first, and if that fails, execute it in an async manner. + With this option set to N, then every N request fio will ask sqe to + be issued in an async manner. Default is 0. + +.. option:: registerfiles : [io_uring] [io_uring_cmd] With this option, fio registers the set of files being used with the kernel. This avoids the overhead of managing file counts in the kernel, making the submission and completion part more lightweight. Required for the below :option:`sqthread_poll` option. -.. option:: sqthread_poll : [io_uring] [xnvme] +.. option:: sqthread_poll : [io_uring] [io_uring_cmd] [xnvme] Normally fio will submit IO by issuing a system call to notify the kernel of available items in the SQ ring. If this option is set, the
@@ -2278,14 +2294,19 @@ with the caveat that when used on the command line, they must come after the This frees up cycles for fio, at the cost of using more CPU in the system. -.. option:: sqthread_poll_cpu : [io_uring] +.. option:: sqthread_poll_cpu : [io_uring] [io_uring_cmd] When :option:`sqthread_poll` is set, this option provides a way to define which CPU should be used for the polling thread. +.. option:: cmd_type=str : [io_uring_cmd] + + Specifies the type of uring passthrough command to be used. Supported + value is nvme. Default is nvme. + .. option:: hipri - [io_uring], [xnvme] + [io_uring] [io_uring_cmd] [xnvme] If this option is set, fio will attempt to use polled IO completions. Normal IO completions generate interrupts to signal the completion of
Makefile +2 -2
@@ -231,7 +231,7 @@ ifdef CONFIG_LIBXNVME endif ifeq ($(CONFIG_TARGET_OS), Linux) SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \ - oslib/linux-dev-lookup.c engines/io_uring.c + oslib/linux-dev-lookup.c engines/io_uring.c engines/nvme.c cmdprio_SRCS = engines/cmdprio.c ifdef CONFIG_HAS_BLKZONED SOURCE += oslib/linux-blkzoned.c
@@ -241,7 +241,7 @@ endif endif ifeq ($(CONFIG_TARGET_OS), Android) SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c profiles/tiobench.c \ - oslib/linux-dev-lookup.c engines/io_uring.c + oslib/linux-dev-lookup.c engines/io_uring.c engines/nvme.c cmdprio_SRCS = engines/cmdprio.c ifdef CONFIG_HAS_BLKZONED SOURCE += oslib/linux-blkzoned.c
configure +21 -0
@@ -2587,6 +2587,27 @@ if test "$libzbc" != "no" ; then fi print_config "libzbc engine" "$libzbc" +if test "$targetos" = "Linux" ; then +########################################## +# Check NVME_URING_CMD support +cat > $TMPC << EOF +#include <linux/nvme_ioctl.h> +int main(void) +{ + struct nvme_uring_cmd *cmd; + + return sizeof(struct nvme_uring_cmd); +} +EOF +if compile_prog "" "" "nvme uring cmd"; then + output_sym "CONFIG_NVME_URING_CMD" + nvme_uring_cmd="yes" +else + nvme_uring_cmd="no" +fi +print_config "NVMe uring command support" "$nvme_uring_cmd" +fi + ########################################## # Check if we have xnvme if test "$xnvme" != "yes" ; then
engines/io_uring.c +340 -6
422 lines not on this page · raw message
engines/nvme.c new file +347 -0
347 lines not on this page · raw message
engines/nvme.h new file +214 -0
214 lines not on this page · raw message
examples/uring-cmd-ng.fio new file +25 -0
@@ -0,0 +1,25 @@ +# io_uring_cmd I/O engine for nvme-ns generic character device + +[global] +filename=/dev/ng0n1 +ioengine=io_uring_cmd +cmd_type=nvme +size=1G +iodepth=32 +bs=4K +thread=1 +stonewall=1 + +[rand-write] +rw=randwrite +sqthread_poll=1 + +[rand-read] +rw=randread + +[write-opts] +rw=write +sqthread_poll=1 +sqthread_poll_cpu=0 +nonvectored=1 +registerfiles=1
examples/uring-cmd-zoned.fio new file +31 -0
@@ -0,0 +1,31 @@ +# io_uring_cmd I/O engine for nvme-ns generic zoned character device +# +# NOTE: with write workload iodepth must be set to 1 as there is no IO +# scheduler. + +[global] +filename=/dev/ng0n1 +ioengine=io_uring_cmd +cmd_type=nvme +zonemode=zbd +size=1G +iodepth=1 +bs=256K +verify=crc32c +stonewall=1 + +[rand-write] +rw=randwrite + +[write-opts] +rw=write +registerfiles=1 +sqthread_poll=1 +sqthread_poll_cpu=0 + +[randwrite-opts] +rw=randwrite +sqthread_poll=1 +sqthread_poll_cpu=0 +nonvectored=1 +registerfiles=1
file.h +7 -5
@@ -126,12 +126,14 @@ struct fio_file {unsigned int last_write_idx;/* -* For use by the io engine for offset or private data storage +* For use by the io engine to store offset */ -union { -uint64_t engine_pos; -void *engine_data; - }; +uint64_t engine_pos; + +/* +* For use by the io engine for private data storage +*/ +void *engine_data;/* * if io is protected by a semaphore, this is set
fio.1 +28 -5
@@ -1739,6 +1739,15 @@ Basic \fBpreadv\fR\|(2) or \fBpwritev\fR\|(2) I/O. .B pvsync2 Basic \fBpreadv2\fR\|(2) or \fBpwritev2\fR\|(2) I/O. .TP +.B io_uring +Fast Linux native asynchronous I/O. Supports async IO +for both direct and buffered IO. +This engine defines engine specific options. +.TP +.B io_uring_cmd +Fast Linux native asynchronous I/O for passthrough commands. +This engine defines engine specific options. +.TP .B libaio Linux native asynchronous I/O. Note that Linux may only support queued behavior with non-buffered I/O (set `direct=1' or
@@ -2040,35 +2049,49 @@ for trim IOs are ignored. This option is mutually exclusive with the \fBcmdprio_percentage\fR option. .RE .TP -.BI (io_uring)fixedbufs +.BI (io_uring,io_uring_cmd)fixedbufs If fio is asked to do direct IO, then Linux will map pages for each IO call, and release them when IO is done. If this option is set, the pages are pre-mapped before IO is started. This eliminates the need to map and release for each IO. This is more efficient, and reduces the IO latency as well. .TP -.BI (io_uring,xnvme)hipri +.BI (io_uring,io_uring_cmd)nonvectored +With this option, fio will use non-vectored read/write commands, where address +must contain the address directly. Default is -1. +.TP +.BI (io_uring,io_uring_cmd)force_async +Normal operation for io_uring is to try and issue an sqe as non-blocking first, +and if that fails, execute it in an async manner. With this option set to N, +then every N request fio will ask sqe to be issued in an async manner. Default +is 0. +.TP +.BI (io_uring,io_uring_cmd,xnvme)hipri If this option is set, fio will attempt to use polled IO completions. Normal IO completions generate interrupts to signal the completion of IO, polled completions do not. Hence they are require active reaping by the application. The benefits are more efficient IO for high IOPS scenarios, and lower latencies for low queue depth IO. .TP -.BI (io_uring)registerfiles +.BI (io_uring,io_uring_cmd)registerfiles With this option, fio registers the set of files being used with the kernel. This avoids the overhead of managing file counts in the kernel, making the submission and completion part more lightweight. Required for the below sqthread_poll option. .TP -.BI (io_uring,xnvme)sqthread_poll +.BI (io_uring,io_uring_cmd,xnvme)sqthread_poll Normally fio will submit IO by issuing a system call to notify the kernel of available items in the SQ ring. If this option is set, the act of submitting IO will be done by a polling thread in the kernel. This frees up cycles for fio, at the cost of using more CPU in the system. .TP -.BI (io_uring)sqthread_poll_cpu +.BI (io_uring,io_uring_cmd)sqthread_poll_cpu When `sqthread_poll` is set, this option provides a way to define which CPU should be used for the polling thread. .TP +.BI (io_uring_cmd)cmd_type \fR=\fPstr +Specifies the type of uring passthrough command to be used. Supported +value is nvme. Default is nvme. +.TP .BI (libaio)userspace_reap Normally, with the libaio engine in use, fio will use the \fBio_getevents\fR\|(3) system call to reap newly returned events. With
init.c +9 -0
@@ -2810,6 +2810,15 @@ int parse_cmd_line(int argc, char *argv[], int client_type)break ; ret =fio_cmd_ioengine_option_parse (td, opt, val); + +if (ret) { +if (td) { +put_job (td); + td =NULL ; + } + do_exit++; + exit_val =1 ; + }break ; }case 'w' :
os/linux/io_uring.h +44 -1
75 lines not on this page · raw message
t/zbd/test-zbd-support +22 -1
@@ -229,6 +229,14 @@ require_regular_block_dev() { return 0 } +require_block_dev() { + if [[ -b "$realdev" ]]; then + return 0 + fi + SKIP_REASON="$dev is not a block device" + return 1 +} + require_seq_zones() { local req_seq_zones=${1} local seq_bytes=$((disk_size - first_sequential_zone_sector * 512))
@@ -251,8 +259,19 @@ require_conv_zones() { return 0 } -# Check whether buffered writes are refused. +require_max_open_zones() { + local min=${1} + + if ((max_open_zones !=0 && max_open_zones < min)); then + SKIP_REASON="max_open_zones of $dev is smaller than $min" + return 1 + fi + return 0 +} + +# Check whether buffered writes are refused for block devices. test1() { + require_block_dev || return $SKIP_TESTCASE run_fio --name=job1 --filename="$dev" --rw=write --direct=0 --bs=4K \ "$(ioengine "psync")" --size="${zone_size}" --thread=1 \ --zonemode=zbd --zonesize="${zone_size}" 2>&1 |
@@ -453,6 +472,8 @@ test12() { test13() { local size off capacity + require_max_open_zones 4 || return $SKIP_TESTCASE + prep_write size=$((8 * zone_size)) off=$((first_sequential_zone_sector * 512))
zbd.c +2 -2
@@ -466,7 +466,7 @@ out:return res; } -/* Verify whether direct I/O is used for all host-managed zoned drives. */ +/* Verify whether direct I/O is used for all host-managed zoned block drives. */ static bool zbd_using_direct_io (void ) {struct thread_data *td;
@@ -477,7 +477,7 @@ static bool zbd_using_direct_io(void)if (td->o.odirect || !(td->o.td_ddir &TD_DDIR_WRITE ))continue ;for_each_file (td, f, j) { -if (f->zbd_info && +if (f->zbd_info && f->filetype ==FIO_TYPE_BLOCK && f->zbd_info->model ==ZBD_HOST_MANAGED )return false; }