From 914b1d15aec9892602550242a4828388399bdc66 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 14 Jul 2017 16:31:43 -0700 Subject: [PATCH] bdev: Add new tests using the fio plugin Change-Id: I90edce0d9aac7be12ce8ba346aa6e16f67628b0e Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/369677 Reviewed-by: Daniel Verkamp Tested-by: SPDK Automated Test System --- scripts/autotest_common.sh | 54 ++++++++++++++++++++++++++++++++++++++ test/lib/bdev/bdev.conf.in | 11 +++----- test/lib/bdev/blockdev.sh | 42 +++++++++++++++++++---------- 3 files changed, 86 insertions(+), 21 deletions(-) diff --git a/scripts/autotest_common.sh b/scripts/autotest_common.sh index a4b798526..4fb61707e 100755 --- a/scripts/autotest_common.sh +++ b/scripts/autotest_common.sh @@ -379,5 +379,59 @@ function discover_bdevs() rm -f /var/run/spdk_bdev0 } +function fio_config_gen() +{ + local config_file=$1 + local workload=$2 + + if [ -e "$config_file" ]; then + echo "Configuration File Already Exists!: $config_file" + return -1 + fi + + if [ -z "$workload" ]; then + workload=randrw + fi + + touch $1 + + cat > $1 << EOL +[global] +thread=1 +group_reporting=1 +direct=1 +norandommap=1 +percentile_list=50:99:99.9:99.99:99.999 +time_based=1 +ramp_time=0 +EOL + + if [ "$workload" == "verify" ]; then + echo "verify=sha1" >> $config_file + echo "rw=randwrite" >> $config_file + else + echo "rw=$workload" >> $config_file + fi +} + +function fio_config_add_job() +{ + config_file=$1 + filename=$2 + + if [ ! -e "$config_file" ]; then + echo "Configuration File Doesn't Exist: $config_file" + return -1 + fi + + if [ -z "$filename" ]; then + echo "No filename provided" + return -1 + fi + + echo "[job_$filename]" >> $config_file + echo "filename=$filename" >> $config_file +} + set -o errtrace trap "trap - ERR; print_backtrace >&2" ERR diff --git a/test/lib/bdev/bdev.conf.in b/test/lib/bdev/bdev.conf.in index 169bc96a1..278d0e642 100644 --- a/test/lib/bdev/bdev.conf.in +++ b/test/lib/bdev/bdev.conf.in @@ -1,17 +1,14 @@ -# autotest.sh will automatically rmmod ioatdma, so we do -# not need to specify Whitelist -# entries to enable ioat offload for this malloc LUN [Malloc] - NumberOfLuns 5 - LunSizeInMB 32 + NumberOfLuns 3 + LunSizeInMB 64 [Split] # Split Malloc1 into two auto-sized halves Split Malloc1 2 - # Split Malloc2 into eight 1-megabyte pieces, + # Split Malloc2 into eight 4-megabyte pieces, # leaving the rest of the device inaccessible - Split Malloc2 8 1 + Split Malloc2 8 4 [AIO] AIO /dev/ram0 AIO0 diff --git a/test/lib/bdev/blockdev.sh b/test/lib/bdev/blockdev.sh index 48e8d1e8a..c24d80c72 100755 --- a/test/lib/bdev/blockdev.sh +++ b/test/lib/bdev/blockdev.sh @@ -4,11 +4,11 @@ set -e testdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $testdir/../../..) +plugindir=$rootdir/examples/bdev/fio_plugin + source $rootdir/scripts/autotest_common.sh -testdir=$(readlink -f $(dirname $0)) - -timing_enter blockdev +timing_enter bdev cp $testdir/bdev.conf.in $testdir/bdev.conf $rootdir/scripts/gen_nvme.sh >> $testdir/bdev.conf @@ -17,25 +17,39 @@ timing_enter bounds $testdir/bdevio/bdevio $testdir/bdev.conf timing_exit bounds +timing_enter nbd if grep -q Nvme0 $testdir/bdev.conf; then part_dev_by_gpt $testdir/bdev.conf Nvme0n1 $rootdir fi +timing_exit nbd timing_enter bdev_svc -bdevs=$(discover_bdevs $rootdir $testdir/bdev.conf | jq -r '.[] | select(.bdev_opened_for_write == false) | .name') +bdevs=$(discover_bdevs $rootdir $testdir/bdev.conf | jq -r '.[] | select(.bdev_opened_for_write == false)') timing_exit bdev_svc -timing_enter verify -$testdir/bdevperf/bdevperf -c $testdir/bdev.conf -q 32 -s 4096 -w verify -t 1 -timing_exit verify +if [ -d /usr/src/fio ] && [ $SPDK_RUN_ASAN -eq 0 ]; then + timing_enter fio + + # Generate the fio config file given the list of all unclaimed bdevs + fio_config_gen $testdir/bdev.fio verify + for b in $(echo $bdevs | jq -r '.name'); do + fio_config_add_job $testdir/bdev.fio $b + done + + if [ $RUN_NIGHTLY -eq 0 ]; then + LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio --ioengine=spdk_bdev --spdk_conf=./test/lib/bdev/bdev.conf --iodepth=8 --bs=4k --runtime=10 $testdir/bdev.fio + else + # Use size 192KB which both exceeds typical 128KB max NVMe I/O + # size and will cross 128KB Intel DC P3700 stripe boundaries. + LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio --ioengine=spdk_bdev --spdk_conf=./test/lib/bdev/bdev.conf --iodepth=128 --bs=192k --runtime=100 $testdir/bdev.fio + fi + + rm -f *.state + rm -f $testdir/bdev.fio + timing_exit fio +fi if [ $RUN_NIGHTLY -eq 1 ]; then - # Use size 192KB which both exceeds typical 128KB max NVMe I/O - # size and will cross 128KB Intel DC P3700 stripe boundaries. - timing_enter perf - $testdir/bdevperf/bdevperf -c $testdir/bdev.conf -q 128 -w read -s 196608 -t 5 - timing_exit perf - # Temporarily disabled - infinite loop #timing_enter reset #$testdir/bdevperf/bdevperf -c $testdir/bdev.conf -q 16 -w reset -s 4096 -t 60 @@ -47,4 +61,4 @@ if [ $RUN_NIGHTLY -eq 1 ]; then fi rm -f $testdir/bdev.conf -timing_exit blockdev +timing_exit bdev