Commit 0231fdc7 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

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: default avatarMichal Berger <michalx.berger@intel.com>
Change-Id: I67baad5c85c662921e3327f2101180283c89e96c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9181


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent ea71df4f
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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
+18 −0
Original line number Diff line number Diff line
@@ -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))}"

+3 −0
Original line number Diff line number Diff line
@@ -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]}
+4 −1
Original line number Diff line number Diff line
@@ -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
Loading