test/nvme/zns: Add simple fio test for zoned nvme devices
Signed-off-by: Michal Berger <michalx.berger@intel.com> Change-Id: I2ecad040bcaa573ace5ea2adfb1c0735d8388ce2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9182 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
0231fdc770
commit
d2fe6d7d96
@ -95,6 +95,7 @@ if ((${#zoned_devs[@]} > 0)); then
|
||||
# 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[*]}"
|
||||
export PCI_ZONED="${zoned_devs[*]}"
|
||||
fi
|
||||
|
||||
# Delete all leftover lvols and gpt partitions
|
||||
@ -207,6 +208,10 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
|
||||
run_test "nvme_cmb" test/nvme/cmb/cmb.sh
|
||||
fi
|
||||
|
||||
if [[ $SPDK_TEST_NVME_ZNS -eq 1 ]]; then
|
||||
run_test "nvme_zns" test/nvme/zns/zns.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
|
||||
|
@ -82,3 +82,7 @@ vhost_scsi_cores_2ctrl
|
||||
busy
|
||||
balanced
|
||||
core_load
|
||||
# Waiting for CI support
|
||||
nvme_zns
|
||||
is_zoned
|
||||
zoned_fio
|
||||
|
92
test/nvme/zns/zns.sh
Executable file
92
test/nvme/zns/zns.sh
Executable file
@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env bash
|
||||
testdir=$(readlink -f "$(dirname "$0")")
|
||||
rootdir=$(readlink -f "$testdir/../../../")
|
||||
source "$rootdir/test/common/autotest_common.sh"
|
||||
|
||||
restore_pci_blocked() {
|
||||
[[ -n $PCI_ZONED ]] || return 0
|
||||
|
||||
PCI_BLOCKED="" "$rootdir/scripts/setup.sh" reset
|
||||
PCI_BLOCKED=$PCI_ZONED "$rootdir/scripts/setup.sh"
|
||||
}
|
||||
|
||||
gen_json_conf() {
|
||||
cat <<- JSON
|
||||
{
|
||||
"subsystems": [
|
||||
{
|
||||
"subsystem": "bdev",
|
||||
"config": [
|
||||
{
|
||||
"method": "bdev_nvme_attach_controller",
|
||||
"params": {
|
||||
"trtype": "PCIe",
|
||||
"name":"$bdev",
|
||||
"traddr":"$bdf"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
JSON
|
||||
}
|
||||
|
||||
gen_fio_conf() {
|
||||
local zone_bdev
|
||||
|
||||
cat <<- FIO
|
||||
[global]
|
||||
ioengine=spdk_bdev
|
||||
thread=1
|
||||
direct=1
|
||||
time_based
|
||||
runtime=5
|
||||
rw=randwrite
|
||||
bs=16K
|
||||
zonemode=zbd
|
||||
max_open_zones=8
|
||||
initial_zone_reset=1
|
||||
zone_append=1
|
||||
iodepth=64
|
||||
FIO
|
||||
|
||||
for zone_bdev in "${!zoned_bdevs[@]}"; do
|
||||
cat <<- FIO
|
||||
[filename$zone_bdev]
|
||||
filename=${zoned_bdevs[zone_bdev]}
|
||||
FIO
|
||||
done
|
||||
}
|
||||
|
||||
is_zoned() {
|
||||
# At least one namespace must be zoned
|
||||
((${#zoned_bdevs[@]} > 0))
|
||||
}
|
||||
|
||||
fio() {
|
||||
fio_bdev --ioengine=spdk_bdev --spdk_json_conf <(gen_json_conf) <(gen_fio_conf)
|
||||
}
|
||||
|
||||
zoned_bdfs=($PCI_ZONED)
|
||||
if ((${#zoned_bdfs[@]} == 0)); then
|
||||
printf 'No ZNS nvme devices found, skipping\n' >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PCI_BLOCKED="" PCI_ALLOWED="${zoned_bdfs[*]}" "$rootdir/scripts/setup.sh"
|
||||
bdf=${zoned_bdfs[0]} bdev=zone0
|
||||
|
||||
trap 'kill $spdk_app_pid || :; restore_pci_blocked' EXIT
|
||||
|
||||
"${SPDK_APP[@]}" &
|
||||
spdk_app_pid=$!
|
||||
waitforlisten "$spdk_app_pid"
|
||||
|
||||
rpc_cmd bdev_nvme_attach_controller -t pcie -a "$bdf" -b "$bdev"
|
||||
zoned_bdevs=($(rpc_cmd bdev_get_bdevs | jq -r ".[] | select(.zoned == true) | select(.driver_specific.nvme.pci_address == \"$bdf\") | .name"))
|
||||
|
||||
killprocess "$spdk_app_pid"
|
||||
|
||||
run_test "is_zoned" is_zoned
|
||||
run_test "zoned_fio" fio
|
Loading…
Reference in New Issue
Block a user