NVMe driver poll mode

Note that, current Linux kernel’s blk_poll doesn’t support async IO.
So for fio, you can’t use libaio engine to test poll mode.
I use psync in blow tests.

You also need to revert below commit and rebuild kernel to test it.
Otherwise, you’ll need to modify fio code.

mlin@ssi:~/linux$ git show c43c83a294e8dc25072ca9e6fca4cdbc5564f3d4
commit c43c83a294e8dc25072ca9e6fca4cdbc5564f3d4
Author: Christoph Hellwig <hch@lst.de>
Date: Thu Mar 3 16:04:02 2016 +0100

direct-io: only use block polling if explicitly requested

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Stephen Bates <stephen.bates@pmcs.com>
Tested-by: Stephen Bates <stephen.bates@pmcs.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

===================
My test results:

poll mode enabled:
lat (usec): min=16, max=85, avg=19.65, stdev= 1.11

disabled:
lat (usec): min=18, max=67, avg=22.21, stdev= 1.08

root@target:~# grep . /sys/block/nvme0n1/mq/*/io_poll
/sys/block/nvme0n1/mq/0/io_poll:invoked=382092120, success=546330
/sys/block/nvme0n1/mq/1/io_poll:invoked=14736531, success=30177
/sys/block/nvme0n1/mq/2/io_poll:invoked=256434558, success=503203
/sys/block/nvme0n1/mq/3/io_poll:invoked=318064773, success=508663
/sys/block/nvme0n1/mq/4/io_poll:invoked=1694677560, success=1129213
/sys/block/nvme0n1/mq/5/io_poll:invoked=164542953, success=275110
/sys/block/nvme0n1/mq/6/io_poll:invoked=128142476, success=240194
/sys/block/nvme0n1/mq/7/io_poll:invoked=0, success=0

root@target:~# cat t.job
[global]
ioengine=psync
direct=1
runtime=10
time_based
norandommap
group_reporting

[job1]
filename=/dev/nvme0n1
rw=randread
bs=4k
iodepth=1
numjobs=1
root@target:~# echo 1 > /sys/block/nvme0n1/queue/io_poll
root@target:~# fio t.job
job1: (g=0): rw=randread, bs=4K-4K/4K-4K/4K-4K, ioengine=psync, iodepth=1
fio-2.8-26-g603e
Starting 1 process
Jobs: 1 (f=1): [r(1)] [100.0% done] [194.8MB/0KB/0KB /s] [49.9K/0/0 iops] [eta 00m:00s]
job1: (groupid=0, jobs=1): err= 0: pid=2130: Wed Jun 8 14:34:02 2016
read : io=1943.1MB, bw=199063KB/s, iops=49765, runt= 10000msec
clat (usec): min=16, max=84, avg=19.59, stdev= 1.11
lat (usec): min=16, max=85, avg=19.65, stdev= 1.11
clat percentiles (usec):
| 1.00th=[ 18], 5.00th=[ 18], 10.00th=[ 18], 20.00th=[ 19],
| 30.00th=[ 19], 40.00th=[ 19], 50.00th=[ 20], 60.00th=[ 20],
| 70.00th=[ 20], 80.00th=[ 20], 90.00th=[ 21], 95.00th=[ 21],
| 99.00th=[ 22], 99.50th=[ 23], 99.90th=[ 24], 99.95th=[ 26],
| 99.99th=[ 31]
bw (KB /s): min=191520, max=200360, per=99.99%, avg=199034.95, stdev=1854.33
lat (usec) : 20=48.20%, 50=51.80%, 100=0.01%
cpu : usr=3.36%, sys=96.56%, ctx=33, majf=0, minf=10
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 : total=r=497658/w=0/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0
latency : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
READ: io=1943.1MB, aggrb=199063KB/s, minb=199063KB/s, maxb=199063KB/s, mint=10000msec, maxt=10000msec

Disk stats (read/write):
nvme0n1: ios=492410/0, merge=0/0, ticks=8744/0, in_queue=8708, util=87.18%
root@target:~# echo 0 > /sys/block/nvme0n1/queue/io_poll
root@target:~# fio t.job
job1: (g=0): rw=randread, bs=4K-4K/4K-4K/4K-4K, ioengine=psync, iodepth=1
fio-2.8-26-g603e
Starting 1 process
Jobs: 1 (f=1): [r(1)] [100.0% done] [171.6MB/0KB/0KB /s] [43.1K/0/0 iops] [eta 00m:00s]
job1: (groupid=0, jobs=1): err= 0: pid=2141: Wed Jun 8 14:34:44 2016
read : io=1709.1MB, bw=175078KB/s, iops=43769, runt= 10001msec
clat (usec): min=18, max=66, avg=22.12, stdev= 1.07
lat (usec): min=18, max=67, avg=22.21, stdev= 1.08
clat percentiles (usec):
| 1.00th=[ 20], 5.00th=[ 21], 10.00th=[ 21], 20.00th=[ 21],
| 30.00th=[ 22], 40.00th=[ 22], 50.00th=[ 22], 60.00th=[ 22],
| 70.00th=[ 23], 80.00th=[ 23], 90.00th=[ 23], 95.00th=[ 24],
| 99.00th=[ 25], 99.50th=[ 25], 99.90th=[ 29], 99.95th=[ 30],
| 99.99th=[ 44]
bw (KB /s): min=169808, max=175784, per=99.99%, avg=175066.11, stdev=1297.33
lat (usec) : 20=0.18%, 50=99.81%, 100=0.01%
cpu : usr=10.24%, sys=7.48%, ctx=437745, majf=0, minf=11
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 : total=r=437740/w=0/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0
latency : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
READ: io=1709.1MB, aggrb=175078KB/s, minb=175078KB/s, maxb=175078KB/s, mint=10001msec, maxt=10001msec

Disk stats (read/write):
nvme0n1: ios=433278/0, merge=0/0, ticks=8172/0, in_queu

Leave a Reply