fio.git
18 months agoclient/server: convert nr_zone_resets on the wire
Jens Axboe [Fri, 14 Dec 2018 15:29:14 +0000 (08:29 -0700)]
client/server: convert nr_zone_resets on the wire

Fixes: fd5d733fa34 ("Collect and show zone reset statistics")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoengines/aioring: update to newer API
Jens Axboe [Thu, 13 Dec 2018 21:23:39 +0000 (14:23 -0700)]
engines/aioring: update to newer API

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoengines/aioring: enable IOCTX_FLAG_SQPOLL
Jens Axboe [Thu, 13 Dec 2018 20:52:35 +0000 (13:52 -0700)]
engines/aioring: enable IOCTX_FLAG_SQPOLL

With this flag set, we don't have to do any system calls for
polled IO.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoio_u: ensure buflen is capped at maxbs
Jens Axboe [Thu, 13 Dec 2018 16:09:42 +0000 (09:09 -0700)]
io_u: ensure buflen is capped at maxbs

If we use bsranges and the maxbs isn't a natural multiple of the minbs,
then we can generate sizes that are larger than maxbs. Ensure that we
cap the buffer length generated at maxbs.

Sample workload and problem report:

fio --name=App2 --size=10m --rw=read --blocksize_range=3k-10k

App2: (g=0): rw=read, bs=(R) 3072B-10.0KiB, (W) 3072B-10.0KiB, (T) 3072B-10.0KiB, ioengine=psync, iodepth=1
fio-3.12-17-g0fcbc0
Starting 1 process
*** Error in `fio': double free or corruption (!prev): 0x0000555f92a80a60 ***
fio: pid=1468, got signal=6

App2: (groupid=0, jobs=1): err= 0: pid=1468: Wed Dec 12 19:09:07 2018
read: IOPS=8365, BW=52.9MiB/s (55.5MB/s)(9.00MiB/189msec)
clat (nsec): min=874, max=74912k, avg=116222.51, stdev=2186743.16
lat (nsec): min=912, max=74912k, avg=116373.83, stdev=2186743.70
clat percentiles (nsec):
| 1.00th=[ 964], 5.00th=[ 1128], 10.00th=[ 1368],
| 20.00th=[ 1672], 30.00th=[ 2008], 40.00th=[ 2288],
| 50.00th=[ 2704], 60.00th=[ 3088], 70.00th=[ 3536],
| 80.00th=[ 4768], 90.00th=[ 6304], 95.00th=[ 8160],
| 99.00th=[ 544768], 99.50th=[ 2113536], 99.90th=[30539776],
| 99.95th=[74973184], 99.99th=[74973184]
lat (nsec) : 1000=1.52%
lat (usec) : 2=28.34%, 4=44.85%, 10=21.70%, 20=0.51%, 50=0.32%
lat (usec) : 250=0.25%, 500=1.20%, 750=0.76%
lat (msec) : 4=0.25%, 20=0.13%, 50=0.13%, 100=0.06%
cpu : usr=3.72%, sys=3.72%, ctx=43, majf=0, minf=14
IO depths : 1=100.0%, 2=0.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=1581,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
READ: bw=52.9MiB/s (55.5MB/s), 52.9MiB/s-52.9MiB/s (55.5MB/s-55.5MB/s), io=9.00MiB (10.5MB), run=189-189msec

Disk stats (read/write):
sda: ios=24/0, merge=0/0, ticks=188/0, in_queue=260, util=55.70%

Fixes: https://github.com/axboe/fio/issues/726
Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoengines/aioring: various updates and fixes
Jens Axboe [Thu, 13 Dec 2018 13:33:37 +0000 (06:33 -0700)]
engines/aioring: various updates and fixes

- Add support for SQWQ and SQTHREAD. Buffered is now async!
- Kill unnecessary ifdefs
- Cleanup/fix error handling
- Handle fsync like a queued command
- Queue depth handling fixups

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoengines/libaio: remove features deprecated from old interface
Jens Axboe [Thu, 13 Dec 2018 05:02:16 +0000 (22:02 -0700)]
engines/libaio: remove features deprecated from old interface

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoaioring: remove qd > 1 restriction
Jens Axboe [Thu, 13 Dec 2018 04:10:25 +0000 (21:10 -0700)]
aioring: remove qd > 1 restriction

Just add the extra ring entry we need in ->init().

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoaioring: check for arch support AFTER including the headers
Jens Axboe [Thu, 13 Dec 2018 03:31:52 +0000 (20:31 -0700)]
aioring: check for arch support AFTER including the headers

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoaioring: hide it if archs don't define syscalls
Jens Axboe [Thu, 13 Dec 2018 03:21:42 +0000 (20:21 -0700)]
aioring: hide it if archs don't define syscalls

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agot/aio-ring: update for new API
Jens Axboe [Thu, 13 Dec 2018 03:05:40 +0000 (20:05 -0700)]
t/aio-ring: update for new API

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoAdd aioring engine
Jens Axboe [Thu, 13 Dec 2018 02:48:15 +0000 (19:48 -0700)]
Add aioring engine

This is a new Linux aio engine, built on top of the new aio
interfaces. It supports polled aio, regular aio, and buffered
aio.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoioengine: remove ancient alias for libaio
Jens Axboe [Thu, 13 Dec 2018 02:47:31 +0000 (19:47 -0700)]
ioengine: remove ancient alias for libaio

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agot/aio-ring: set nr_events after clear
Jens Axboe [Wed, 12 Dec 2018 16:49:40 +0000 (09:49 -0700)]
t/aio-ring: set nr_events after clear

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agot/aio-ring: update to new io_setup2(2)
Jens Axboe [Wed, 12 Dec 2018 16:47:15 +0000 (09:47 -0700)]
t/aio-ring: update to new io_setup2(2)

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agot/aio-ring: update to newer API
Jens Axboe [Wed, 12 Dec 2018 16:28:29 +0000 (09:28 -0700)]
t/aio-ring: update to newer API

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agot/aio-ring: updates/cleanups
Jens Axboe [Mon, 10 Dec 2018 22:14:36 +0000 (15:14 -0700)]
t/aio-ring: updates/cleanups

Signed-off-by: Jens Axboe <axboe@kernel.dk>
18 months agoAdd aio-ring test app
Jens Axboe [Mon, 10 Dec 2018 21:53:58 +0000 (14:53 -0700)]
Add aio-ring test app

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: increase RLIMIT_MEMLOCK for user buffers
Jens Axboe [Tue, 4 Dec 2018 18:27:02 +0000 (11:27 -0700)]
engines/libaio: increase RLIMIT_MEMLOCK for user buffers

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: update for newer io_setup2() system call
Jens Axboe [Tue, 4 Dec 2018 18:17:29 +0000 (11:17 -0700)]
engines/libaio: update for newer io_setup2() system call

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: set IOCB_HIPRI if we are polling
Jens Axboe [Sat, 1 Dec 2018 17:17:26 +0000 (10:17 -0700)]
engines/libaio: set IOCB_HIPRI if we are polling

Forgot to set it for the non-user mapped case.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agostat: assign for first stat iteration, don't sum
Jens Axboe [Fri, 30 Nov 2018 21:44:25 +0000 (14:44 -0700)]
stat: assign for first stat iteration, don't sum

Fixes: 70750d6a221f ("stat: only apply proper stat summing for event timestamps")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agostat: only apply proper stat summing for event timestamps
Jens Axboe [Fri, 30 Nov 2018 17:52:31 +0000 (10:52 -0700)]
stat: only apply proper stat summing for event timestamps

We generally sum two kinds of stats, one that is per-io type numbers,
and one that are just samples of performance (like iops, bw). Only
apply proper stat summing to the former, for the latter we just want
to add them up.

This fixes a group reporting case where we have multiple jobs, and
the IOPS/BW output still shows per-job numbers. Before, we'd have:

  read: IOPS=345k, BW=1346MiB/s (1411MB/s)(6229MiB/4628msec)
[...]
   bw (  KiB/s): min=282816, max=377080, per=24.99%, avg=344438.00, stdev=35329.77, samples=36
   iops        : min=70704, max=94270, avg=86109.50, stdev=8832.44, samples=36

with bw/iops showing per-job numbers, after this the same looks like:

  read: IOPS=349k, BW=1365MiB/s (1431MB/s)(6719MiB/4922msec)
[...]
   bw (  MiB/s): min= 1302, max= 1420, per=99.86%, avg=1363.02, stdev=11.14, samples=36
   iops        : min=333433, max=363668, avg=348933.33, stdev=2850.64, samples=36

which is more in line with what a user would expect.

Fixes: https://github.com/axboe/fio/issues/519
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: only initialize iocb members when we need to
Jens Axboe [Fri, 30 Nov 2018 17:49:30 +0000 (10:49 -0700)]
engines/libaio: only initialize iocb members when we need to

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agogettime: use nsec in get_cycles_per_msec division
Vincent Fu [Thu, 29 Nov 2018 18:14:18 +0000 (13:14 -0500)]
gettime: use nsec in get_cycles_per_msec division

Since we now have ntime_since() we can use nsec in the division for
get_cycles_per_msec(). This makes the cycles_per_msec value that fio
ultimately uses more stable since fio will no longer be using values
truncated to usec.

While we're here also modify some debug prints to make it explicit that
fio ultimately uses a trimmed mean in its time calculations.

On platforms where only gettimeofday() is available this will be no
worse than the original code since we will revert back to using times
truncated to usec.

With the patch, the last three digits of the trimmed mean have a tight
range from 784-786. Without the patch, the corresponding value (labeled
avg) has a much wider range from 821-958. Notice also that the standard
error S is an order of magnitude smaller with the patch.

*** WITH PATCH ***
$ ./fio --debug=time --cpuclock-test | grep mean
time     315   min=3466785, max=3466796, mean=3466789.120000, S=0.057234, N=50
time     315   trimmed mean=3466789, N=29
$ ./fio --debug=time --cpuclock-test | grep mean
time     329   min=3466784, max=3466795, mean=3466789.480000, S=0.053641, N=50
time     329   trimmed mean=3466788, N=36
$ ./fio --debug=time --cpuclock-test | grep mean
time     343   min=3466786, max=3466794, mean=3466789.220000, S=0.036654, N=50
time     343   trimmed mean=3466788, N=42
$ ./fio --debug=time --cpuclock-test | grep mean
time     357   min=3466785, max=3466794, mean=3466789.080000, S=0.053580, N=50
time     357   trimmed mean=3466788, N=33
$ ./fio --debug=time --cpuclock-test | grep mean
time     371   min=3466785, max=3466794, mean=3466789.600000, S=0.043519, N=50
time     371   trimmed mean=3466789, N=36
$ ./fio --debug=time --cpuclock-test | grep mean
time     385   min=3466785, max=3466794, mean=3466789.280000, S=0.052534, N=50
time     385   trimmed mean=3466789, N=32
$ ./fio --debug=time --cpuclock-test | grep mean
time     407   min=3466786, max=3466796, mean=3466789.520000, S=0.042616, N=50
time     407   trimmed mean=3466789, N=41
$ ./fio --debug=time --cpuclock-test | grep mean
time     513   min=3466785, max=3466796, mean=3466789.220000, S=0.051316, N=50
time     513   trimmed mean=3466789, N=35

*** WIHTOUT PATCH ***
$ ./fio-3.11 --debug=time --cpuclock-test | grep 'mean\|avg'
time     439   avg: 3466821
time     439   min=3466790, max=3467006, mean=3466838.060000, S=0.959748
$ ./fio-3.11 --debug=time --cpuclock-test | grep 'mean\|avg'
time     455   avg: 3466958
time     455   min=3466796, max=3466996, mean=3466945.880000, S=0.789178
$ ./fio-3.11 --debug=time --cpuclock-test | grep 'mean\|avg'
time     469   avg: 3466887
time     469   min=3466790, max=3466984, mean=3466887.500000, S=0.825069
$ ./fio-3.11 --debug=time --cpuclock-test | grep 'mean\|avg'
time     485   avg: 3466951
time     485   min=3466818, max=3466996, mean=3466939.420000, S=0.873334
$ ./fio-3.11 --debug=time --cpuclock-test | grep 'mean\|avg'
time     499   avg: 3466957
time     499   min=3466793, max=3467009, mean=3466950.140000, S=0.764626
$ ./fio-3.11 --debug=time --cpuclock-test | grep 'mean\|avg'
time     608   avg: 3466954
time     608   min=3466818, max=3466981, mean=3466937.040000, S=0.862232

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agorand: fix compressible data ratio per segment
Bari Antebi [Thu, 22 Nov 2018 18:14:57 +0000 (20:14 +0200)]
rand: fix compressible data ratio per segment

I've noticed a bug in fio while testing it. I expected to receive
output similar to the expected output below for: "hexdump -n 4096
/dev/nvme0n1" (considering the configuration file I've used that may
be found below).

Expected output:

0000000 fdc6 a8a8 7190 0219 1fb8 9632 d9dd 1e64
/* random data */
00004c0 d8a3 13fe aeec 0fb6 5b14 162e 0000 0000
00004d0 0000 0000 0000 0000 0000 0000 0000 0000
*
0001000

However, the output I've received contained data after address 4cc
(which should have been filled with zeroes until 1000 as far as I
understand, but as you can see 99a contains data.

0000000 fdc6 a8a8 7190 0219 1fb8 9632 d9dd 1e64
/* random data */
00004c0 d8a3 13fe aeec 0fb6 5b14 162e 0000 0000
00004d0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000990 0000 0000 0000 0000 fdc6 a8a8 7190 0219

Config file:

[global]
group_reporting=1
filename=/dev/nvme0n1
name=task_nvme0n1
rw=write
bs=4096
numjobs=1
iodepth=32
buffer_compress_chunk=4096
buffer_compress_percentage=70
cpus_allowed=0-8
cpus_allowed_policy=split
direct=1
ioengine=libaio
loops=1
refill_buffers=0

[job empty]
size=4096

Fio should write (100 - compress_percentage) * segemnt of random data
followed by compress_percentage * segemnt of compressible
data.

Currently, at each itereation fio fills (100 - compress_percentage) * segemnt
data, followed by (100 - compress_percentage) * segemnt of compressible
data until a the segment is filled.

Fixes: 811ac503a619 ("Compression fixes")
Signed-off-by: Bari Antebi <bari@lightbitslabs.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: use maximum buffer size for fixed user bufs
Jens Axboe [Wed, 28 Nov 2018 02:43:30 +0000 (19:43 -0700)]
engines/libaio: use maximum buffer size for fixed user bufs

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: add preliminary support for pre-mapped IO buffers
Jens Axboe [Tue, 27 Nov 2018 23:01:44 +0000 (16:01 -0700)]
engines/libaio: add preliminary support for pre-mapped IO buffers

Experimental kernel features that allows us to register IO buffers
when the io_context is setup, eliminating the need to perform
get_user_pages() + put_page() for each IO. This dramatically
increases performance and lowers latency.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoworkqueue: update IO counters promptly after handling IO
Vincent Fu [Mon, 26 Nov 2018 16:15:02 +0000 (11:15 -0500)]
workqueue: update IO counters promptly after handling IO

Currently, IO submit worker threads only update parent IO counters when
the threads are idle or when the threads exit. When offload fio jobs are
assigned a restrictive CPU mask, this results in reporting and logging
problems. This patch updates parent IO counters more promptly upon
completing each IO which resolves the reporting and logging problems.

In the output below, notice the missing read data direction output in
the first, simple job and how it appropriately appears after the patch
is applied. In the second job with logging, notice the missing log
entries (unequal file sizes) in the first log and how entries are no
longer missing for the run with the patch applied.

*********************
*** WITHOUT PATCH ***
*********************
$ ./fio --name=test --io_submit_mode=offload --cpus_allowed=1 --filename=/dev/sda --size=10M
test: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
fio-3.12-19-g41dd
Starting 1 process

test: (groupid=0, jobs=1): err= 0: pid=19746: Mon Nov 26 10:37:42 2018
  lat (nsec)   : 750=13.44%, 1000=42.42%
  lat (usec)   : 2=39.88%, 4=1.56%, 10=0.23%, 20=0.20%, 50=1.02%
  lat (usec)   : 100=0.55%, 250=0.27%, 500=0.35%, 750=0.04%
  lat (msec)   : 10=0.04%
  cpu          : usr=30.30%, sys=0.00%, ctx=5126, majf=0, minf=3
  IO depths    : 1=100.0%, 2=0.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=2560,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):

Disk stats (read/write):
  sda: ios=45/0, merge=0/0, ticks=44/0, in_queue=44, util=20.51%

*********************
***** WITH PATCH ****
*********************
$ ./fio --name=test --io_submit_mode=offload --cpus_allowed=1 --filename=/dev/sda --size=10M
test: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
fio-3.12-8-gee63-dirty
Starting 1 process

test: (groupid=0, jobs=1): err= 0: pid=19754: Mon Nov 26 10:37:56 2018
  read: IOPS=77.6k, BW=303MiB/s (318MB/s)(10.0MiB/33msec)
    clat (nsec): min=588, max=5941.5k, avg=5705.48, stdev=120112.09
     lat (nsec): min=1745, max=5950.7k, avg=7302.87, stdev=120311.09
    clat percentiles (nsec):
     |  1.00th=[    628],  5.00th=[    668], 10.00th=[    700],
     | 20.00th=[    740], 30.00th=[    772], 40.00th=[    812],
     | 50.00th=[    852], 60.00th=[    908], 70.00th=[    972],
     | 80.00th=[   1064], 90.00th=[   1256], 95.00th=[   1592],
     | 99.00th=[  48896], 99.50th=[ 158720], 99.90th=[ 544768],
     | 99.95th=[ 651264], 99.99th=[5931008]
  lat (nsec)   : 750=23.28%, 1000=49.92%
  lat (usec)   : 2=22.77%, 4=1.05%, 10=0.16%, 20=0.51%, 50=1.33%
  lat (usec)   : 100=0.27%, 250=0.31%, 500=0.27%, 750=0.08%
  lat (msec)   : 10=0.04%
  cpu          : usr=6.25%, sys=25.00%, ctx=5127, majf=0, minf=3
  IO depths    : 1=100.0%, 2=0.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=2560,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: bw=303MiB/s (318MB/s), 303MiB/s-303MiB/s (318MB/s-318MB/s), io=10.0MiB (10.5MB), run=33-33msec

Disk stats (read/write):
  sda: ios=45/0, merge=0/0, ticks=36/0, in_queue=36, util=20.92%

*********************
*** WITHOUT PATCH ***
*********************
$ ./fio-canonical/fio --name=test --direct=1 --filename=/dev/fioa --numjobs=4 --log_avg_msec=1000 --write_iops_log=test --time_based --runtime=10s --rw=read --bs=4k --cpus_allowed=1,3,2,7 --io_submit_mode=offload --group_reporting
test: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
...
fio-3.12-19-g41dd
Starting 4 processes
Jobs: 4 (f=4): [R(4)][100.0%][r=385MiB/s][r=98.7k IOPS][eta 00m:00s]
test: (groupid=0, jobs=4): err= 0: pid=22661: Mon Nov 26 08:51:19 2018
  read: IOPS=134k, BW=503MiB/s (527MB/s)(5029MiB/10001msec)
    clat (nsec): min=12481, max=73112, avg=20088.92, stdev=2744.19
     lat (nsec): min=15113, max=74716, avg=23846.94, stdev=3356.56
    clat percentiles (nsec):
     |  1.00th=[14016],  5.00th=[16320], 10.00th=[17024], 20.00th=[17792],
     | 30.00th=[18304], 40.00th=[19072], 50.00th=[20096], 60.00th=[20608],
     | 70.00th=[21376], 80.00th=[21888], 90.00th=[23424], 95.00th=[24704],
     | 99.00th=[28544], 99.50th=[29824], 99.90th=[33024], 99.95th=[34560],
     | 99.99th=[43264]
   bw (  KiB/s): min=126840, max=1711256, per=32.05%, avg=165065.08, stdev=210793.01, samples=60
   iops        : min=17773, max=213907, avg=39624.97, stdev=33794.49, samples=30
  lat (usec)   : 20=48.64%, 50=51.36%, 100=0.01%
  cpu          : usr=5.38%, sys=10.06%, ctx=1795113, majf=0, minf=63
  IO depths    : 1=100.0%, 2=0.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=1341011,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: bw=503MiB/s (527MB/s), 503MiB/s-503MiB/s (527MB/s-527MB/s), io=5029MiB (5274MB), run=10001-10001msec

Disk stats (read/write):
  fioa: ios=1341011/0, merge=0/0, ticks=16916/0, in_queue=18236, util=91.46%

$ ls -l test_iops.?.log
-rw-r--r-- 1 root root  55 Nov 26 08:51 test_iops.1.log
-rw-r--r-- 1 root root 162 Nov 26 08:51 test_iops.2.log
-rw-r--r-- 1 root root 162 Nov 26 08:51 test_iops.3.log
-rw-r--r-- 1 root root 162 Nov 26 08:51 test_iops.4.log

$ cat test_iops.1.log
1000, 17773, 0, 0
3000, 71404, 0, 0
9000, 213907, 0, 0

*********************
***** WITH PATCH ****
*********************
$ ./fio/fio --name=test --direct=1 --filename=/dev/fioa --numjobs=4 --log_avg_msec=1000 --write_iops_log=test --time_based --runtime=10s --rw=read --bs=4k --cpus_allowed=1,3,2,7 --io_submit_mode=offload --group_reporting
test: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
...
fio-3.12-19-g41dd-dirty
Starting 4 processes
Jobs: 4 (f=4): [R(4)][100.0%][r=528MiB/s][r=135k IOPS][eta 00m:00s]
test: (groupid=0, jobs=4): err= 0: pid=22685: Mon Nov 26 08:51:56 2018
  read: IOPS=131k, BW=514MiB/s (539MB/s)(5137MiB/10001msec)
    clat (usec): min=12, max=184, avg=20.55, stdev= 4.05
     lat (usec): min=15, max=187, avg=24.61, stdev= 4.80
    clat percentiles (nsec):
     |  1.00th=[14016],  5.00th=[16512], 10.00th=[17280], 20.00th=[17792],
     | 30.00th=[18560], 40.00th=[19072], 50.00th=[20096], 60.00th=[20608],
     | 70.00th=[21120], 80.00th=[22144], 90.00th=[24448], 95.00th=[27008],
     | 99.00th=[38144], 99.50th=[39680], 99.90th=[52480], 99.95th=[54528],
     | 99.99th=[56576]
   bw (  KiB/s): min=94640, max=145392, per=24.96%, avg=131304.57, stdev=11668.56, samples=76
   iops        : min=23691, max=36200, avg=32774.75, stdev=2963.63, samples=36
  lat (usec)   : 20=49.59%, 50=50.24%, 100=0.17%, 250=0.01%
  cpu          : usr=5.20%, sys=9.76%, ctx=1794339, majf=0, minf=63
  IO depths    : 1=100.0%, 2=0.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=1315098,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
   READ: bw=514MiB/s (539MB/s), 514MiB/s-514MiB/s (539MB/s-539MB/s), io=5137MiB (5387MB), run=10001-10001msec

Disk stats (read/write):
  fioa: ios=1315098/0, merge=0/0, ticks=17156/0, in_queue=20496, util=96.36%

$ ls -l test_iops.?.log
-rw-r--r-- 1 root root 162 Nov 26 08:51 test_iops.1.log
-rw-r--r-- 1 root root 162 Nov 26 08:51 test_iops.2.log
-rw-r--r-- 1 root root 162 Nov 26 08:51 test_iops.3.log
-rw-r--r-- 1 root root 162 Nov 26 08:51 test_iops.4.log

$ cat test_iops.1.log
1000, 27173, 0, 0
2000, 27186, 0, 0
3000, 34395, 0, 0
4000, 36200, 0, 0
5000, 36047, 0, 0
6000, 36043, 0, 0
7000, 36100, 0, 0
8000, 36121, 0, 0
9000, 36124, 0, 0

Fixes: https://www.spinics.net/lists/fio/msg07628.html
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agooptions: fix 'kb_base' being of the wrong type
Jens Axboe [Sun, 25 Nov 2018 16:56:06 +0000 (09:56 -0700)]
options: fix 'kb_base' being of the wrong type

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agooptions: fix 'unit_base' being of the wrong type
Jens Axboe [Sat, 24 Nov 2018 22:10:39 +0000 (15:10 -0700)]
options: fix 'unit_base' being of the wrong type

Fixes: https://github.com/axboe/fio/issues/717
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: cleanup new vs old io_setup() system call path
Jens Axboe [Wed, 21 Nov 2018 18:33:22 +0000 (11:33 -0700)]
engines/libaio: cleanup new vs old io_setup() system call path

Just fall through to the old code if the new one fails.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: use fio_memalign() helper for user iocbs
Jens Axboe [Wed, 21 Nov 2018 16:02:47 +0000 (09:02 -0700)]
engines/libaio: use fio_memalign() helper for user iocbs

Don't rely on posix_memalign() being there, that's why we have
this helper.

Also ensure that the memory is cleared. This is important, as
we are passing this to the kernel, and we can't rely on our
->prep() clearing everything all the time.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: the IOCTX_FLAG_* flags changed
Jens Axboe [Wed, 21 Nov 2018 14:18:06 +0000 (07:18 -0700)]
engines/libaio: the IOCTX_FLAG_* flags changed

Update to current API.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: fallback to old io_setup() system call
Jens Axboe [Wed, 21 Nov 2018 12:53:38 +0000 (05:53 -0700)]
engines/libaio: fallback to old io_setup() system call

We can't rely on the new one being there, if we fail calling
io_setup2(), fallback to io_setup() like before.

Fixes: a1b006fe1cd3 ("engines/libaio: fix new aio poll API")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: add support for user mapped iocbs
Jens Axboe [Wed, 21 Nov 2018 02:47:01 +0000 (19:47 -0700)]
engines/libaio: add support for user mapped iocbs

For polled IO, we can support having the kernel map our iocbs,
instead of having to copy them for each IO submission.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agobackend: initialize io engine before io_u buffers
Jens Axboe [Wed, 21 Nov 2018 02:42:19 +0000 (19:42 -0700)]
backend: initialize io engine before io_u buffers

Otherwise we call io_ops->io_u_init() before the IO scheduler is
setup, which is somewhat backwards.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoKill "No I/O performed by ..." message
Jens Axboe [Tue, 20 Nov 2018 18:59:36 +0000 (11:59 -0700)]
Kill "No I/O performed by ..." message

We keep finding false triggers for this, and it's driving me
nuts. Kill it with fire.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: fix new aio poll API
Jens Axboe [Tue, 20 Nov 2018 02:41:53 +0000 (19:41 -0700)]
engines/libaio: fix new aio poll API

It'll be final. Some day.

Fixes: ebec344dd336 ("engines/libaio: update to new io_setup2() system call")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoengines/libaio: update to new io_setup2() system call
Jens Axboe [Mon, 19 Nov 2018 23:11:56 +0000 (16:11 -0700)]
engines/libaio: update to new io_setup2() system call

We need that to enable polling.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agolibaio: switch to newer libaio polled IO API
Jens Axboe [Fri, 16 Nov 2018 03:31:35 +0000 (20:31 -0700)]
libaio: switch to newer libaio polled IO API

No more new opcodes, just set IOCB_FLAG_HIPRI instead.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoio_u: fall through to unlock path in case of error
Jens Axboe [Fri, 16 Nov 2018 01:56:12 +0000 (18:56 -0700)]
io_u: fall through to unlock path in case of error

Doesn't really matter since we're exiting anyway, but let's
do this right.

Fixes: d28174f0189c ("workqueue: ensure we see deferred error for IOs")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agobackend: silence "No I/O performed by..." if jobs ends in error
Jens Axboe [Thu, 15 Nov 2018 22:24:11 +0000 (15:24 -0700)]
backend: silence "No I/O performed by..." if jobs ends in error

If we have an error, we are logging it. There's no point in
spewing extra info on not having done any IO, that's only
really useful if we don't know WHY we didn't do any IO.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoworkqueue: ensure we see deferred error for IOs
Jens Axboe [Thu, 15 Nov 2018 22:21:39 +0000 (15:21 -0700)]
workqueue: ensure we see deferred error for IOs

If we get an error doing io_getevents(), for instance, then
the parent never knows this happened. This causes the parent
to hang waiting for IO to complete, which will never happen.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoworkqueue: fix misleading comment
Jens Axboe [Thu, 15 Nov 2018 22:18:32 +0000 (15:18 -0700)]
workqueue: fix misleading comment

We don't return anything from workqueue_enqueue().

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agoverify: add requested block information to failure trace
Feng, Changyu [Tue, 6 Nov 2018 06:57:27 +0000 (01:57 -0500)]
verify: add requested block information to failure trace

If verify_interval is not equal to the block size, FIO would verify the
data one segment by one segment according to the verify_interval. The
offset and length in the verify failure trace are the offset and length
of the corrupted segment, not the offset and block size of the IO.

On block storage system, we need the offset and length of the IO to
investigate data corruption issue. For me, I usually search the offset
of the IO in the storage system trace to figure out what happened in the
system.

Fixes: https://github.com/axboe/fio/issues/709
Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agolibaio: fix 'hipri' help entry
Jens Axboe [Wed, 7 Nov 2018 04:29:06 +0000 (21:29 -0700)]
libaio: fix 'hipri' help entry

Signed-off-by: Jens Axboe <axboe@kernel.dk>
19 months agolibaio: add support for polled IO
Jens Axboe [Tue, 6 Nov 2018 21:53:52 +0000 (14:53 -0700)]
libaio: add support for polled IO

The support isn't in mainline yet, but it's being developed.
Currently the kernel support resides in the 'mq-perf' branch
of the block repo:

git://git.kernel.dk/linux-block mq-perf

Also see:

http://git.kernel.dk/cgit/linux-block/log/?h=mq-perf

Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agoFio 3.12 fio-3.12
Jens Axboe [Fri, 2 Nov 2018 18:41:50 +0000 (12:41 -0600)]
Fio 3.12

Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agoFix Windows CPU count
Jeff Furlong [Fri, 2 Nov 2018 17:17:31 +0000 (11:17 -0600)]
Fix Windows CPU count

Return the current activ CPUs rather than the maximum supported
CPUs.

Fixes: c479640d6208 ("Merge branch 'proc_group' of https://github.com/sitsofe/fio")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agooslib: fix strlcat's incorrect copying
Tomohiro Kusumi [Fri, 26 Oct 2018 16:35:46 +0000 (09:35 -0700)]
oslib: fix strlcat's incorrect copying

Fix unittests/oslib/strlcat.c test case failure.

oslib/strlcat.c implementation is incorrect for edge case inputs,
when (dsize-strlen(dst)-1 <= 0). The example below isn't supposed
to be copying anything, but the result is it does copy and
overruns the stack.

This commit replalces oslib/strlcat.c with the original implementation
under BSDL.

--
 # uname
 Linux
 # cat ./test0.c
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include "./oslib/strlcat.h"

 int main(void) {
         char *p, s[10] = "test";
         int size = 200;

         p = calloc(1, size);
         memset(p, 65, size - 1);

         printf("%lu %lu %s\n", sizeof(s), strlen(s), s);
         strlcat(s, p, strlen(s));
         printf("%lu %lu %s\n", sizeof(s), strlen(s), s);

         return 0;
 }
 # gcc -Wall -g ./test0.c ./oslib/strlcat.c
 # ./a.out
 10 4 test
 10 203 testAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 Segmentation fault (core dumped)

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agolib: fix strntol's end pointer when str has leading spaces
Tomohiro Kusumi [Fri, 26 Oct 2018 16:35:45 +0000 (09:35 -0700)]
lib: fix strntol's end pointer when str has leading spaces

Fix unittests/lib/strntol.c test case failure.

Given behavior of strtol(3), "end" pointer should be calculated
based on "beg" pointer instead of "str" on success.

Otherwise if "str" has leading spaces (which are explicitly ignored
by strntol()), "end" won't point to "the first invalid character"
for not counting those spaces.

Glibc's strtol(3) says as follows.
--
 If endptr is not NULL, strtol() stores the address of the first
 invalid character in *endptr.  If there were no digits at all,
 strtol() stores the original value of nptr in *endptr (and returns 0).
 In particular, if *nptr is not '\0' but **endptr is '\0' on return,
 the entire string is valid.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agounittests: add unittest suite for oslib/strndup.c
Tomohiro Kusumi [Fri, 26 Oct 2018 16:35:44 +0000 (09:35 -0700)]
unittests: add unittest suite for oslib/strndup.c

Add test cases for oslib/strndup.c as an example of unittest.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agounittests: add unittest suite for oslib/strlcat.c
Tomohiro Kusumi [Fri, 26 Oct 2018 16:35:43 +0000 (09:35 -0700)]
unittests: add unittest suite for oslib/strlcat.c

Add test cases for oslib/strlcat.c as an example of unittest.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agounittests: add unittest suite for lib/strntol.c
Tomohiro Kusumi [Fri, 26 Oct 2018 16:35:42 +0000 (09:35 -0700)]
unittests: add unittest suite for lib/strntol.c

Add test cases for lib/strntol.c as an example of unittest.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agounittests: add unittest suite for lib/memalign.c
Tomohiro Kusumi [Fri, 26 Oct 2018 16:35:41 +0000 (09:35 -0700)]
unittests: add unittest suite for lib/memalign.c

Add test cases for lib/memalign.c as an example of unittest.

A workaround code to emulate smalloc()/sfree() was needed since
3114b675fd("fio: enable cross-thread overlap checking with processes")
introduced dependency on smalloc()/sfree() which has dependency
on fio code.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agounittests: add CUnit based unittest framework
Tomohiro Kusumi [Fri, 26 Oct 2018 16:35:40 +0000 (09:35 -0700)]
unittests: add CUnit based unittest framework

CUnit is C version of *unit framework to help write test cases.
https://sourceforge.net/projects/cunit/

unittests/* are compiled only if CUnit exists, and detected on
build time in ./configure like any other build time detection,
by running a simple CUnit initialization code.

Some OS/distros have binary package for CUnit. In case of Fedora
and FreeBSD, they both install shared library (libcunit.so) and
CUnit headers required to compile fio's unittests.
 Fedora:
  # dnf install CUnit
 FreeBSD:
  # pkg install cunit

To build and install CUnit from upstream source, do below.
 # ./bootstrap && make && make install
Note that make install seems to install binaries and headers under
~/CUnitHome/ by default.

After applying actual test cases in the next few commits, running
./unittests/unittest will print results to stdout. These are
examples of test cases, and one can add more tests.

-- Example of unittest results
 # ./unittests/unittest

      CUnit - A unit testing framework for C - Version 2.1-3
      http://cunit.sourceforge.net/

 Suite: lib/memalign.c
   Test: memalign/1 ...passed
 Suite: lib/strntol.c
   Test: strntol/1 ...passed
   Test: strntol/2 ...FAILED
     1. unittests/lib/strntol.c:24  - CU_ASSERT_EQUAL(*endp,'\0')
   Test: strntol/3 ...passed
 Suite: oslib/strlcat.c
   Test: strlcat/1 ...passed
   Test: strlcat/2 ...FAILED
     1. unittests/oslib/strlcat.c:28  - CU_ASSERT_EQUAL(strcmp(dst, ""),0)
 Suite: oslib/strndup.c
   Test: strndup/1 ...passed
   Test: strndup/2 ...passed
   Test: strndup/3 ...passed

 Run Summary:    Type  Total    Ran Passed Failed Inactive
               suites      4      4    n/a      0        0
                tests      9      9      7      2        0
              asserts     18     18     16      2      n/a

 Elapsed time =    0.000 seconds

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agoio_u: move trim error notification out-of-line
Jens Axboe [Wed, 24 Oct 2018 00:05:41 +0000 (18:05 -0600)]
io_u: move trim error notification out-of-line

Also kill dead code, we never touch BLOCK_STATE_WRITTEN as
it was guarded by a check for ddir == DDIR_TRIM.

The latter should probably be double checked...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agostat: use helper for IO direction name
Jens Axboe [Tue, 23 Oct 2018 20:43:36 +0000 (14:43 -0600)]
stat: use helper for IO direction name

Better than redefining the same thing in two locations...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agodocs: serialize_overlap=1 with io_submit_mode=offload no longer requires threads
Vincent Fu [Wed, 17 Oct 2018 16:03:25 +0000 (12:03 -0400)]
docs: serialize_overlap=1 with io_submit_mode=offload no longer requires threads

Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agofio: document locking for overlap checking in offload mode
Vincent Fu [Wed, 17 Oct 2018 16:03:24 +0000 (12:03 -0400)]
fio: document locking for overlap checking in offload mode

Overlap checking in offload submission mode uses locks in an unusual
manner. Add some comments in the code to clarify how locks are used.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agofio: enable cross-thread overlap checking with processes
Vincent Fu [Wed, 17 Oct 2018 16:03:23 +0000 (12:03 -0400)]
fio: enable cross-thread overlap checking with processes

Overlap checking with io_submit_mode=offload requires relevant jobs to
access each other's io_u's and io_u_all members. This patch modifies the
fio_memalign and io_u_queue helpers to include an indicator signifying
whether operations should use the shared memory pool. When fio is
carrying out cross-job overlap checking in offload submission mode,
these variables will be allocated from shared memory so that processes
can be used and threads will no longer be required.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agofio: add function to check for serialize_overlap with offload submission
Vincent Fu [Wed, 17 Oct 2018 16:03:22 +0000 (12:03 -0400)]
fio: add function to check for serialize_overlap with offload submission

In multiple places fio needs to check whether it is carrying out overlap
checking in offload submission mode. Make this check a function to
improve code readability.

Reviewed-by: Sebastien Boisvert <sboisvert@gydle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agoMerge branch 'samples-colnames' of https://github.com/parallel-fs-utils/fio
Jens Axboe [Fri, 19 Oct 2018 17:07:49 +0000 (11:07 -0600)]
Merge branch 'samples-colnames' of https://github.com/parallel-fs-utils/fio

* 'samples-colnames' of https://github.com/parallel-fs-utils/fio:
  add rsp. time samples as column 2, use meaningful pctile names

20 months agofilesetup: fix whitespace damage introduced by previous patch
Jens Axboe [Fri, 19 Oct 2018 17:07:06 +0000 (11:07 -0600)]
filesetup: fix whitespace damage introduced by previous patch

Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agoMerge branch 'fix-init-read-iolog' of https://github.com/aclamk/fio
Jens Axboe [Fri, 19 Oct 2018 17:06:51 +0000 (11:06 -0600)]
Merge branch 'fix-init-read-iolog' of https://github.com/aclamk/fio

* 'fix-init-read-iolog' of https://github.com/aclamk/fio:
  iolog: Fix problem with setup() not invoked when read_iolog is used.

20 months agofio: reset more counters when ramp time has elapsed
Vincent Fu [Thu, 18 Oct 2018 20:42:54 +0000 (16:42 -0400)]
fio: reset more counters when ramp time has elapsed

Currently,

fio --name=test --ramp_time=2 --time_based=1 --runtime=2s --size=1M

will produce an output line like

  IO depths    : 1=184.7%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%

184.7% appears because the denominator used in the IO depth calculation
is reset at the conclusion of ramp_time but the numerator is not.
Latency and other IO depth statistics also include data from IOs
completed during ramp time. This patch resets these counters when ramp
time is over.

Tested-by: Sebastien Boisvert <sboisvert@gydle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agoadd rsp. time samples as column 2, use meaningful pctile names
Ben England [Tue, 16 Oct 2018 16:19:39 +0000 (12:19 -0400)]
add rsp. time samples as column 2, use meaningful pctile names

percentiles on a small sample count are suspect.
0th percentile is min, 50th is median, 100th is max.
sample count also lets you know which fio jobs
are contributing the most.

20 months agoMerge branch 'offload-serialize-overlap2' of https://github.com/vincentkfu/fio
Jens Axboe [Mon, 15 Oct 2018 20:09:18 +0000 (14:09 -0600)]
Merge branch 'offload-serialize-overlap2' of https://github.com/vincentkfu/fio

* 'offload-serialize-overlap2' of https://github.com/vincentkfu/fio:
  rate-submit: remove code that can never be executed
  docs: enable serialize_overlap with io_submit_mode=offload
  fio: enable overlap checking with offload submission
  init: loosen serialize_overlap restrictions

20 months agorate-submit: remove code that can never be executed
Vincent Fu [Mon, 15 Oct 2018 14:44:47 +0000 (10:44 -0400)]
rate-submit: remove code that can never be executed

The do-while loop above can only be exited when ret != FIO_Q_BUSY. So
the if (ret == FIO_Q_BUSY) branch will never be taken.

20 months agodocs: enable serialize_overlap with io_submit_mode=offload
Vincent Fu [Mon, 1 Oct 2018 18:42:28 +0000 (14:42 -0400)]
docs: enable serialize_overlap with io_submit_mode=offload

Note that it is now possible to enable overlap checking in offload
submission mode and that threads are required.

20 months agofio: enable overlap checking with offload submission
Vincent Fu [Mon, 1 Oct 2018 18:22:10 +0000 (14:22 -0400)]
fio: enable overlap checking with offload submission

Enable use of the serialize_overlap option with
io_submit_mode=offload. Threads with both of these options enabled will
check each other's in-flight IOs for overlap. If overlap is found,
submission of the new IO will be held back until the overlapping IO has
completed.

Threads must be used when fio is run in this mode because jobs need to
access each other's io_u's. io_u's are not allocated from the shared memory
area.

This fixes "fio serialize across jobs"
https://www.spinics.net/lists/fio/msg07133.html

Tested-by: Jeff Furlong <jeff.furlong@wdc.com>
20 months agoinit: loosen serialize_overlap restrictions
Vincent Fu [Thu, 11 Oct 2018 15:32:21 +0000 (11:32 -0400)]
init: loosen serialize_overlap restrictions

When io_submit_mode=offload, allow overlap checking including for jobs
where no data is being changed and when the iodepth is one. These cases
can occur when checking for overlap across different jobs.

20 months agooptions: kill 'use_os_rand'
Jens Axboe [Mon, 8 Oct 2018 19:43:23 +0000 (13:43 -0600)]
options: kill 'use_os_rand'

It's been deprecated for a very long time, it's time to just kill
it off.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
20 months agoRemove old OS dependent (unused) random code
Jens Axboe [Mon, 8 Oct 2018 19:36:43 +0000 (13:36 -0600)]
Remove old OS dependent (unused) random code

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoMerge branch 'patch-1' of https://github.com/joaomlneto/fio
Jens Axboe [Sat, 6 Oct 2018 01:11:19 +0000 (19:11 -0600)]
Merge branch 'patch-1' of https://github.com/joaomlneto/fio

* 'patch-1' of https://github.com/joaomlneto/fio:
  Be careful when defining `MPOL_LOCAL`

21 months agoBe careful when defining `MPOL_LOCAL`
João Neto [Fri, 5 Oct 2018 23:34:03 +0000 (00:34 +0100)]
Be careful when defining `MPOL_LOCAL`

`MPOL_LOCAL` will be defined in `numaif.h` in the future. Also, `MPOL_MAX` will be changed to match the kernel values.

21 months agoAdd cross-stripe intel sample verify job
Jens Axboe [Fri, 5 Oct 2018 15:08:58 +0000 (09:08 -0600)]
Add cross-stripe intel sample verify job

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoBool conversions
Jens Axboe [Thu, 4 Oct 2018 15:07:01 +0000 (09:07 -0600)]
Bool conversions

Just various low hanging fruits in terms of local or global
variables that are only 0/1, switch them to boolean.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoFio 3.11 fio-3.11
Jens Axboe [Wed, 3 Oct 2018 18:30:40 +0000 (12:30 -0600)]
Fio 3.11

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoiolog: fix leak for unsupported iolog version
Jens Axboe [Wed, 3 Oct 2018 18:29:46 +0000 (12:29 -0600)]
iolog: fix leak for unsupported iolog version

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoupdate replay_align and replay_scale documentation
Dennis Zhou [Wed, 3 Oct 2018 02:14:51 +0000 (22:14 -0400)]
update replay_align and replay_scale documentation

Options replay_align and replay_scale both happen after sector to byte
translation. This can cause the offset scaling to be unaligned. Make a
note that both options operate on the byte level and replay_align should
most likely be used when replay_scale is used.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoRevert "blktrace: support for non-512b sector sizes"
Dennis Zhou [Wed, 3 Oct 2018 02:14:50 +0000 (22:14 -0400)]
Revert "blktrace: support for non-512b sector sizes"

This reverts commit 26e616d054f238bf6b7ada351e17b72fdfbbb8e0.

An issue appeared when replaying blktraces using fio on non-512b sector
size devices where fio would report the following when replaying a trace
back on the same device.

  fio: io_u error on file /dev/sdb: No space left on device:

This turns out to be due to a match of how blktrace exports trace
information and how fio interprets it. The kernel considers all IO to be
relative to 512b sectors, so the sector offset is always in these units.
However, when replaying fio was adapting to the hardware sector. This
caused offset calculation issues resulting in the above error.

Reverting this keeps fio more in line with expectations, but will force
users who want to have fio run workloads be cognizant of aligning IO
properly when running on specific media to get expected performance.

Reported-by: Vernon Miller <vwm@fb.com>
Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoiolog: fix up some style issues
Jens Axboe [Wed, 3 Oct 2018 14:45:19 +0000 (08:45 -0600)]
iolog: fix up some style issues

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoengines/rados: use fio provided file names
Adam Kupczyk [Mon, 1 Oct 2018 10:48:54 +0000 (12:48 +0200)]
engines/rados: use fio provided file names

Use the regular fio generated names as names of objects to operate on.
This is necessary when using multiple, consecutive --read-iolog. Added
check if --pool parameter is set.

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoengines/cpu: fix potential overflow in thinktime calculation
Jens Axboe [Sun, 30 Sep 2018 14:41:40 +0000 (08:41 -0600)]
engines/cpu: fix potential overflow in thinktime calculation

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agofix hung fio process with large I/O sizes and verify= option
Jeff Moyer [Fri, 28 Sep 2018 21:27:58 +0000 (17:27 -0400)]
fix hung fio process with large I/O sizes and verify= option

Hi,

If you use a very large I/O size (1G in this instance), and also specify
the verify option, fio will hang, using up 100% cpu, for ever and ever.
The problem is that __fill_random_buf_percentage does math that
overflows the size of an unsigned int.  Fixing that gets fio to
terminate as expected.

Here is the job file which showed the problem:

[global]
ioengine=dev-dax
direct=0
filename=/dev/dax0.0
verify=crc32c
bs=1G
[write]
rw=write
runtime=5
[read]
stonewall
rw=read
runtime=5

Reported-by: sujith_pandel@dell.com
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agozbd: Avoid duplicating the code for calculating the number of sectors with data
Bart Van Assche [Fri, 28 Sep 2018 21:51:33 +0000 (14:51 -0700)]
zbd: Avoid duplicating the code for calculating the number of sectors with data

Introduce a new function process_swd() to avoid that almost identical code
occurs in check_swd() and zbd_file_reset(). Change the #if 0 / #endif pair
in check_swd() into if (false) to make sure that the compiler verifies the
syntactical correctness of that code.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agozbd: Restore zbd_check_swd()
Bart Van Assche [Fri, 28 Sep 2018 21:51:32 +0000 (14:51 -0700)]
zbd: Restore zbd_check_swd()

A recent patch removed the check_swd() function. Restore it since this function
is useful when debugging fio. Rename the function into zbd_check_swd(). Insert
the calls to these function where no locks are held to avoid triggering a
deadlock. See also commit d60be7d51cbb ("zbd: Remove unused function and
variable").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agot/zbd/test-zbd-support: Report a test summary when finished
Bart Van Assche [Fri, 28 Sep 2018 21:51:31 +0000 (14:51 -0700)]
t/zbd/test-zbd-support: Report a test summary when finished

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agot/zbd/test-zbd-support: Set fio aux path and forbid file creation
Bart Van Assche [Fri, 28 Sep 2018 21:51:30 +0000 (14:51 -0700)]
t/zbd/test-zbd-support: Set fio aux path and forbid file creation

Set the fio aux path to /tmp to avoid cluttering the directory from which the
test scripts are run. Disallow file creation to make tests fail if the block
device against which these are run does not exist.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agot/zbd/test-zbd-support: Ensure that an assertion failure causes this test to fail
Bart Van Assche [Fri, 28 Sep 2018 21:51:29 +0000 (14:51 -0700)]
t/zbd/test-zbd-support: Ensure that an assertion failure causes this test to fail

Switch to threaded mode to make sure that an assertion failure results in
a non-zero exit status.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agot/zbd/functions: Make fio_reset_count() return 0 if no resets occurred
Bart Van Assche [Fri, 28 Sep 2018 21:51:28 +0000 (14:51 -0700)]
t/zbd/functions: Make fio_reset_count() return 0 if no resets occurred

This patch avoids that certain bash versions report the following complaint:

t/zbd/test-zbd-support: line 69: [: : integer expression expected

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agozbd: Fix incorrect comments
Damien Le Moal [Fri, 28 Sep 2018 05:53:53 +0000 (14:53 +0900)]
zbd: Fix incorrect comments

Commit ee3696bdfd84 ("zbd: Use bytes unit") changed the zone info
structure zone start and zone wp location unit to bytes. Reflect this
change in the fio_zone_info structure comments.

Fixes: ee3696bdfd84 ("zbd: Use bytes unit")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agogettime: slightly improve CPU clock calibration
Jens Axboe [Thu, 27 Sep 2018 23:38:21 +0000 (17:38 -0600)]
gettime: slightly improve CPU clock calibration

We should not factor the utime_since() runtime into this, so
do the get_cpu_clock() before. In reality this probably won't
make any difference, as we're doing this tight loop for more
than a milisecond.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoserver: be locally vocal about communication issues
Jens Axboe [Thu, 27 Sep 2018 18:26:47 +0000 (12:26 -0600)]
server: be locally vocal about communication issues

If we fail the CRC check or if we have a mismatched client/server,
then we can't reliably transmit anything across the wire. For that
case, in addition to attempting to relay this information across
the wire, also print a local warning.

This fixes a case where we silently exit when the client/server
versions aren't properly matched.

Fixes: https://github.com/axboe/fio/issues/620
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Thu, 27 Sep 2018 15:42:21 +0000 (09:42 -0600)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  zbd: Fix zbd_zone_nr()

21 months agozbd: Fix zbd_zone_nr()
Bart Van Assche [Thu, 27 Sep 2018 15:12:19 +0000 (08:12 -0700)]
zbd: Fix zbd_zone_nr()

Instead of returning sizeof(struct fio_zone_info) * (zone number),
return the zone number.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
21 months agozbd: Remove unused function and variable
Damien Le Moal [Wed, 26 Sep 2018 06:42:26 +0000 (15:42 +0900)]
zbd: Remove unused function and variable

check_swd() was defined to nothing. Remove it.
additionally, the variable ret in zbd_reset_zonei() is unused and not
necessary. Remove it too.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoeta: Avoid adjustements to a negative value
Damien Le Moal [Wed, 26 Sep 2018 06:42:10 +0000 (15:42 +0900)]
eta: Avoid adjustements to a negative value

In the case of zonemode=strided job with both zone_size and zone_skip
specified, thread_eta() calculates the upper bound of the number of
zones that will be processed, including skipped bytes between zones
(zone_skip). Adjusting bytes_total (i.e. total_io_size) by substracting
this number of zones times the amount of skipped bytes can result in
a negative value for bytes_total (a large number of bytes) when for
example the job operates on an entire disk with a capacity that is not
divisible exactly by zone_size+zone_skip or if the options --size is
used to limit the I/O range. In such case, use the lower bound of the
number of zones to obtain a better approximation of the job eta.

Additionnally, if --io_size was specified, bytes_total will indicate
this exact value, so adjusting that value for zonemode != none is not
necessary.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoparse: fix negative FIO_OPT_INT too-large check
Jens Axboe [Wed, 26 Sep 2018 02:15:05 +0000 (20:15 -0600)]
parse: fix negative FIO_OPT_INT too-large check

If we have an option, like nice, that has a minval that is negative,
then we need to ensure we cast properly for the check.

Signed-off-by: Jens Axboe <axboe@kernel.dk>