From f44821730f05a62894304fd5001e0d9daaa78a88 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Fri, 13 Aug 2021 11:39:27 +0200 Subject: [PATCH] autotest: Skip use of any zoned nvme devices Our tests, especially those which use nvme block devices for various use-cases, won't be able to perform successful IO on such devices. The idea is to skip them for now and introduce basic, dedicated, tests for zoned nvmes in oncoming patches. Signed-off-by: Michal Berger Change-Id: I67baad5c85c662921e3327f2101180283c89e96c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9181 Reviewed-by: Tomasz Zawadzki Reviewed-by: Karol Latecki Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- autotest.sh | 13 +++++++++++++ test/bdev/blockdev.sh | 2 ++ test/common/autotest_common.sh | 18 ++++++++++++++++++ test/ftl/common.sh | 3 +++ test/setup/acl.sh | 5 ++++- test/setup/devices.sh | 3 +++ 6 files changed, 43 insertions(+), 1 deletion(-) diff --git a/autotest.sh b/autotest.sh index 503f3b81e..b559bdd2d 100755 --- a/autotest.sh +++ b/autotest.sh @@ -87,10 +87,22 @@ rm -f /var/tmp/spdk*.sock # Load the kernel driver ./scripts/setup.sh reset +get_zoned_devs + +if ((${#zoned_devs[@]} > 0)); then + # FIXME: For now make sure zoned devices are tested on-demand by + # a designated tests instead of falling into any other. The main + # concern here are fio workloads where specific configuration + # must be in place for it to work with the zoned device. + export PCI_BLOCKED="${zoned_devs[*]}" +fi + # Delete all leftover lvols and gpt partitions # Matches both /dev/nvmeXnY on Linux and /dev/nvmeXnsY on BSD # Filter out nvme with partitions - the "p*" suffix for dev in $(ls /dev/nvme*n* | grep -v p || true); do + # Skip zoned devices as non-sequential IO will always fail + [[ -z ${zoned_devs["${dev##*/}"]} ]] || continue if ! block_in_use "$dev"; then dd if=/dev/zero of="$dev" bs=1M count=1 fi @@ -194,6 +206,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then if [[ $SPDK_TEST_NVME_CMB -eq 1 ]]; then run_test "nvme_cmb" test/nvme/cmb/cmb.sh fi + run_test "nvme_rpc" test/nvme/nvme_rpc.sh # Only test hotplug without ASAN enabled. Since if it is # enabled, it catches SEGV earlier than our handler which diff --git a/test/bdev/blockdev.sh b/test/bdev/blockdev.sh index a48923a55..cfdd03db6 100755 --- a/test/bdev/blockdev.sh +++ b/test/bdev/blockdev.sh @@ -63,11 +63,13 @@ function setup_nvme_conf() { function setup_gpt_conf() { $rootdir/scripts/setup.sh reset + get_zoned_devs # Get nvme devices by following drivers' links towards nvme class local nvme_devs=(/sys/bus/pci/drivers/nvme/*/nvme/nvme*/nvme*n*) nvme_dev gpt_nvme="" # Pick first device which doesn't have any valid partition table for nvme_dev in "${nvme_devs[@]}"; do + [[ -z ${zoned_devs["${nvme_dev##*/}"]} ]] || continue dev=/dev/${nvme_dev##*/} if ! pt=$(parted "$dev" -ms print 2>&1); then [[ $pt == *"$dev: unrecognised disk label"* ]] || continue diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 643bdc9fd..3dab6e0ce 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -1462,6 +1462,24 @@ function reap_spdk_processes() { return 1 } +function is_block_zoned() { + local device=$1 + + [[ -e /sys/block/$device/queue/zoned ]] || return 1 + [[ $(< "/sys/block/$device/queue/zoned") != none ]] +} + +function get_zoned_devs() { + local -gA zoned_devs=() + local nvme bdf + + for nvme in /sys/block/nvme*; do + if is_block_zoned "${nvme##*/}"; then + zoned_devs["${nvme##*/}"]=$(< "$nvme/device/address") + fi + done +} + # Define temp storage for all the tests. Look for 2GB at minimum set_test_storage "${TEST_MIN_STORAGE_SIZE:-$((1 << 31))}" diff --git a/test/ftl/common.sh b/test/ftl/common.sh index 9709f84c4..7128dd859 100644 --- a/test/ftl/common.sh +++ b/test/ftl/common.sh @@ -41,6 +41,9 @@ get_ftl_nvme_dev() { for nvme in $(nvme_in_userspace); do identify=$("$SPDK_EXAMPLE_DIR/identify" -r trtype:pcie -r "traddr:$nvme") + # TODO: Skip zoned nvme devices - such setup for FTL is currently not + # supported. See https://github.com/spdk/spdk/issues/1992 for details. + [[ $identity =~ "NVMe ZNS Zone Report" ]] && continue [[ $identify =~ "Current LBA Format:"\ +"LBA Format #"([0-9]+) ]] [[ $identify =~ "LBA Format #${BASH_REMATCH[1]}: Data Size:"\ +([0-9]+) ]] lba=${BASH_REMATCH[1]} diff --git a/test/setup/acl.sh b/test/setup/acl.sh index 6f15d9189..0a9549a05 100755 --- a/test/setup/acl.sh +++ b/test/setup/acl.sh @@ -3,6 +3,8 @@ testdir=$(readlink -f "$(dirname "$0")") rootdir=$(readlink -f "$testdir/../../") source "$testdir/common.sh" +get_zoned_devs + declare -a devs=() declare -A drivers=() @@ -12,6 +14,7 @@ collect_setup_devs() { while read -r _ dev _ _ _ driver _; do [[ $dev == *:*:*.* ]] || continue [[ $driver == nvme ]] || continue + [[ ${zoned_devs[*]} == *"$dev"* ]] && continue devs+=("$dev") drivers["$dev"]=$driver done < <(setup output status) ((${#devs[@]} > 0)) @@ -28,7 +31,7 @@ verify() { } denied() { - PCI_BLOCKED="${devs[0]}" setup output config \ + PCI_BLOCKED="$PCI_BLOCKED ${devs[0]}" setup output config \ | grep "Skipping denied controller at ${devs[0]}" verify "${devs[0]}" setup reset diff --git a/test/setup/devices.sh b/test/setup/devices.sh index 861437835..2ec5c8e7f 100755 --- a/test/setup/devices.sh +++ b/test/setup/devices.sh @@ -168,6 +168,8 @@ trap "cleanup" EXIT setup reset +get_zoned_devs + declare -a blocks=() declare -A blocks_to_pci=() min_disk_size=$((1024 ** 3 * 2)) # 2GB @@ -175,6 +177,7 @@ min_disk_size=$((1024 ** 3 * 2)) # 2GB for block in "/sys/block/nvme"*; do pci=$(readlink -f "$block/device/device") pci=${pci##*/} + [[ ${zoned_devs[*]} == *"$pci"* ]] && continue if ! block_in_use "${block##*/}" && (($(sec_size_to_bytes "${block##*/}") >= min_disk_size)); then blocks+=("${block##*/}") blocks_to_pci["${block##*/}"]=$pci