Skip to contentSkip to conversation

Test different queue types

PATCH In review Daniel Wagner 4 participants 11 messages Mar 29, 2023 – Apr 12, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Test different queue types

Setup different queues, e.g. read and poll queues.

As discussed I introduced a _require_nvme_trtype() function to limit the test to tcp and rdma. I've upated the existing _require_nvme_type_is_*() checks to explicit transport checks.

Test run against current nvme-6.4 but it still needs patch #3 from [1] to survive.

[1] https://lore.kernel.org/linux-nvme/[email protected]/

changes:
v3:
- added _require_nvme_trtype()
- updated test requirement checks
- replaced double shift instructions with 'shift 2'
- updated license type
- added FAIL checks
v2:
- make most arguements optional for _nvme_connect_subsys
- move variable decleration at the beging of _nvme_connect_subsy
v1:
- initial version

Daniel Wagner (4):
nvme/rc: Parse optional arguments in _nvme_connect_subsys() nvme/rc: Add nr queue parser arguments to _nvme_connect_subsys() nvme/rc: Add parametric transport required check nvme/047: Test different queue types for fabrics transports

 tests/nvme/041     |   7 ++-
 tests/nvme/042     |  10 +++--
 tests/nvme/043     |  10 +++--
 tests/nvme/044     |  23 ++++++----
 tests/nvme/045     |   6 ++-
 tests/nvme/047     |  66 +++++++++++++++++++++++++++++
 tests/nvme/047.out |   2 +
 tests/nvme/rc      | 103 +++++++++++++++++++++++++++++++++++++++------
 8 files changed, 194 insertions(+), 33 deletions(-)
 create mode 100755 tests/nvme/047
 create mode 100644 tests/nvme/047.out
Signature · 1 line
2.40.0
#1 lore raw

PATCH v3 1/4 nvme/rc: Parse optional arguments in _nvme_connect_subsys()

Extend the nvme_connect_subsys() function to parse optional arguments. This avoids that all test have to pass in always all arguments.

---
 tests/nvme/041 |  7 ++++--
 tests/nvme/042 | 10 +++++----
 tests/nvme/043 | 10 +++++----
 tests/nvme/044 | 23 ++++++++++++-------
 tests/nvme/045 |  6 +++--
 tests/nvme/rc  | 61 ++++++++++++++++++++++++++++++++++++++++++--------
 6 files changed, 88 insertions(+), 29 deletions(-)
tests/nvme/041 +5 -2
index 8ffcf13a500a..03e2dab25918 100755
@@ -55,14 +55,17 @@ test() {
 	# Test unauthenticated connection (should fail)
 	echo "Test unauthenticated connection (should fail)"
 	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-			     "" "" "${hostnqn}" "${hostid}"
+			     --hostnqn "${hostnqn}" \
+			     --hostid "${hostid}"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
 	# Test authenticated connection
 	echo "Test authenticated connection"
 	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-			     "" "" "${hostnqn}" "${hostid}" "${hostkey}"
+			     --hostnqn "${hostnqn}" \
+			     --hostid "${hostid}" \
+			     --dhchap-secret "${hostkey}"
 
 	udevadm settle
 
tests/nvme/042 +6 -4
index d581bce4a9ee..4ad726f72f5a 100755
@@ -58,8 +58,9 @@ test() {
 		_set_nvmet_hostkey "${hostnqn}" "${hostkey}"
 
 		_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-				     "" "" "${hostnqn}" "${hostid}" \
-				     "${hostkey}"
+				     --hostnqn "${hostnqn}" \
+				     --hostid "${hostid}" \
+				     --dhchap-secret "${hostkey}"
 		udevadm settle
 
 		_nvme_disconnect_subsys "${subsys_name}"
@@ -75,8 +76,9 @@ test() {
 		_set_nvmet_hostkey "${hostnqn}" "${hostkey}"
 
 		_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-				     "" "" "${hostnqn}" "${hostid}" \
-				     "${hostkey}"
+				     --hostnqn "${hostnqn}" \
+				     --hostid "${hostid}" \
+				     --dhchap-secret "${hostkey}"
 
 		udevadm settle
 
tests/nvme/043 +6 -4
index c8ce292ba2e7..c031cecf34a5 100755
@@ -56,8 +56,9 @@ test() {
 		_set_nvmet_hash "${hostnqn}" "${hash}"
 
 		_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-				     "" "" "${hostnqn}" "${hostid}" \
-				     "${hostkey}"
+				     --hostnqn "${hostnqn}" \
+				     --hostid "${hostid}" \
+				     --dhchap-secret "${hostkey}"
 
 		udevadm settle
 
@@ -71,8 +72,9 @@ test() {
 		_set_nvmet_dhgroup "${hostnqn}" "${dhgroup}"
 
 		_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-				     "" "" "${hostnqn}" "${hostid}" \
-				     "${hostkey}"
+				      --hostnqn "${hostnqn}" \
+				      --hostid "${hostid}" \
+				      --dhchap-secret "${hostkey}"
 
 		udevadm settle
 
tests/nvme/044 +15 -8
index c19a9c026711..f2406ecadf7d 100755
@@ -66,8 +66,9 @@ test() {
 	# Step 1: Connect with host authentication only
 	echo "Test host authentication"
 	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-			     "" "" "${hostnqn}" "${hostid}" \
-			     "${hostkey}"
+			     --hostnqn "${hostnqn}" \
+			     --hostid "${hostid}" \
+			     --dhchap-secret "${hostkey}"
 
 	udevadm settle
 
@@ -77,8 +78,10 @@ test() {
 	# and invalid ctrl authentication
 	echo "Test invalid ctrl authentication (should fail)"
 	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-			     "" "" "${hostnqn}" "${hostid}" \
-			     "${hostkey}" "${hostkey}"
+			     --hostnqn "${hostnqn}" \
+			     --hostid "${hostid}" \
+			     --dhchap-secret "${hostkey}" \
+			     --dhchap-ctrl-secret "${hostkey}"
 
 	udevadm settle
 
@@ -88,8 +91,10 @@ test() {
 	# and valid ctrl authentication
 	echo "Test valid ctrl authentication"
 	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-			     "" "" "${hostnqn}" "${hostid}" \
-			     "${hostkey}" "${ctrlkey}"
+			     --hostnqn "${hostnqn}" \
+			     --hostid "${hostid}" \
+			     --dhchap-secret "${hostkey}" \
+			     --dhchap-ctrl-secret "${ctrlkey}"
 
 	udevadm settle
 
@@ -100,8 +105,10 @@ test() {
 	echo "Test invalid ctrl key (should fail)"
 	invkey="DHHC-1:00:Jc/My1o0qtLCWRp+sHhAVafdfaS7YQOMYhk9zSmlatobqB8C:"
 	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-			     "" "" "${hostnqn}" "${hostid}" \
-			     "${hostkey}" "${invkey}"
+			     --hostnqn "${hostnqn}" \
+			     --hostid "${hostid}" \
+			     --dhchap-secret "${hostkey}" \
+			     --dhchap-ctrl-secret "${invkey}"
 
 	udevadm settle
 
tests/nvme/045 +4 -2
index a0e6e93ed3c7..612e5f168e3c 100755
@@ -65,8 +65,10 @@ test() {
 	_set_nvmet_dhgroup "${hostnqn}" "ffdhe2048"
 
 	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
-			     "" "" "${hostnqn}" "${hostid}" \
-			     "${hostkey}" "${ctrlkey}"
+			     --hostnqn "${hostnqn}" \
+			     --hostid "${hostid}" \
+			     --dhchap-secret "${hostkey}" \
+			     --dhchap-ctrl-secret "${ctrlkey}"
 
 	udevadm settle
 
tests/nvme/rc +52 -9

67 lines not on this page · raw message

Signature · 1 line
2.40.0
Reviewed-by on v3 1/4
#2 lore raw

Re: [PATCH blktests v3 1/4] nvme/rc: Parse optional arguments in _nvme_connect_subsys()

Quoted 5 lines · Daniel Wagner

Extend the nvme_connect_subsys() function to parse optional arguments. This avoids that all test have to pass in always all arguments.

---

Thanks for addressing the variable declaration comment and adding optional parameters.

-ck

#3 lore raw

PATCH v3 2/4 nvme/rc: Add nr queue parser arguments to _nvme_connect_subsys()

In reply to Daniel Wagner
---
 tests/nvme/rc | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
tests/nvme/rc +25 -0
index 20c5e2fa32cb..c1bb08be511a 100644
@@ -326,6 +326,9 @@ _nvme_connect_subsys() {
 	local hostid="$def_hostid"
 	local hostkey=""
 	local ctrlkey=""
+	local nr_io_queues=""
+	local nr_write_queues=""
+	local nr_poll_queues=""
 
 	while [[ $# -gt 0 ]]; do
 		case $1 in
@@ -357,6 +360,18 @@ _nvme_connect_subsys() {
 				ctrlkey="$2"
 				shift 2
 				;;
+			-i|--nr-io-queues)
+				nr_io_queues="$2"
+				shift 2
+				;;
+			-W|--nr-write-queues)
+				nr_write_queues="$2"
+				shift 2
+				;;
+			-P|--nr-poll-queues)
+				nr_poll_queues="$2"
+				shift 2
+				;;
 			*)
 				positional_args+=("$1")
 				shift
@@ -387,6 +402,16 @@ _nvme_connect_subsys() {
 	if [[ -n "${ctrlkey}" ]]; then
 		ARGS+=(--dhchap-ctrl-secret="${ctrlkey}")
 	fi
+	if [[ -n "${nr_io_queues}" ]]; then
+		ARGS+=(--nr-io-queues="${nr_io_queues}")
+	fi
+	if [[ -n "${nr_write_queues}" ]]; then
+		ARGS+=(--nr-write-queues="${nr_write_queues}")
+	fi
+	if [[ -n "${nr_poll_queues}" ]]; then
+		ARGS+=(--nr-poll-queues="${nr_poll_queues}")
+	fi
+
 	nvme connect "${ARGS[@]}" 2> /dev/null
 }
 
Signature · 1 line
2.40.0
#5 lore raw

PATCH v3 3/4 nvme/rc: Add parametric transport required check

In reply to Daniel Wagner

Not all transport support the same features thus we need to be able to express this. Add a transport require check which can be runtime parameterized.

While at it also update the existing helpers to test for trtype to with an explicit list of transport types.

---
 tests/nvme/rc | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
tests/nvme/rc +13 -4
index c1bb08be511a..a3c9b42d91e6 100644
@@ -93,17 +93,26 @@ _require_test_dev_is_nvme() {
 	return 0
 }
 
+_require_nvme_trtype() {
+	local trtype
+	for trtype in "$@"; do
+		if [[ "${nvme_trtype}" == "$trtype" ]]; then
+			return 0
+		fi
+	done
+	SKIP_REASONS+=("nvme_trtype=${nvme_trtype} is not supported in this test")
+	return 1
+}
+
 _require_nvme_trtype_is_loop() {
-	if [[ "${nvme_trtype}" != "loop" ]]; then
-		SKIP_REASONS+=("nvme_trtype=${nvme_trtype} is not supported in this test")
+	if ! _require_nvme_trtype loop; then
 		return 1
 	fi
 	return 0
 }
 
 _require_nvme_trtype_is_fabrics() {
-	if [[ "${nvme_trtype}" == "pci" ]]; then
-		SKIP_REASONS+=("nvme_trtype=${nvme_trtype} is not supported in this test")
+	if ! _require_nvme_trtype loop fc rdma tcp; then
 		return 1
 	fi
 	return 0
Signature · 1 line
2.40.0
Reviewed-by on v3 3/4
#6 lore raw

Re: [PATCH blktests v3 3/4] nvme/rc: Add parametric transport required check

Quoted 9 lines · Daniel Wagner

Not all transport support the same features thus we need to be able to express this. Add a transport require check which can be runtime parameterized.

While at it also update the existing helpers to test for trtype to with an explicit list of transport types.

---

-ck

#7 lore raw

PATCH v3 4/4 nvme/047: Test different queue types for fabrics transports

In reply to Daniel Wagner

Test if the fabrics transports are handling different queues types correctly.

Currently, only TCP and RDMA from the fabric transport family support this feature, so limit the test to these two.

We also issue some I/O to make sure that not just the plain connect works. For this we have to use a file system which supports direct I/O and hence we use a device backend.

---
 tests/nvme/047     | 66 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/047.out |  2 ++
 2 files changed, 68 insertions(+)
 create mode 100755 tests/nvme/047
 create mode 100644 tests/nvme/047.out
tests/nvme/047 new file +66 -0
new file mode 100755
index 000000000000..d56d3be185b0
@@ -0,0 +1,66 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 SUSE LLC
+#
+# Test if the fabrics transports are handling different queues types correctly.
+
+. tests/nvme/rc
+. common/xfs
+
+DESCRIPTION="test different queue types for fabric transports"
+
+requires() {
+	_nvme_requires
+	_have_xfs
+	_have_fio
+	_require_nvme_trtype tcp rdma
+	_have_kver 4 21
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	_setup_nvmet
+
+	local port
+	local nvmedev
+	local loop_dev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 512M "${file_path}"
+
+	loop_dev="$(losetup -f --show "${file_path}")"
+
+	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "${nvme_trtype}")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
+		--nr-write-queues 1 || echo FAIL
+
+	nvmedev=$(_find_nvme_dev "${subsys_name}")
+
+	_xfs_run_fio_verify_io /dev/"${nvmedev}n1" "1m" || echo FAIL
+
+	_nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1
+
+	_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \
+		--nr-write-queues 1 \
+		--nr-poll-queues 1 || echo FAIL
+
+	_xfs_run_fio_verify_io /dev/"${nvmedev}n1" "1m" || echo FAIL
+
+	_nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	losetup -d "${loop_dev}"
+
+	rm "${file_path}"
+
+	echo "Test complete"
+}
tests/nvme/047.out new file +2 -0
new file mode 100644
index 000000000000..915d0a2389ca
@@ -0,0 +1,2 @@
+Running nvme/047
+Test complete
Signature · 1 line
2.40.0
Reviewed-by on v3 4/4
#8 lore raw

Re: [PATCH blktests v3 4/4] nvme/047: Test different queue types for fabrics transports

Quoted 6 lines · Daniel Wagner

Test if the fabrics transports are handling different queues types correctly.

Currently, only TCP and RDMA from the fabric transport family support this feature, so limit the test to these two.

Quoted 6 lines

We also issue some I/O to make sure that not just the plain connect works. For this we have to use a file system which supports direct I/O and hence we use a device backend.

---

-ck

#9 lore raw
In reply to Daniel Wagner
Quoted 10 lines · Daniel Wagner

Setup different queues, e.g. read and poll queues.

As discussed I introduced a _require_nvme_trtype() function to limit the test to tcp and rdma. I've upated the existing _require_nvme_type_is_*() checks to explicit transport checks.

Test run against current nvme-6.4 but it still needs patch #3 from [1] to survive.

[1] https://lore.kernel.org/linux-nvme/[email protected]/

All patches look good to me. I reconfirmed that my test system hangs without the kernel fix patch above [1]. I'll wait for the kernel fix patch lands on Linus tree, then apply your patches to blktests master.

Signature · 1 line
Shin'ichiro Kawasaki
#10 lore raw
Quoted 7 lines · Shinichiro Kawasaki
Quoted 6 lines · Daniel Wagner

Setup different queues, e.g. read and poll queues.

As discussed I introduced a _require_nvme_trtype() function to limit the test to tcp and rdma. I've upated the existing _require_nvme_type_is_*() checks to explicit transport checks.

Quoted 8 lines
Quoted 4 lines

Test run against current nvme-6.4 but it still needs patch #3 from [1] to survive.

[1] https://lore.kernel.org/linux-nvme/[email protected]/

All patches look good to me. I reconfirmed that my test system hangs without the kernel fix patch above [1]. I'll wait for the kernel fix patch lands on Linus tree, then apply your patches to blktests master.

The fix was upstreamed and I've applied this series. Thanks!