fio.git
3 days agoMerge branch 'master' of https://github.com/celestinechen/fio master
Jens Axboe [Fri, 19 Apr 2024 19:51:05 +0000 (13:51 -0600)]
Merge branch 'master' of https://github.com/celestinechen/fio

* 'master' of https://github.com/celestinechen/fio:
  FIO with fsync option issues more DDIR_SYNC commands than expected

4 days agoFIO with fsync option issues more DDIR_SYNC commands than expected
celestinechen [Fri, 19 Apr 2024 06:22:15 +0000 (06:22 +0000)]
FIO with fsync option issues more DDIR_SYNC commands than expected

Issue and root cause:
When fsync option is used, the number of flush (or DDIR_SYNC) commands
issued is more than the expected number of flush commands.
To elaborate:
- In the fio config file, consider fsync=1
1. FIO issues 1 write command
2. After write completes, FIO sets last_was_sync variable to false
3. FIO issues 1 flush command
4. FIO keeps issuing flush commands since last_was_sync is still false
and this causes more flush commands to be issued than expected
5. last_was_sync is set to true after the flush command completes
- The above steps repeats until the workload is completed.
Fix:
Instead of setting last_was_sync to true after flush command is completed
and setting last_was_sync to false after write command is completed,
set last_was_sync to true after flush command is issued and set
last_was_sync to false after write command is issued.

Signed-off-by: Celestine Chen celestinechen@google.com
4 days agofio: ioengine flag cleanup
Vincent Fu [Wed, 17 Apr 2024 17:51:30 +0000 (17:51 +0000)]
fio: ioengine flag cleanup

Convert how we define ioengine flags to use the same construction used
for thread flags. This allows us to count the number of ioengine flags
and write an assertion to ensure that thread flags and ioengine flags
fit inside td->flags.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 days agofio: remove compile time assertion
Vincent Fu [Wed, 17 Apr 2024 17:45:05 +0000 (17:45 +0000)]
fio: remove compile time assertion

TD_NR is the number of fio run states. It's not related to the number of
bits we need to shift ioengine flags in order to store them in
td->flags. Testing this assertion doesn't make sense.

Fixes: 9b87f09b ("fio: inherit IO engine flags to 'td'")
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 days agofio: use thread flag count for ioengine flag shift
Vincent Fu [Wed, 17 Apr 2024 15:37:24 +0000 (15:37 +0000)]
fio: use thread flag count for ioengine flag shift

We store the thread and ioengine flags in the same unsigned long long
with the ioengine flags bit shifted by the number of thread flags. In
the macros related to the bit shift, just use the count of the number of
thread flags. This way any time we change the number of thread flags the
required shift will be automatically updated.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 days agotest: add test for readwrite issue
Chana-Zaks-wdc [Thu, 18 Apr 2024 09:22:23 +0000 (12:22 +0300)]
test: add test for readwrite issue

test the previous commit: Don’t break too early in readwrite mode

In rw mode if io_size > size An early reset of the addresses occurred.
Make sure all addresses are done correctly.

Signed-off-by: Chana-Zaks-wdc <chana.zaks@wdc.com>
Link: https://lore.kernel.org/r/20240418092222.20543-3-chana.zaks@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 days agoDon break too early in readwrite mode
Chana-Zaks-wdc [Thu, 18 Apr 2024 09:22:22 +0000 (12:22 +0300)]
Don break too early in readwrite mode

In readwrite mode, when io-size > size, we break too early and start
looping the addresses too soon. Instead of reset the address when
reaching size, we start looping after size/2, e.g. in a 50/50 rw. This
wrong behavior is demonstrated in the example below.

Before the fix:
size is 0x140000, io-size is 0x280000, max-address = 0xa0000 = size / 2.

./fio --debug=io --name=global --filename=/dev/mmcblk0p3 --size=1280K
--io_size=2560k --bs=128K --offset=0   --name=test1 --rw=rw| grep "complete: io_u"

io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x80000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x20000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x40000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0xa0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x0,     len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x20000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x40000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x0,     len=0x20000, ddir=1, file=/dev/mmcblk0p3
Io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x80000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x20000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x40000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0xa0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3

After the fix max-address = 0x120000 = size – len:

io 32594 complete: io_u 0x70fc000980: off=0x0,     len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x20000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x40000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x0,     len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x60000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x80000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x20000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x40000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x60000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xa0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x80000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xc0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xa0000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xe0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x100000,len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x120000,len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xc0000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xe0000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x0,     len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x20000, len=0x20000, ddir=0, file=/dev/mmcblk0p3

Fixes: ac002339c382 (Fix bug with rw sequence offset and io_limit)
Signed-off-by: Chana-Zaks-wdc <chana.zaks@wdc.com>
Link: https://lore.kernel.org/r/20240418092222.20543-2-chana.zaks@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 days agot/io_uring: only calculate per-file depth if we have files
Jens Axboe [Wed, 17 Apr 2024 22:33:28 +0000 (16:33 -0600)]
t/io_uring: only calculate per-file depth if we have files

If NOPs are used, then no files exist, and hence the app will throw
a floating point error when trying to divide by zero.

Fixes: 6067863c7016 ("t/io_uring: pre-calculate per-file depth")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 days agogithub: add reminders to PR template
Vincent Fu [Wed, 17 Apr 2024 19:28:31 +0000 (15:28 -0400)]
github: add reminders to PR template

Remind contributors to bump the server version and ioengine ops version
when appropriate.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
5 days agoMerge branch 'ioops_ver' of https://github.com/ankit-sam/fio
Jens Axboe [Wed, 17 Apr 2024 16:04:10 +0000 (10:04 -0600)]
Merge branch 'ioops_ver' of https://github.com/ankit-sam/fio

* 'ioops_ver' of https://github.com/ankit-sam/fio:
  ioengines: bump up FIO_IOOPS_VERSION

5 days agoioengines: bump up FIO_IOOPS_VERSION
Ankit Kumar [Wed, 17 Apr 2024 23:44:33 +0000 (05:14 +0530)]
ioengines: bump up FIO_IOOPS_VERSION

This was left out when multi range trim support was added.
Fixes: commit b3251e31 (trim: add support for multiple ranges)

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
6 days agoMerge branch 'directory-operation' of https://github.com/friendy-su/fio
Vincent Fu [Tue, 16 Apr 2024 15:04:58 +0000 (11:04 -0400)]
Merge branch 'directory-operation' of https://github.com/friendy-su/fio

* 'directory-operation' of https://github.com/friendy-su/fio:
  engines/fileoperations: add more description for file/directory operation engines

7 days agoRevert "ioengines: Make td_io_queue print log_err when got error "
Jens Axboe [Mon, 15 Apr 2024 18:26:56 +0000 (12:26 -0600)]
Revert "ioengines: Make td_io_queue print log_err when got error "

We should not be making these error prints, they are purely
information, and in fact they should probably get deleted all
together.

For now, as this is actually breaking test frameworks, just revert
the change.

This reverts commit 3c826d1cafe6c703237378314bdcd123770971e3.

https://lore.kernel.org/fstests/20240415182231.GA2649469@mit.edu/
Reported-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 days agoengines/fileoperations: add more description for file/directory operation engines
friendy-su [Mon, 8 Apr 2024 09:22:47 +0000 (17:22 +0800)]
engines/fileoperations: add more description for file/directory operation engines

file/directory operations are quite different from I/O operation.
Add more description for how to configure the measurement
and how to utilize the data.

Signed-off-by: friendy-su <friendy.su@sony.com>
2 weeks agohowto: fix zonemode formatting
Vincent Fu [Tue, 2 Apr 2024 15:10:58 +0000 (11:10 -0400)]
howto: fix zonemode formatting

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 weeks agoFio 3.37 fio-3.37
Jens Axboe [Tue, 26 Mar 2024 21:13:51 +0000 (15:13 -0600)]
Fio 3.37

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 weeks agoMerge branch 'delete-instead-of-unlink' of https://github.com/edigaryev/fio
Jens Axboe [Mon, 25 Mar 2024 16:45:13 +0000 (10:45 -0600)]
Merge branch 'delete-instead-of-unlink' of https://github.com/edigaryev/fio

* 'delete-instead-of-unlink' of https://github.com/edigaryev/fio:
  docs: use "delete" term instead of "unlink", which is less common

4 weeks agodocs: use "delete" term instead of "unlink", which is less common
Nikolay Edigaryev [Mon, 25 Mar 2024 09:42:57 +0000 (13:42 +0400)]
docs: use "delete" term instead of "unlink", which is less common

Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
4 weeks agoMerge branch 'issue-1735' of https://github.com/yygcode/fio
Vincent Fu [Fri, 22 Mar 2024 14:39:37 +0000 (10:39 -0400)]
Merge branch 'issue-1735' of https://github.com/yygcode/fio

* 'issue-1735' of https://github.com/yygcode/fio:
  iolog: fix disk stats issue

4 weeks agoiolog: fix disk stats issue
yonggang.yyg [Wed, 20 Mar 2024 16:10:03 +0000 (00:10 +0800)]
iolog: fix disk stats issue

In the iolog replay scenario, the disk util in the td structure is
not initialized, resulting in the disk stats not being correctly
updated.

Fixes: https://github.com/axboe/fio/issues/1735

Signed-off-by: Yong Gang <yygcode@gmail.com>
4 weeks agoexamples: fiograph plots for dir operation ioengines
Vincent Fu [Fri, 22 Mar 2024 14:30:43 +0000 (10:30 -0400)]
examples: fiograph plots for dir operation ioengines

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 weeks agoengines/fileoperations: use local var for ioengine data
Vincent Fu [Fri, 22 Mar 2024 14:21:56 +0000 (10:21 -0400)]
engines/fileoperations: use local var for ioengine data

Improve code readability by using a local variable for ioengine data.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 weeks agoengines/fileoperations: remove extra blank lines
Vincent Fu [Fri, 22 Mar 2024 14:16:30 +0000 (10:16 -0400)]
engines/fileoperations: remove extra blank lines

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 weeks agoioengines: implement dircreate, dirstat, dirdelete engines to fileoperations.c
friendy-su [Wed, 10 Jan 2024 09:20:36 +0000 (17:20 +0800)]
ioengines: implement dircreate, dirstat, dirdelete engines to fileoperations.c

Similar to file operation, directory operation performance is an
important benchmark to file system in practice.

* dircreate engine measures directories create performance
* dirstat engine measures directories lookup performance
* dirdelete engine measures directories delete performance

Signed-off-by: friendy-su <friendy.su@sony.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 weeks agot/run-fio-tests: restrict t0031 to Linux only
Vincent Fu [Thu, 21 Mar 2024 12:36:14 +0000 (08:36 -0400)]
t/run-fio-tests: restrict t0031 to Linux only

This test uses libaio. So run it only on Linux when libaio is available.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 weeks agotest: add the test for regrow logs with asynchronous I/O replay
Shin'ichiro Kawasaki [Thu, 21 Mar 2024 03:10:11 +0000 (12:10 +0900)]
test: add the test for regrow logs with asynchronous I/O replay

Add t/jobs/t0031-pre.fio and t/jobs/t0031.fio to test that the log
space is regrown for the asynchronous I/O replay jobs. This test case
confirms the fix by the previous commit titled "iolog: regrow logs in
iolog_delay()".

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240321031011.4140040-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 weeks agoiolog: regrow logs in iolog_delay()
Shin'ichiro Kawasaki [Thu, 21 Mar 2024 03:10:10 +0000 (12:10 +0900)]
iolog: regrow logs in iolog_delay()

The commit b85c01f7e9df ("iolog.c: fix inaccurate clat when replay
trace") triggered the assertion failure below for the workload which
does I/O replay as asynchronous I/O together with log recording options
such as write_lat_log.

  fio: stat.c:3030: get_cur_log: Assertion `iolog->pending->nr_samples < iolog->pending->max_samples' failed.
  fio: pid=40120, got signal=6

The assertion means that too many logs are recorded in the pending log
space which keeps the logs until next log space regrow by reglow_logs()
call. However, reglow_logs() is not called, and the pending log space
runs out.

The trigger commit modified iolog_delay() to call io_u_queued_complete()
so that the asynchronous I/Os can be completed during delays between
replayed I/Os. Before this commit, replayed I/Os were not completed
until all I/O units are consumed. So the free I/O unit list gets empty
periodically, then wait_for_completion() and regrow_logs() were called
periodically. After this commit, all I/O units are not consumed, so
wait_for_completion() and regrow_logs() are no longer called for long
duration. Hence the assertion failure.

To avoid the assertion, add the check for log regrow and reglow_logs()
call in iolog_delay().

Fixes: b85c01f7e9df ("iolog.c: fix inaccurate clat when replay trace")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240321031011.4140040-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 weeks agot/jobs/t0030: add test for --bandwidth-log option
Vincent Fu [Wed, 20 Mar 2024 18:08:46 +0000 (14:08 -0400)]
t/jobs/t0030: add test for --bandwidth-log option

Add a test to detect changes that break the --bandwidth-log option. This
option uses the logging data structures in a way that differs from how
the other logs use them. So it's easy to forget about this special case.

Recent patches resolving related breakage are:
d72244761b2230fbb2d6eaec59cdedd3ea651d4f ("stat: fix segfault with fio
option --bandwidth-log")
acc481b6d34aab3ee6e19f22b64f8bf0dd30480c ("iolog: fix reported defect
from coverity scan")

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 weeks agot/fiotestlib: pass command-line options to FioJobFileTest
Vincent Fu [Wed, 20 Mar 2024 18:24:26 +0000 (14:24 -0400)]
t/fiotestlib: pass command-line options to FioJobFileTest

Add a means to specify arbitrary command-line options when we are
running a test that consists of a fio job file.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
5 weeks agodocs: fix documentation for rate_cycle
Vincent Fu [Mon, 18 Mar 2024 18:51:10 +0000 (14:51 -0400)]
docs: fix documentation for rate_cycle

rate_cycle affects only rate_min and rate_iops_min.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agot/nvmept_pi: add support for xNVMe ioengine
Vincent Fu [Thu, 7 Mar 2024 18:55:22 +0000 (18:55 +0000)]
t/nvmept_pi: add support for xNVMe ioengine

Add a command-line option to run this script using the xNVMe ioengine
with the async io_uring_cmd backend. The default remains to use the
io_uring_cmd ioengine.

Example:

python3 t/nvmept_pi.py --dut /dev/ng1n1 --lbaf 6 --ioengine xnvme --fio ./fio

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agot/nvmept_pi: drop JSON output for error cases
Vincent Fu [Thu, 7 Mar 2024 19:25:16 +0000 (19:25 +0000)]
t/nvmept_pi: drop JSON output for error cases

Avoid errors decoding JSON data when testing invalid configurations.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agoexamples: add fiograph plots for netio_vsock examples
Vincent Fu [Thu, 7 Mar 2024 18:32:04 +0000 (13:32 -0500)]
examples: add fiograph plots for netio_vsock examples

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agoexamples: add fiograph plot for uring-cmd-trim-multi-range
Vincent Fu [Thu, 7 Mar 2024 18:28:40 +0000 (13:28 -0500)]
examples: add fiograph plot for uring-cmd-trim-multi-range

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agoexamples: add plots for xNVMe examples
Vincent Fu [Thu, 7 Mar 2024 18:27:11 +0000 (13:27 -0500)]
examples: add plots for xNVMe examples

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agoexamples: update plot for cmdprio-bssplit
Vincent Fu [Thu, 7 Mar 2024 17:55:31 +0000 (12:55 -0500)]
examples: update plot for cmdprio-bssplit

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agoDoc: Make note of using bsrange with ':'
Avri Altman [Tue, 5 Mar 2024 09:00:08 +0000 (11:00 +0200)]
Doc: Make note of using bsrange with ':'

Which is also a supported form of delimiter.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-6-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agot/jobs: Fix a typo in jobs 23 & 24
Avri Altman [Tue, 5 Mar 2024 09:00:07 +0000 (11:00 +0200)]
t/jobs: Fix a typo in jobs 23 & 24

s/bsrange/bssplit

Fixes: commit c37183f8a161 (test: test job for randtrimwrite)
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-5-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agot/jobs: Rename test job 15
Avri Altman [Tue, 5 Mar 2024 09:00:06 +0000 (11:00 +0200)]
t/jobs: Rename test job 15

Make it designate the correct fixing commit.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-4-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agot/jobs: Further clarify regression test 7
Avri Altman [Tue, 5 Mar 2024 09:00:05 +0000 (11:00 +0200)]
t/jobs: Further clarify regression test 7

Add some more details explaining why the the successful result should be
87,040KB data.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-3-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agofio: Some minor code cleanups
Avri Altman [Tue, 5 Mar 2024 09:00:04 +0000 (11:00 +0200)]
fio: Some minor code cleanups

limit the scope of variables when possible, fix style isses etc.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-2-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 weeks agoMerge branch 'patch-ioengines' of https://github.com/kcoms555/fio
Jens Axboe [Mon, 4 Mar 2024 14:31:47 +0000 (07:31 -0700)]
Merge branch 'patch-ioengines' of https://github.com/kcoms555/fio

* 'patch-ioengines' of https://github.com/kcoms555/fio:
  ioengines: Make td_io_queue print log_err when got error

7 weeks agoioengines: Make td_io_queue print log_err when got error
Jaeho [Mon, 4 Mar 2024 10:27:53 +0000 (19:27 +0900)]
ioengines: Make td_io_queue print log_err when got error

* ioengines prints error log when got I/O error

Signed-off-by: Cho Jaeho <kcoms555@naver.com>
7 weeks agogettime: fix cpuclock-test on AMD platforms
Vincent Fu [Tue, 27 Feb 2024 15:26:00 +0000 (10:26 -0500)]
gettime: fix cpuclock-test on AMD platforms

Starting with gcc 11 __sync_synchronize() compiles to

lock or QWORD PTR [rsp], 0

on x86_64 platforms. Previously it compiled to an mfence instruction.

See line 47 of https://godbolt.org/z/xfE18K7b4 for an example.

On Intel platforms this change does not affect the result of fio's CPU
clock test. But on AMD platforms, this change causes fio's CPU clock
test to fail and fio to fall back to clock_gettime() instead of using
the CPU clock for timing.

This patch has fio explicitly use an mfence instruction instead of
__sync_synchornize() in the CPU clock test code on x86_64 platforms in
order to allow the CPU clock test to pass on AMD platforms.

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240227155856.5012-1-vincent.fu@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 weeks agohowto: fix job_start_clock_id formatting
Vincent Fu [Tue, 27 Feb 2024 16:03:59 +0000 (11:03 -0500)]
howto: fix job_start_clock_id formatting

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 weeks agoci: fix macOS sphinx install issues
Vincent Fu [Thu, 22 Feb 2024 14:31:50 +0000 (09:31 -0500)]
ci: fix macOS sphinx install issues

We have had a lot of failures installing sphinx on macOS. The latest
failure suggested using pip instead of homebrew to install sphinx. So
let's try that.

https://github.com/axboe/fio/actions/runs/8004639029/job/21863677360?pr=1727

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoMerge branch 'fix-tests-cfi' of https://github.com/mikoxyz/fio
Jens Axboe [Thu, 22 Feb 2024 17:11:26 +0000 (10:11 -0700)]
Merge branch 'fix-tests-cfi' of https://github.com/mikoxyz/fio

* 'fix-tests-cfi' of https://github.com/mikoxyz/fio:
  options: declare *__val as long long
  t/io_uring: use char * for name arg in detect_node
  t/io_uring: include libgen.h

2 months agooptions: declare *__val as long long
Miko Larsson [Thu, 22 Feb 2024 12:02:23 +0000 (13:02 +0100)]
options: declare *__val as long long

Fixes CFI as the function signatures will now match with parse.h

Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
2 months agot/io_uring: use char * for name arg in detect_node
Miko Larsson [Thu, 22 Feb 2024 12:11:27 +0000 (13:11 +0100)]
t/io_uring: use char * for name arg in detect_node

Fixes the following compiler warning:
warning: passing 'const char *' to parameter of type 'char *' discards
qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
2 months agot/io_uring: include libgen.h
Miko Larsson [Thu, 22 Feb 2024 11:44:54 +0000 (12:44 +0100)]
t/io_uring: include libgen.h

This fixes the build with musl + clang >=15; musl doesn't declare
basename() anywhere else, and clang >=15 doesn't allow implicit
declarations.

Fixes: 4b9e13dc27fb (t/io_uring: support NUMA placement)
Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
2 months agoverify: fix integer sizes in verify state file
Vincent Fu [Fri, 16 Feb 2024 01:33:21 +0000 (01:33 +0000)]
verify: fix integer sizes in verify state file

nofiles and depth are 32-bit integers. So we shouldn't use 64-bit
conversion functions and casts. The current code actually works fine on
little-endian platforms since the conversion is a noop but this is
broken on big-endian platforms.

Fixes: 94a6e1bb ("Fix verify state for multiple files")
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agot/run-fio-tests: add t/nvmept_trim.py
Vincent Fu [Fri, 15 Dec 2023 15:52:27 +0000 (15:52 +0000)]
t/run-fio-tests: add t/nvmept_trim.py

Add the pass-through multi-range trim tests to the automated test suite.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agot/nvmept_trim.py: test multi-range trim
Vincent Fu [Tue, 12 Dec 2023 18:42:20 +0000 (18:42 +0000)]
t/nvmept_trim.py: test multi-range trim

This test script contains some regression tests for existing
functionality and also some tests for the new feature.

The multi-range trim tests basically count the number of requests
submitted and make sure that they are consistent with the block sizes
and number of ranges per request.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoio_u: move number_trim to reclaim 8 bytes in struct io_u
Jens Axboe [Thu, 15 Feb 2024 15:39:49 +0000 (08:39 -0700)]
io_u: move number_trim to reclaim 8 bytes in struct io_u

Move it under clat_prio_index, which already has a 6 byte gap. This
saves 8 bytes total in struct io_u, which is always nice.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agoengines/io_uring: add multi range dsm support
Ankit Kumar [Thu, 15 Feb 2024 15:18:12 +0000 (20:48 +0530)]
engines/io_uring: add multi range dsm support

Update the io_uring_cmd ioengine to support multiple ranges for trim.
This includes allocating buffer for multiple ranges, and changes to
the nvme trim helper functions.
Add an example on how to use multi range trim.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20240215151812.138370-4-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agoengines/nvme: pass offset and len instead of io_u
Ankit Kumar [Thu, 15 Feb 2024 15:18:11 +0000 (20:48 +0530)]
engines/nvme: pass offset and len instead of io_u

Remove io_u dependency while calculating start and number of lba.
This is a prep patch for multi-range trim support where an io_u entry
will contain multiple start offset and buffer len.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20240215151812.138370-3-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agotrim: add support for multiple ranges
Ankit Kumar [Thu, 15 Feb 2024 15:18:10 +0000 (20:48 +0530)]
trim: add support for multiple ranges

NVMe specification allow multiple ranges for the dataset management
commands. Currently the block ioctl only allows a single range for
trim, however multiple ranges can be specified using nvme character
device.

Add an option num_range to send multiple range per trim request, which
only works if the data direction is solely trim i.e. trim or randtrim.
Add FIO_MULTI_RANGE_TRIM as the ioengine flag, to restrict the usage of
this new option.
For multi range trim request this modifies the way IO buffers are used.
The buffer length will depend on number of trim ranges and the actual
buffer will contains start and length of each range entry.

This increases fio server version (FIO_SERVER_VER) to 103.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20240215151812.138370-2-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agot/io_uring: pre-calculate per-file depth
Jens Axboe [Thu, 15 Feb 2024 15:17:31 +0000 (08:17 -0700)]
t/io_uring: pre-calculate per-file depth

Rather than do this math every time, just calculate it at setup time
and use that.

Note that there's something wonky with how the depths are distributed,
it's quite common to see the first file eat the majority of the queue
depth, causing multiple file runs to be both slower than they should be,
and with very unevenly distributed depths. To be investigated.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agot/io_uring: account and ignore IO errors
Jens Axboe [Thu, 15 Feb 2024 15:16:55 +0000 (08:16 -0700)]
t/io_uring: account and ignore IO errors

It's still useful to test on devices that may trigger a single or
few IO errors, just log them and ignore them in the IOPS calculations.
And for stats calculations.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agotest: add the test for loops option and read-verify workloads
Shin'ichiro Kawasaki [Wed, 14 Feb 2024 12:20:08 +0000 (21:20 +0900)]
test: add the test for loops option and read-verify workloads

Add t/jobs/t0029.fio to test that the loops option works together with
read-verify workloads.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240214122008.4123286-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agoverify: fix loops option behavior of read-verify workloads
Shin'ichiro Kawasaki [Wed, 14 Feb 2024 12:20:07 +0000 (21:20 +0900)]
verify: fix loops option behavior of read-verify workloads

The commit 191d6634e8a6 ("verify: fix bytes_done accounting of
experimental verify") introduced td->bytes_verified to separate the
verified bytes from the read bytes in td->bytes_done[]. This fixed the
issue of experimental verify feature. However, it caused another issue.
When the verify workload does only read and does not do write, the read
bytes in td->bytes_done[] is no longer updated and always zero. This
zero value is returned from do_io() to thread_main() in the bytes_done
array. If the read bytes is zero, thread_main() marks the job to
terminate and it makes the loops option ignored. For example, the job
below should do 8k read, but it does only 4k read.

[global]
filename=/tmp/fio.test
size=4k
verify=md5

[write]
rw=write
do_verify=0

[read]
stonewall=1
rw=read
loops=2
do_verify=1

To make the loops option work together with the read-verify workloads,
modify io_u_update_bytes_done(). After updating td->bytes_verified,
check if the workload does not write. If so, do not return from
io_u_update_bytes_done() and update td->bytes_done[] for DDIR_READ in
the following code.

Fixes: 191d6634e8a6 ("verify: fix bytes_done accounting of experimental verify")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240214122008.4123286-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agoexamples: add PI example with xnvme ioengine
Ankit Kumar [Tue, 13 Feb 2024 15:33:15 +0000 (21:03 +0530)]
examples: add PI example with xnvme ioengine

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240213153315.134202-6-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoengines/xnvme: add checks for verify, block size and metadata size
Ankit Kumar [Tue, 13 Feb 2024 15:33:14 +0000 (21:03 +0530)]
engines/xnvme: add checks for verify, block size and metadata size

Add checks to ensure that the correct block size and metadata size is
passed by the user.
Disable normal verify checks when end to end data protection checks
are enabled because of CRC conflict.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240213153315.134202-5-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoengines:xnvme: add support for end to end data protection
Ankit Kumar [Tue, 13 Feb 2024 15:33:13 +0000 (21:03 +0530)]
engines:xnvme: add support for end to end data protection

This patch enables support for protection information to xnvme
ioengine.

This adds 4 new ioengine specific options
 * pi_act - Protection information action. Default: 1
 * pi_chk - Can be set to GUARD, APPTAG or REFTAG
 * apptag - Sets apptag field of command dword 15
 * apptag_mask - Sets apptag_mask field of command dword 15

For the sake of consistency these options are the same as the ones used
by io_uring_cmd ioengine and SPDK's external ioengine.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240213153315.134202-4-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoengines/xnvme: add support for metadata
Ankit Kumar [Tue, 13 Feb 2024 15:33:12 +0000 (21:03 +0530)]
engines/xnvme: add support for metadata

This enables support for separate metadata buffers with xnvme ioengine.
This is done by providing xnvme specific option md_per_io_size, which
for the sake of consistency is the same option used by io_uring_cmd
engine and SPDK's external ioengine.

Bump up the required xnvme support to v0.7.4

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240213153315.134202-3-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoengines/xnvme: allocate iovecs only if vectored I/O is enabled
Ankit Kumar [Tue, 13 Feb 2024 15:33:11 +0000 (21:03 +0530)]
engines/xnvme: allocate iovecs only if vectored I/O is enabled

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240213153315.134202-2-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agodocs: explain duplicate logging timestamps
Vincent Fu [Mon, 12 Feb 2024 17:13:01 +0000 (12:13 -0500)]
docs: explain duplicate logging timestamps

When a fio job ends, it cleans up by flushing any accumulated latency log
data for jobs with log_avg_msec enabled. This means that the final logging
interval may be different from what was specified by log_avg_msec. In
some cases there may even be duplicate timestamps. Add an explanation
for this phenomenon to the documentation.

During job cleanup it's possible to simply suppress the final log entry
if log_avg_msec has not passed since the previous log entry was recorded
but this throws away data that some users may depend on. For instance, a
55s job with log_avg_msec=10000 would have no long entry for the final
5s if we suppressed the final log entry.

Users concerned about final log entries with duplicate timestamps should
just ignore the second entry since it is likely based on only a handful
of I/Os.

Duplicate log entry example:

$ sudo ./fio --name=test --iodepth=2 --ioengine=libaio --time_based --runtime=5s --log_avg_msec=1000 --write_lat_log=test --filename=/dev/vda --direct=1
test: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=2
fio-3.36-61-g9cfa-dirty
Starting 1 process
Jobs: 1 (f=1): [R(1)][100.0%][r=250MiB/s][r=64.0k IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=1490: Mon Feb 12 12:19:13 2024
  read: IOPS=63.6k, BW=248MiB/s (260MB/s)(1242MiB/5001msec)
    slat (nsec): min=691, max=37070, avg=1272.54, stdev=674.26
    clat (usec): min=4, max=1731, avg=29.83, stdev= 7.03
     lat (usec): min=15, max=1734, avg=31.10, stdev= 7.19
    clat percentiles (usec):
     |  1.00th=[   23],  5.00th=[   25], 10.00th=[   26], 20.00th=[   27],
     | 30.00th=[   28], 40.00th=[   29], 50.00th=[   30], 60.00th=[   31],
     | 70.00th=[   32], 80.00th=[   33], 90.00th=[   35], 95.00th=[   37],
     | 99.00th=[   41], 99.50th=[   43], 99.90th=[   58], 99.95th=[   74],
     | 99.99th=[  104]
   bw (  KiB/s): min=244464, max=258112, per=100.00%, avg=254410.67, stdev=4788.90, samples=9
   iops        : min=61116, max=64528, avg=63602.67, stdev=1197.23, samples=9
  lat (usec)   : 10=0.01%, 20=0.06%, 50=99.76%, 100=0.16%, 250=0.01%
  lat (usec)   : 500=0.01%, 750=0.01%, 1000=0.01%
  lat (msec)   : 2=0.01%
  cpu          : usr=11.46%, sys=18.20%, ctx=159414, majf=0, minf=49
  IO depths    : 1=0.1%, 2=100.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=317842,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=2

Run status group 0 (all jobs):
   READ: bw=248MiB/s (260MB/s), 248MiB/s-248MiB/s (260MB/s-260MB/s), io=1242MiB (1302MB), run=5001-5001msec

Disk stats (read/write):
  vda: ios=311248/0, sectors=2489984/0, merge=0/0, ticks=7615/0, in_queue=7615, util=98.10%
$ cat test_lat.1.log
1000, 31907, 0, 0, 0
2000, 30705, 0, 0, 0
3000, 30738, 0, 0, 0
4000, 31196, 0, 0, 0
5000, 30997, 0, 0, 0
5000, 31559, 0, 0, 0

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agologging: expand runstates eligible for logging
Vincent Fu [Wed, 24 Jan 2024 17:41:16 +0000 (17:41 +0000)]
logging: expand runstates eligible for logging

Currently recording log entries for IOPS and BW logging with
log_avg_msec enabled only happens when a thread has completed its ramp
time and is in the TD_RUNNING or TD_VERIFYING run states.

It may happen that a final bandwidth or IOPS log entry is missed
when a job transitions from TD_RUNNING/TD_VERIFYING to TD_FINISHING
before the helper thread has a chance to calculate a final log entry.

This patch expands the run states where logging is permitted, allowing
log entries to be recorded for jobs in the TD_FINISHING or TD_EXITED
states. Each job cleans itself up and typically transitions quickly from
TD_FINISHING to TD_EXITED. The main fio backend thread carries out the
transition from TD_EXITED to TD_REAPED.

The window during which a job is in the TD_FINISHING and TD_EXITED
states is short, so measurements should still be reasonablly accurate.

I tested these patches with the following job:

fio --name=test --ioengine=null --time_based --runtime=3s --filesize=1T \
  --write_iops_log=test --write_bw_log=test --log_avg_msec=1000 \
  && cat test_iops.1.log && cat test_bw.1.log

Before this patch series 10/10 trials had missing log entries. With only
the helper_thread change in the preceding patch 3/10 trials had missing
log entries. With this entire patch series, only 1/10 trials had missing
log entries.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agohelper_thread: do not send A_EXIT message when exit is called
Vincent Fu [Tue, 23 Jan 2024 21:56:31 +0000 (21:56 +0000)]
helper_thread: do not send A_EXIT message when exit is called

When helper_thread_exit() is called, it uses two means to tell
helper_thread_main() to stop. It sends an A_EXIT message via the pipes
used for inter-process communication and it also sets the exit flag in
struct helper_data.

When helper_thread_main() receives the A_EXIT message, it immediately
breaks out of its main loop without carrying out any further activity
such as recording final log entries. This leads to missing final log
entries when log_avg_msec is enabled.

Removing the A_EXIT message helps resolve this issue in some cases as
with its removal the actions in the body of the loop have an opportunity
to be taken before checking the flag in struct helper_data.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agologging: record timestamp for each thread
Vincent Fu [Wed, 24 Jan 2024 17:38:18 +0000 (17:38 +0000)]
logging: record timestamp for each thread

Instead of recording a timestamp once before iterating through all the
threads to check if we should add a new bw or iops log measurement,
record a new timestamp before checking each thread.

We were already querying the time anyway for the mtime_since_now() call.
We might as well have it available locally for more accurate logging.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoMerge branch 'vsock' of https://github.com/MPinna/fio
Jens Axboe [Mon, 12 Feb 2024 18:56:33 +0000 (11:56 -0700)]
Merge branch 'vsock' of https://github.com/MPinna/fio

* 'vsock' of https://github.com/MPinna/fio:
  Add support for VSOCK to engine/net.c

2 months agoAdd support for VSOCK to engine/net.c
Marco Pinna [Tue, 6 Feb 2024 09:52:54 +0000 (10:52 +0100)]
Add support for VSOCK to engine/net.c

* configure: add option to enable/disable vsock support

* engines/net.c: add vsock support

The  VSOCK  address family facilitates communication between virtual
machines and the host they are running on.

The addressing is formed by 2 integers: <CID, port>
- CID: Context ID, it is the ID assigned to the VM
  0, 1, 2 CIDs are reserved:
  0 - hypervisor CID (rarely used)
  1 - local communication (loopback)
  2 - host CID (the guest can always reach the host using CID=2)

- port: port number on 32bit to reach a specific process

* examples: add 3 simple job files for vsock (one sender, one receiver
  and one that uses vsock loopback interface similar to
  examples/netio.fio)

* fio.1: add vsock to supported protocols together with the required
  parameters

* HOWTO.rst: add vsock to supported protocols together with the required
  parameters

Signed-off-by: Marco Pinna <marco.pinn95@gmail.com>
2 months agoverify: fix potential overflow before widen
Vincent Fu [Thu, 8 Feb 2024 22:37:01 +0000 (17:37 -0500)]
verify: fix potential overflow before widen

vc->hdr_num and len are both 32 bits wide and their product will be a
32-bit result. So any overflow will be lost. Cast hdr_num to unsigned
long long so that nothing is lost if the product overflows a 32-bit
integer.

This fixes the following issue reported by Coverity.

** CID 486274:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
/verify.c: 347 in log_verify_failure()

________________________________________________________________________________________________________
*** CID 486274:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
/verify.c: 347 in log_verify_failure()
341             uint32_t len;
342             struct thread_data *td = vc->td;
343
344             offset = vc->io_u->verify_offset;
345             if (td->o.verify != VERIFY_PATTERN_NO_HDR) {
346                     len = hdr->len;
>>>     CID 486274:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
>>>     Potentially overflowing expression "vc->hdr_num * len" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "unsigned long long" (64 bits, unsigned).
347                     offset += vc->hdr_num * len;
348             } else {
349                     len = vc->io_u->buflen;
350             }
351
352             log_err("%.8s: verify failed at file %s offset %llu, length %u"

Fixes: 9c8b90ae ("fix wrong offset for VERIFY_PATTERN_NO_HDR")
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoMerge branch 'fix-offset' of https://github.com/onkrasnov/fio
Vincent Fu [Thu, 8 Feb 2024 19:47:59 +0000 (14:47 -0500)]
Merge branch 'fix-offset' of https://github.com/onkrasnov/fio

* 'fix-offset' of https://github.com/onkrasnov/fio:
  fix wrong offset for VERIFY_PATTERN_NO_HDR

https://github.com/axboe/fio/pull/1709

2 months agot/zbd: add -s option to test-zbd-support script
Dmitry Fomichev [Tue, 6 Feb 2024 10:57:55 +0000 (19:57 +0900)]
t/zbd: add -s option to test-zbd-support script

The total number of ZBD tests in test-zbd-support script has grown
considerably over the years and zoned drive capacity has significantly
increased as well. Today, the test run duration may reach one hour for
large drives. If a terminal session failure happens during a run, it
is more efficient to restart the tests from the point where the last
run stopped rather than from the beginning.

Add -s option to the script command line to specify the starting
test number.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240206105755.214891-6-dmitry.fomichev@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agot/zbd: check device for unrestricted read support
Dmitry Fomichev [Tue, 6 Feb 2024 10:57:54 +0000 (19:57 +0900)]
t/zbd: check device for unrestricted read support

ZBD unit tests in t/zbd/test-zbd-support currently assume that the
drive that is being tested supports unrestricted reads, i.e. reads
that (partially or entirely) occur above the write pointer. This is
always the case with ZBD core code because Linux kernel rejects zoned
devices with restricted reads. However, libzbc ioengine does support
such devices.

The restricted/unrestricted reads feature is controlled by URSWRZ
device bit ("Unrestricted Reads of Sequential Write Required Zones")
which, depending on the device design, can be hard-coded to be reported
as 1 or 0 or it can be made configurable via MODE SET or SET FEATURES
commands. The unit tests need to behave correctly with any URSWRZ bit
value reported by the device if libzbc ioengine is used for testing.

Test #4 in the test script currently expects the device to have
unrestricted SWR zone reads. This test is guaranteed to fail if
the script is run against a drive that reports URSWRZ=0 with libzbc
ioengine.

Check if the drive has unrestricted read support disabled and process
the outcome of test #4 accordingly.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240206105755.214891-5-dmitry.fomichev@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agozbd: use a helper to calculate zone index
Dmitry Fomichev [Tue, 6 Feb 2024 10:57:53 +0000 (19:57 +0900)]
zbd: use a helper to calculate zone index

zone_lock() function contains the debug code to verify that the zone
being locked belongs to the job's working zone range. Clean up this
code by using a previously defined helper for calculating the zone
index to check.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240206105755.214891-4-dmitry.fomichev@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agooslib: log BLKREPORTZONE error code
Dmitry Fomichev [Tue, 6 Feb 2024 10:57:52 +0000 (19:57 +0900)]
oslib: log BLKREPORTZONE error code

BLKREPORTZONE may fail because of a variety of reasons.
Log both the return code and errno when this ioctl fails.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240206105755.214891-3-dmitry.fomichev@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agozbd: avoid assertions during sequential read I/O
Dmitry Fomichev [Tue, 6 Feb 2024 10:57:51 +0000 (19:57 +0900)]
zbd: avoid assertions during sequential read I/O

The following assert has been observed to be triggered
if the I/O offset + I/O size exceeds the device capacity in a
sequential read workload -

“zbd.c:110: zone_lock: Assertion `f->min_zone <= nz && nz < f->max_zone' failed.”

The code in zbd_zone_align_file_sizes() rounds down the I/O size to
avoid these situations, but it is bypassed if
td->o.td_ddir == TD_DDIR_READ.

Avoid this issue by modifying zbd_zone_align_file_sizes() to round down
the I/O size for read I/Os and leave the I/O offset untouched.

Fixes: bfbdd35b3e8f ("Add support for zoned block devices")
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240206105755.214891-2-dmitry.fomichev@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agofix wrong offset for VERIFY_PATTERN_NO_HDR
Oleg Krasnov [Sun, 28 Jan 2024 18:24:02 +0000 (18:24 +0000)]
fix wrong offset for VERIFY_PATTERN_NO_HDR

2 months agoexamples: cmdprio_bssplit: add CDL example
Niklas Cassel [Fri, 26 Jan 2024 18:13:53 +0000 (19:13 +0100)]
examples: cmdprio_bssplit: add CDL example

Add an example of how to use cmdprio_bssplit with Command Duration Limits.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20240126181353.4151771-2-cassel@kernel.org
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoexamples: cmdprio_bssplit: s,IO,I/O,
Niklas Cassel [Fri, 26 Jan 2024 18:13:52 +0000 (19:13 +0100)]
examples: cmdprio_bssplit: s,IO,I/O,

Replace IO with I/O.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20240126181353.4151771-1-cassel@kernel.org
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoMerge branch 'coverity-fix' of https://github.com/ankit-sam/fio
Jens Axboe [Thu, 25 Jan 2024 17:20:10 +0000 (10:20 -0700)]
Merge branch 'coverity-fix' of https://github.com/ankit-sam/fio

* 'coverity-fix' of https://github.com/ankit-sam/fio:
  iolog: fix reported defect from coverity scan

2 months agoiolog: fix reported defect from coverity scan
Ankit Kumar [Thu, 25 Jan 2024 23:33:28 +0000 (05:03 +0530)]
iolog: fix reported defect from coverity scan

Fix the two Null pointer dereferences issue reported by Coverity scan

Null pointer dereferences  (FORWARD_NULL)
Dereferencing null pointer "l->td"

Null pointer dereferences  (REVERSE_INULL)
Null-checking "p->td" suggests that it may be null, but it has already
been dereferenced on all paths leading to the check.

For aggregate read, write and trim bandwidth log, the setup_log function
gets called with NULL pointer reference for thread data. Thus before
dereferencing further we should check "l->td".

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
2 months agot/io_uring: remove dma map option
Jens Axboe [Thu, 25 Jan 2024 15:09:14 +0000 (08:09 -0700)]
t/io_uring: remove dma map option

This didn't make it into the kernel just yet, and if/when it does, it'll
likely look a bit different than the prototype. Since it's dead code for
now, just prune it and we can always reintroduce it when kernel support
is there.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agodocs: change listed type for log_window_value to str
Vincent Fu [Thu, 25 Jan 2024 13:56:35 +0000 (08:56 -0500)]
docs: change listed type for log_window_value to str

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agodocs: update fio man page for log_window_value
Ankit Kumar [Thu, 25 Jan 2024 11:01:24 +0000 (16:31 +0530)]
docs: update fio man page for log_window_value

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20240125110124.55137-3-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agostat: log out both average and max over the window
Ankit Kumar [Thu, 25 Jan 2024 11:01:23 +0000 (16:31 +0530)]
stat: log out both average and max over the window

Add option log_window_value alias of log_max_value which reports
average, max or both the values. Retain backward compatibility by
allowing =0 and =1 values to specify avg and max values respectively.

There is no change to existing log formats while reporting only average
or max values.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20240125110124.55137-2-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoci: resolve GitHub Actions Node.js warnings
Vincent Fu [Wed, 24 Jan 2024 18:58:11 +0000 (18:58 +0000)]
ci: resolve GitHub Actions Node.js warnings

Switch from actions/checkout@v3 to v4 and from
actions/upload-artifacts@v3 to v4.

This resolves the below warnings from GitHub Actions:

Node.js 16 actions are deprecated. Please update the following actions
to use Node.js 20: actions/checkout@v3. For more information see:
https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

Node.js 16 actions are deprecated. Please update the following actions
to use Node.js 20: actions/upload-artifact@v3. For more information see:
https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoconfigure: Don't use cross_prefix when invoking pkg-config
Chris Packham [Tue, 23 Jan 2024 20:26:36 +0000 (09:26 +1300)]
configure: Don't use cross_prefix when invoking pkg-config

pkg-config doesn't need to have a cross prefixed version. It can be
pointed at alternate sysroots with environment variables like
PKG_CONFIG_SYSROOT_DIR. The configure script was already inconsistent
with using `pkg-config` in some places and `${cross_prefix}pkg-config`
in others. Make check_min_lib_version() and the gtk checks consistent
with the rest by dropping the `${cross_prefix}` usage with pkg-config.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20240123202636.179467-1-chris.packham@alliedtelesis.co.nz
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agofilesetup: clear O_RDWR flag for verify_only write workloads
Vincent Fu [Fri, 19 Jan 2024 17:30:57 +0000 (17:30 +0000)]
filesetup: clear O_RDWR flag for verify_only write workloads

If verify_only is set we don't need to open the file with the O_RDWR
flagi for write workloads. So we should clear this flag. This will help
when the file is on a read-only file system.

Fixes: https://github.com/axboe/fio/issues/1681
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoci: stop hard coding number of jobs for make
Vincent Fu [Thu, 18 Jan 2024 17:20:29 +0000 (12:20 -0500)]
ci: stop hard coding number of jobs for make

GitHub increased the number of CPUs in its GitHub-hosted runners from
two to four for Linux and Windows. macOS remains at two CPUs. Stop
hard-coding the number of CPUs when we build fio and detect the number
at runtime.

https://github.blog/2024-01-17-github-hosted-runners-double-the-power-for-open-source/

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoconfigure: enable NVME_URING_CMD checking for Android
Jens Axboe [Wed, 17 Jan 2024 16:11:15 +0000 (09:11 -0700)]
configure: enable NVME_URING_CMD checking for Android

Link: https://github.com/axboe/fio/issues/1701
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoMerge branch 'group_reporting_indentation' of https://github.com/0mp/fio
Vincent Fu [Tue, 16 Jan 2024 14:03:35 +0000 (09:03 -0500)]
Merge branch 'group_reporting_indentation' of https://github.com/0mp/fio

* 'group_reporting_indentation' of https://github.com/0mp/fio:
  doc: group_reporting: Fix indentation and syntax

3 months agodoc: group_reporting: Fix indentation and syntax
Mateusz Piotrowski [Sun, 14 Jan 2024 17:16:19 +0000 (18:16 +0100)]
doc: group_reporting: Fix indentation and syntax

Use tabs consistently for the paragraphs describing the group_reporting
option. Also, make sure that there is no space between ":option:" and
"`group_reporting`".

Signed-off-by: Mateusz Piotrowski <0mp@FreeBSD.org>
3 months agot/strided: check_result() has no return value
Vincent Fu [Fri, 29 Dec 2023 03:12:47 +0000 (22:12 -0500)]
t/strided: check_result() has no return value

check_result() erroneously returned True or False. Drop the return value
to be consistent with the parent and related classes.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/strided: call parent class check_result()
Vincent Fu [Fri, 29 Dec 2023 03:12:20 +0000 (22:12 -0500)]
t/strided: call parent class check_result()

Make sure we call the parent class' check_result() method to check the
return code, stderr output, etc.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/random_seed: call parent class check_result()
Vincent Fu [Fri, 29 Dec 2023 03:10:43 +0000 (22:10 -0500)]
t/random_seed: call parent class check_result()

Make sure we call the parent class' check_result() method to check the
return code, stderr output, etc.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/nvmept: call parent class check_result()
Vincent Fu [Wed, 27 Dec 2023 02:55:59 +0000 (21:55 -0500)]
t/nvmept: call parent class check_result()

Make sure we call the parent class' check_result() method to check the
return code, stderr output, etc.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 months agot/zbd: add test case to confirm no write with rwmixwrite=0 option
Shin'ichiro Kawasaki [Wed, 20 Dec 2023 00:58:46 +0000 (09:58 +0900)]
t/zbd: add test case to confirm no write with rwmixwrite=0 option

The previous commit fixed the issue of the unexpected write with options
zonemode=zbd, rw=randrw and rwmixwrite=0. Add a test to confirm the fix.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20231220005846.1371456-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>