fio.git
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>
20 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>
20 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>
20 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.

21 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>
21 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>
21 months agoparse: fix minval checking
Jens Axboe [Wed, 26 Sep 2018 01:44:35 +0000 (19:44 -0600)]
parse: fix minval checking

For values that allow negative min values, don't cast to an uint.

Fixes: 5d2788d5b798 ("parse: fix min/max val checking for FIO_OPT_INT")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoAdd regression test for flow/negative option parser breakage
Jens Axboe [Wed, 26 Sep 2018 01:40:59 +0000 (19:40 -0600)]
Add regression test for flow/negative option parser breakage

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoparse: fix min/max val checking for FIO_OPT_INT
Jens Axboe [Wed, 26 Sep 2018 01:24:36 +0000 (19:24 -0600)]
parse: fix min/max val checking for FIO_OPT_INT

We compare an unsigned long long to an int max/min value, this
is going to break for negative numbers, for instance.

Fixes a case where flow=-1 doesn't work properly because of that.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoparse: print option name for out-of-range settings
Jens Axboe [Wed, 26 Sep 2018 01:14:22 +0000 (19:14 -0600)]
parse: print option name for out-of-range settings

Right now we just say we're out of range:

max value out of range: 18446744073709551612 (4294967295 max)

but we don't actually say which option this is. Add that.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoiolog: Fix problem with setup() not invoked when read_iolog is used.
Adam Kupczyk [Mon, 24 Sep 2018 11:29:39 +0000 (13:29 +0200)]
iolog: Fix problem with setup() not invoked when read_iolog is used.

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
21 months agostat: print the right percentile variant for json output
Jens Axboe [Sat, 22 Sep 2018 21:02:04 +0000 (15:02 -0600)]
stat: print the right percentile variant for json output

We always show the clat percentiles for the json output, regardless
of whether lat_percentiles or clat_percentiles was defined in the
job. Correct that so we show the right output depending on the
job setting.

Fixes: https://github.com/axboe/fio/issues/691
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoMerge branch 'steadystate-doc' of https://github.com/vincentkfu/fio
Jens Axboe [Fri, 21 Sep 2018 15:50:07 +0000 (09:50 -0600)]
Merge branch 'steadystate-doc' of https://github.com/vincentkfu/fio

* 'steadystate-doc' of https://github.com/vincentkfu/fio:
  docs: clarify usage of steadystate detection feature

21 months agodocs: clarify usage of steadystate detection feature
Vincent Fu [Fri, 21 Sep 2018 15:37:17 +0000 (11:37 -0400)]
docs: clarify usage of steadystate detection feature

Note that most intended uses of the steadystate detection feature
likely also need the --time_based and --runtime options or the
--loops option so that fio does not stop running after accessing
the full size of the device(s) or file(s).

21 months agoengines/http: work-around crash in certain libssl versions
Jens Axboe [Fri, 21 Sep 2018 15:17:38 +0000 (09:17 -0600)]
engines/http: work-around crash in certain libssl versions

Fixes: https://github.com/axboe/fio/issues/684
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoblktrace: fix leak of 'merge_buf'
Jens Axboe [Thu, 20 Sep 2018 20:25:56 +0000 (14:25 -0600)]
blktrace: fix leak of 'merge_buf'

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoblktrace: provide empty merge_blktrace_iologs()
Jens Axboe [Thu, 20 Sep 2018 19:14:11 +0000 (13:14 -0600)]
blktrace: provide empty merge_blktrace_iologs()

For platforms that don't suppor blktrace, we need an empty
helper that just fails it.

Fixes: b9921d1a56d9 ("blktrace: add support to interleave blktrace files")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoblktrace: add option to iterate over a trace multiple times
Dennis Zhou [Thu, 20 Sep 2018 18:08:10 +0000 (14:08 -0400)]
blktrace: add option to iterate over a trace multiple times

Scaling a particular trace may result in different runtimes among the
merging traces. By knowing the approximate length of each trace as a
user, the overall runtime of each can be tuned to line up by letting
certain traces loop multiple times.

First, the last timestamp of a trace is recorded at the end of the first
iteration to denote the length of a trace. This value is then used to
offset subsequent iterations of a trace.

Next, the "--merge_blktrace_iters" option is introduced to let the user
specify the number of times to loop over each specific trace. This is
done by passing a comma separated list that index-wise pairs with the
passed files in "--read_iolog". Iteration counts are introduced as well
as keeping track of the length of each trace.

In an example, given two traces, A and B, each 60s long. If we want to
see the impact of trace A issuing IOs twice as fast, the
--merge_blktrace_scalars="50:100" can be set and then
--merge_blktrace_iters="2:1". This runs trace A at 2x the speed twice for
approximately the same runtime as a single run of trace B.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoblktrace: add option to scale a trace
Dennis Zhou [Thu, 20 Sep 2018 18:08:09 +0000 (14:08 -0400)]
blktrace: add option to scale a trace

As we explore stacking traces, it is nice to be able to scale a trace to
understand how the traces end up interacting.

This patch adds scaling by letting the user pass in percentages to scale
a trace by. When passed '--merge_blktrace_scalars="100"', the trace is
ran at 100% speed. If passed 50%, this will halve the trace timestamps.
The new option takes in a comma separated list that index-wise pairs
with the passed files in "--read_iolog".

This option differs from "--replay_time_scale" which scales the trace
during runtime and will not change the output unlike this option.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoblktrace: add support to interleave blktrace files
Dennis Zhou [Thu, 20 Sep 2018 18:08:08 +0000 (14:08 -0400)]
blktrace: add support to interleave blktrace files

Running concurrent workloads via multiple jobs can lead to
nondeterministic results as we are at the scheduler's mercy. While the
actual performance of the workload may vary regardless, this makes the
order of events consistent.

This patch introduces two flags: --merge_blktrace_file=<file> and
--merge-blktrace-only. When the first is specified, files that are ':'
separated in --read_iolog are passed to a merge function wich then
produces a single sorted trace file. This file is then passed on in
place of the sorted list or fio exists if --merge-blktrace-only is
specified.

During merging, events are filtered based on what fio cares about and
the pdu is discarded as well.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agooptions: rename name string operations for more general use
Dennis Zhou [Thu, 20 Sep 2018 18:08:07 +0000 (14:08 -0400)]
options: rename name string operations for more general use

get_next_name() and get_max_str_idx() are helpers that iterate and split
a string separated by ':'. s/name/str/g to make this more generic which
will be used to parse file paths for blktraces to merge.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoMerge branch 'epoch-time-hist-logs' of https://github.com/parallel-fs-utils/fio
Jens Axboe [Wed, 19 Sep 2018 15:42:47 +0000 (09:42 -0600)]
Merge branch 'epoch-time-hist-logs' of https://github.com/parallel-fs-utils/fio

* 'epoch-time-hist-logs' of https://github.com/parallel-fs-utils/fio:
  raise exception if test start time can't be estimated
  handle log_unix_epoch=1

21 months agofilesetup: use 64-bit type for file size generation
Jens Axboe [Mon, 17 Sep 2018 19:46:51 +0000 (13:46 -0600)]
filesetup: use 64-bit type for file size generation

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoRandom distribution 32-bit fixes
Jens Axboe [Mon, 17 Sep 2018 17:00:50 +0000 (11:00 -0600)]
Random distribution 32-bit fixes

We calculate and use nranges as an unsigned long, but that can
be 32-bit on some platforms and hence overflow.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agozbd: fix various 32-bit compilation warnings
Jens Axboe [Mon, 17 Sep 2018 14:39:22 +0000 (08:39 -0600)]
zbd: fix various 32-bit compilation warnings

Just dprint() string types.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoaxmap: isset_fn() should use 1ULL, not 1UL
Jens Axboe [Mon, 17 Sep 2018 03:58:26 +0000 (21:58 -0600)]
axmap: isset_fn() should use 1ULL, not 1UL

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agot/axmap: use a 64-bit type (not size_t) for axmap tests
Jens Axboe [Mon, 17 Sep 2018 03:55:45 +0000 (21:55 -0600)]
t/axmap: use a 64-bit type (not size_t) for axmap tests

Now we actually pass on 32-bit...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agolfsr: use unsigned long long for 64-bit values
Jens Axboe [Mon, 17 Sep 2018 03:52:22 +0000 (21:52 -0600)]
lfsr: use unsigned long long for 64-bit values

1UL is bit 64-bit on Windows builds.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoaxmap: use 64-bit index for the handlers
Jens Axboe [Mon, 17 Sep 2018 03:43:56 +0000 (21:43 -0600)]
axmap: use 64-bit index for the handlers

Most important one here is axmap_handler_topdown(), in which the
first iteration could end up truncating the index calculation.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoaxmap: use 64-bit type for number of bits
Jens Axboe [Mon, 17 Sep 2018 03:30:39 +0000 (21:30 -0600)]
axmap: use 64-bit type for number of bits

For huge devices, we can overflow on a 32-bit build of fio.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
21 months agoMerge branch 'windows_static' of https://github.com/sitsofe/fio
Jens Axboe [Sun, 16 Sep 2018 16:13:23 +0000 (10:13 -0600)]
Merge branch 'windows_static' of https://github.com/sitsofe/fio

* 'windows_static' of https://github.com/sitsofe/fio:
  build: change where we set -static for Windows

21 months agobuild: change where we set -static for Windows
Sitsofe Wheeler [Sat, 15 Sep 2018 05:58:33 +0000 (06:58 +0100)]
build: change where we set -static for Windows

The Makefile forced static Windows builds by adding -static to the
CFLAGS but this is long after the configure tests had run. This could
lead to problems (such as https://github.com/axboe/fio/issues/683 "Fio
fails to link libcurl on windows (undefined references to
__imp_curl_easy_cleanup)") where the availability of a dynamic version
of library causes a feature to be enabled but when it comes to final
linking time we find that there's no static version of the library
available and fall over.

Fix the above by asking for a static build via the "Forcing some known
good options on Windows" section of the configure file which occurs
prior to configure tests. This also means configure will correctly
display that we are doing a static build.

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

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>