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

test/ftl: Use emulated zoned devices instead of ocssd



Support for Open-Channel SSDs is dying out (already marked as
deprecated in linux kernel, scheduled for complete removal in 5.15)
hence we should slowly adjust our test suites and move towards more
standardized zoned nvmes.

Signed-off-by: default avatarMichal Berger <michalx.berger@intel.com>
Change-Id: I038b6361a78b27c2b350ccf594d201ffe92794e3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8295


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@gmail.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
parent 13905aa3
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ source $testdir/common.sh
tests=('-q 1 -w randwrite -t 4 -o 69632' '-q 128 -w randwrite -t 4 -o 4096' '-q 128 -w verify -t 4 -o 4096')
device=$1
use_append=$2
rpc_py=$rootdir/scripts/rpc.py

for ((i = 0; i < ${#tests[@]}; i++)); do
	timing_enter "${tests[$i]}"
@@ -18,12 +17,12 @@ for ((i = 0; i < ${#tests[@]}; i++)); do
	trap 'killprocess $bdevperf_pid; exit 1' SIGINT SIGTERM EXIT
	waitforlisten $bdevperf_pid
	$rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie
	$rpc_py bdev_ocssd_create -c nvme0 -b nvme0n1
	$rpc_py bdev_ftl_create -b ftl0 -d nvme0n1 $use_append
	bdev_create_zone nvme0n1
	$rpc_py bdev_ftl_create -b ftl0 -d "$ZONE_DEV" $use_append

	$rootdir/test/bdev/bdevperf/bdevperf.py perform_tests
	$rpc_py delete_ftl_bdev -b ftl0
	$rpc_py bdev_ocssd_delete nvme0n1
	$rpc_py bdev_ftl_delete -b ftl0
	bdev_delete_zone "$ZONE_DEV"
	$rpc_py bdev_nvme_detach_controller nvme0
	killprocess $bdevperf_pid
	trap - SIGINT SIGTERM EXIT
+43 −0
Original line number Diff line number Diff line
@@ -34,3 +34,46 @@ function gen_ftl_nvme_conf() {
		}
	JSON
}

get_ftl_nvme_dev() {
	# Find device with LBA matching the FTL_BLOCK_SIZE
	local nvmes nvme identify lba

	for nvme in $(nvme_in_userspace); do
		identify=$("$SPDK_EXAMPLE_DIR/identify" -r trtype:pcie -r "traddr:$nvme")
		[[ $identify =~ "Current LBA Format:"\ +"LBA Format #"([0-9]+) ]]
		[[ $identify =~ "LBA Format #${BASH_REMATCH[1]}: Data Size:"\ +([0-9]+) ]]
		lba=${BASH_REMATCH[1]}
		((lba && lba % FTL_BLOCK_SIZE == 0)) && nvmes+=("$nvme")
	done
	((${#nvmes[@]} > 0)) || return 1
	printf '%s\n' "${nvmes[@]}"
}

bdev_create_zone() {
	local base_bdev=$1

	# TODO: Consider use of ZNSed nvme controllers
	"$rpc_py" bdev_zone_block_create \
		-b "$ZONE_DEV" \
		-o "$OPTIMAL_OPEN_ZONES" \
		-z "$ZONE_CAPACITY" \
		-n "$base_bdev"
}

bdev_delete_zone() {
	local zone_dev=$1

	# TODO: Consider use of ZNSed nvme controllers
	"$rpc_py" bdev_zone_block_delete "$zone_dev"
}

# Optimal number of zones refers to the number of zones that need to be written at the same
# time in order to maximize drive's write bandwidth.
# ZONE_CAPACITY * FTL_BLOCK_SIZE * OPTIMAL_OPEN_ZONES should be <= size of the drive.
FTL_BLOCK_SIZE=4096
ZONE_CAPACITY=4096
OPTIMAL_OPEN_ZONES=32
ZONE_DEV=zone0

rpc_py=$rootdir/scripts/rpc.py
+2 −4
Original line number Diff line number Diff line
@@ -5,8 +5,6 @@ rootdir=$(readlink -f $testdir/../..)
source $rootdir/test/common/autotest_common.sh
source $testdir/common.sh

rpc_py=$rootdir/scripts/rpc.py

device=$1

restore_kill() {
@@ -34,8 +32,8 @@ svcpid=$!
waitforlisten $svcpid

$rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie
$rpc_py bdev_ocssd_create -c nvme0 -b nvme0n1 -n 1
ftl_construct_args="bdev_ftl_create -b ftl0 -d nvme0n1 -o"
bdev_create_zone nvme0n1
ftl_construct_args="bdev_ftl_create -b ftl0 -d $ZONE_DEV -o"

$rpc_py $ftl_construct_args

+2 −2
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ svcpid=$!
waitforlisten $svcpid

$rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie
$rpc_py bdev_ocssd_create -c nvme0 -b nvme0n1
$rpc_py bdev_ftl_create -b ftl0 -d nvme0n1
bdev_create_zone nvme0n1
$rpc_py bdev_ftl_create -b ftl0 -d "$ZONE_DEV"

waitforbdev ftl0

+1 −24
Original line number Diff line number Diff line
@@ -5,30 +5,7 @@ rootdir=$(readlink -f $testdir/../..)
source $rootdir/test/common/autotest_common.sh
source $testdir/common.sh

# The FTL tests are currently disabled, pending conversion to ZNS from OCSSD.
exit 0

function at_ftl_exit() {
	# restore original driver
	PCI_ALLOWED="$device" PCI_BLOCKED="" DRIVER_OVERRIDE="$ocssd_original_dirver" $rootdir/scripts/setup.sh
}

read -r device _ <<< "$OCSSD_PCI_DEVICES"

if [[ -z "$device" ]]; then
	echo "OCSSD device list is empty."
	echo "This test require that OCSSD_PCI_DEVICES environment variable to be set"
	echo "and point to OCSSD devices PCI BDF. You can specify multiple space"
	echo "separated BDFs in this case first one will be used."
	exit 1
fi

ocssd_original_dirver="$(basename $(readlink /sys/bus/pci/devices/$device/driver))"

trap 'at_ftl_exit' SIGINT SIGTERM EXIT

# OCSSD is blocked so bind it to vfio/uio driver before testing
PCI_ALLOWED="$device" PCI_BLOCKED="" DRIVER_OVERRIDE="" $rootdir/scripts/setup.sh
devices=($(get_ftl_nvme_dev)) device=${devices[0]}

run_test "ftl_bdevperf" $testdir/bdevperf.sh $device
run_test "ftl_bdevperf_append" $testdir/bdevperf.sh $device --use_append
Loading