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 <michalx.berger@intel.com>
Change-Id: I67baad5c85c662921e3327f2101180283c89e96c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9181
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Michal Berger 2021-08-13 11:39:27 +02:00 committed by Tomasz Zawadzki
parent ea71df4f48
commit 0231fdc770
6 changed files with 43 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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))}"

View File

@ -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]}

View File

@ -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

View File

@ -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