Skip to contentSkip to conversation

nvme testsuite runtime optimization

PATCH Superseded Daniel Wagner 3 participants 38 messages May 3, 2023 – May 11, 2023

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover nvme testsuite runtime optimization

Addessed all the comments I got for v2. If I didn't response to all comments that just means I silently acked them and updated the series accordingly. Hopefully I didn't miss anything.

I've changed the defaults back to the previous hard coded defaults. That means the default image size is 1G and the many iterations count is 1000 (nvme/002 always runs 1000 as this is necessary to actually test the page overflow).

This time I also made sure the nvme pci tests nvme/030... get executed. With the defaults the loop transport gives

loop:

  real    13m17.778s
  user    0m27.396s
  sys     5m48.958s

and with nvme_img_size=16M nvme_num_iter=10 it gets down to

loop:

  real    6m2.588s
  user    0m13.450s
  sys     1m55.236s

Althought some of the tests get skipped (nvme/012, nvme/013) with such small test image sizes.

The values for tcp and rdma are similiar

tcp:

  real    8m29.010s
  user    0m14.068s
  sys     2m57.573s

rdma:

  real    8m46.285s
  user    0m13.843s
  sys     2m2.662s

get down to

tcp:

  real    2m18.117s
  user    0m5.928s
  sys     0m42.649s

rdma:

  real    2m5.546s
  user    0m6.474s
  sys     0m37.818s

The fc transport is not passing all tests and hence let's ignore it for now.

Obviously you can also turn the values in the other direction and increase the tests 'coverage'.

Thanks,
Daniel

changes:
v3:
- 'nvme/rc' instead of 'nvme-rc' subject prefi x
- fixed spaces vs tabs indention
- nvme/014, nvme/015 dropped -1 in #block calculation
- common/xfs: use 'tail -1' instead 'awk'
- common/xfs: no need for printf for integer division
- nvme/035 limit disk size via nvme_img_size
- set defaults to previous values: nvme_img_size=1G, nvme_num_iter=1000
- nvme/032, nvme/040 let fio figure out image size
set timeout to infinity
cleanup fio
- add documentation for nvme_tr_type, nvme_img_size and nvme_num_iter
- limited nproc to 32 for num jobs for random fio job
- drop job size limit calculation
- drop nvme_num_iter from nvme/002
- limit xfs fio job size inside _xfs_run_fio_verify_io()
- added reviewed tags

v2:
- made image size configurable via nvme_img_size env
- make number of iteration configurable via nvme_num_iter
- do not hard code test values
- calculate job size
- use runtime for fio background jobs
- https://lore.kernel.org/linux-nvme/[email protected]/

v1:
- initial version
- https://lore.kernel.org/linux-nvme/[email protected]/

Daniel Wagner (12):
nvme/rc: Auto convert test device size info
nvme: Do not hard code device size for dd test common/xfs: Make size argument optional for _xfs_run_fio_verify_io common/xfs: Limit fio size job to fit into xfs fs
nvme: Use runtime fio background jobs
Documentation: Add info on nvme_tr_type
nvme: Make test image size configurable
nvme/rc: Add minimal test image size requirement common/fio: Limit number of random jobs
nvme/rc: Calculate IO size for random fio jobs
nvme/rc: Move discovery generation counter code to rc
nvme: Make the number iterations configurable

 Documentation/running-tests.md |   12 +
 common/fio                     |    3 +-
 common/rc                      |   30 +-
 common/xfs                     |   17 +-
 tests/nvme/002                 |    4 +-
 tests/nvme/002.out             | 3004 --------------------------------
 tests/nvme/004                 |    2 +-
 tests/nvme/005                 |    2 +-
 tests/nvme/006                 |    2 +-
 tests/nvme/007                 |    2 +-
 tests/nvme/008                 |    2 +-
 tests/nvme/009                 |    2 +-
 tests/nvme/010                 |    5 +-
 tests/nvme/011                 |    5 +-
 tests/nvme/012                 |    5 +-
 tests/nvme/013                 |    5 +-
 tests/nvme/014                 |   12 +-
 tests/nvme/015                 |   12 +-
 tests/nvme/016                 |    2 +-
 tests/nvme/017                 |    4 +-
 tests/nvme/018                 |    2 +-
 tests/nvme/019                 |    2 +-
 tests/nvme/020                 |    2 +-
 tests/nvme/021                 |    2 +-
 tests/nvme/022                 |    2 +-
 tests/nvme/023                 |    2 +-
 tests/nvme/024                 |    2 +-
 tests/nvme/025                 |    2 +-
 tests/nvme/026                 |    2 +-
 tests/nvme/027                 |    2 +-
 tests/nvme/028                 |    2 +-
 tests/nvme/029                 |    2 +-
 tests/nvme/030                 |   22 +-
 tests/nvme/031                 |    2 +-
 tests/nvme/032                 |    5 +-
 tests/nvme/034                 |    2 +-
 tests/nvme/035                 |    4 +-
 tests/nvme/040                 |   11 +-
 tests/nvme/041                 |    2 +-
 tests/nvme/042                 |    2 +-
 tests/nvme/043                 |    2 +-
 tests/nvme/044                 |    2 +-
 tests/nvme/045                 |    6 +-
 tests/nvme/047                 |    8 +-
 tests/nvme/048                 |    2 +-
 tests/nvme/rc                  |   40 +
 46 files changed, 185 insertions(+), 3081 deletions(-)
Signature · 1 line
2.40.0
#1 lore raw

PATCH v3 1/12 nvme/rc: Auto convert test device size info

Introduce a convert_to_mb() helper which converts the size argument to MBytes and use in test device require function. This makes it possible to use user input strings in future.

---
 common/rc      | 30 +++++++++++++++++++++++++++---
 tests/nvme/035 |  2 +-
 2 files changed, 28 insertions(+), 4 deletions(-)
common/rc +27 -3
index af4c0b1cab22..0b15d1fe4c6b 100644
@@ -324,9 +324,12 @@ _get_pci_parent_from_blkdev() {
 		tail -2 | head -1
 }
 
-_require_test_dev_size_mb() {
-	local require_sz_mb=$1
-	local test_dev_sz_mb=$(($(blockdev --getsize64 "$TEST_DEV")/1024/1024))
+_require_test_dev_size() {
+	local require_sz_mb
+	local test_dev_sz_mb
+
+	require_sz_mb="$(convert_to_mb "$1")"
+	test_dev_sz_mb="$(($(blockdev --getsize64 "$TEST_DEV")/1024/1024))"
 
 	if (( "$test_dev_sz_mb" < "$require_sz_mb" )); then
 		SKIP_REASONS+=("${TEST_DEV} required at least ${require_sz_mb}m")
@@ -422,3 +425,24 @@ _have_writeable_kmsg() {
 _run_user() {
 	su "$NORMAL_USER" -c "$1"
 }
+
+convert_to_mb()
+{
+	local str=$1
+	local res
+
+	res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)$/\1/p')
+	if [[ -n "${res}" ]]; then
+		echo "$((res / 1024 / 1024))"
+	fi
+
+	res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)[mM]$/\1/p')
+	if [[ -n "${res}" ]]; then
+		echo "$((res))"
+	fi
+
+	res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)[gG]$/\1/p')
+	if [[ -n "${res}" ]]; then
+        	echo "$((res * 1024))"
+	fi
+}
tests/nvme/035 +1 -1
index d169e351e3d0..eb1024edddbf 100755
@@ -17,7 +17,7 @@ requires() {
 }
 
 device_requires() {
-	_require_test_dev_size_mb 1024
+	_require_test_dev_size 1024m
 }
 
 test_device() {
Signature · 1 line
2.40.0
Reviewed-by on v3 1/12
#2 lore raw

Re: [PATCH blktests v3 01/12] nvme/rc: Auto convert test device size info

Quoted 8 lines · Daniel Wagner

Introduce a convert_to_mb() helper which converts the size argument to MBytes and use in test device require function. This makes it possible to use user input strings in future.

---

Much needed mb helper, looks good.

-ck

#3 lore raw

Re: [PATCH blktests v3 01/12] nvme/rc: Auto convert test device size info

Quoted 11 lines · Chaitanya Kulkarni
Quoted 8 lines · Daniel Wagner

Introduce a convert_to_mb() helper which converts the size argument to MBytes and use in test device require function. This makes it possible to use user input strings in future.

---

Much needed mb helper, looks good.

I am sure the helper can be written way smarter but my shell-foo skills are a bit limitted. Still a starting point :)

#4 lore raw

Re: [PATCH blktests v3 01/12] nvme/rc: Auto convert test device size info

In reply to Daniel Wagner

On May 03, 2023 / 10:02, Daniel Wagner wrote:
[...]

Quoted 8 lines
common/rc +8 -0
+convert_to_mb()
+{
+	local str=$1
+	local res
+
+	res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)$/\1/p')
+	if [[ -n "${res}" ]]; then
+		echo "$((res / 1024 / 1024))"

common/rc _have_writeable_kmsg() { · line 446

Quoted 10 lines
common/rc +10 -0
+	fi
+
+	res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)[mM]$/\1/p')
+	if [[ -n "${res}" ]]; then
+		echo "$((res))"
+	fi
+
+	res=$(echo "${str}" | sed -n 's/^\([0-9]\+\)[gG]$/\1/p')
+	if [[ -n "${res}" ]]; then
+        	echo "$((res * 1024))"

Here are some spaces still left.

Quoted 2 lines
(quoted diff) +2 -0
+	fi
+}
#5 lore raw

PATCH v3 2/12 nvme: Do not hard code device size for dd test

In reply to Daniel Wagner

Read the block device sizes instead hard coding them, so that the device size can be configurable in future.

---
 tests/nvme/014 | 10 +++++++++-
 tests/nvme/015 | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)
tests/nvme/014 +9 -1
index d13cff7921da..875e99eea346 100755
@@ -23,6 +23,9 @@ test() {
 	local port
 	local nvmedev
 	local loop_dev
+	local size
+	local bs
+	local count
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
@@ -41,7 +44,12 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none
+	size="$(blockdev --getsize64 "/dev/${nvmedev}n1")"
+	bs="$(blockdev --getbsz "/dev/${nvmedev}n1")"
+	count=$((size / bs))
+
+	dd if=/dev/urandom of="/dev/${nvmedev}n1" \
+		count="${count}" bs="${bs}" status=none
 
 	nvme flush "/dev/${nvmedev}" -n 1
 
tests/nvme/015 +9 -1
index bb52ba2598db..8cb343e1d31c 100755
@@ -22,6 +22,9 @@ test() {
 
 	local port
 	local nvmedev
+	local size
+	local bs
+	local count
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
@@ -38,7 +41,12 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none
+	size="$(blockdev --getsize64 "/dev/${nvmedev}n1")"
+	bs="$(blockdev --getbsz "/dev/${nvmedev}n1")"
+	count=$((size / bs))
+
+	dd if=/dev/urandom of="/dev/${nvmedev}n1" \
+		count="${count}" bs="${bs}" status=none
 
 	nvme flush "/dev/${nvmedev}n1" -n 1
 
Signature · 1 line
2.40.0
#7 lore raw

Re: [PATCH blktests v3 02/12] nvme: Do not hard code device size for dd test

In reply to Daniel Wagner

One nit: I suggest "nvme/{014,015}" as the commit title prefix. It will clarify which test cases the commit touches.

#8 lore raw

PATCH v3 3/12 common/xfs: Make size argument optional for _xfs_run_fio_verify_io

In reply to Daniel Wagner

Make the size argument optional by reading the filesystem info. The caller doesn't have to guess (or calculate) how big the max IO size. The log data structure of XFS is reducing the capacity.

---
 common/xfs     | 14 +++++++++++++-
 tests/nvme/012 |  2 +-
 tests/nvme/013 |  2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)
common/xfs +13 -1
index 2c5d96164ac1..413c2820ffaf 100644
@@ -24,10 +24,22 @@ _xfs_run_fio_verify_io() {
 	local mount_dir="/mnt/blktests"
 	local bdev=$1
 	local sz=$2
+	local sz_mb
+	local avail
+	local avail_mb
 
 	_xfs_mkfs_and_mount "${bdev}" "${mount_dir}" >> "${FULL}" 2>&1
 
-	_run_fio_verify_io --size="$sz" --directory="${mount_dir}/"
+	avail="$(df --output=avail "${mount_dir}" | tail -1)"
+	avail_mb="$((avail / 1024))"
+
+	if [[ -z "${sz}" ]]; then
+		sz_mb="${avail_mb}"
+	else
+		sz_mb="$(convert_to_mb "${sz}")"
+	fi
+
+	_run_fio_verify_io --size="${sz_mb}m" --directory="${mount_dir}/"
 
 	umount "${mount_dir}" >> "${FULL}" 2>&1
 	rm -fr "${mount_dir}"
tests/nvme/012 +1 -1
index e60082c2e751..c9d24388306d 100755
@@ -44,7 +44,7 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_xfs_run_fio_verify_io "/dev/${nvmedev}n1" "900m"
+	_xfs_run_fio_verify_io "/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/013 +1 -1
index 9d60a7df4577..265b6968fd34 100755
@@ -41,7 +41,7 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_xfs_run_fio_verify_io "/dev/${nvmedev}n1" "900m"
+	_xfs_run_fio_verify_io "/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
Signature · 1 line
2.40.0
Reviewed-by on v3 3/12
#9 lore raw

Re: [PATCH blktests v3 03/12] common/xfs: Make size argument optional for _xfs_run_fio_verify_io

Quoted 7 lines · Daniel Wagner

Make the size argument optional by reading the filesystem info. The caller doesn't have to guess (or calculate) how big the max IO size. The log data structure of XFS is reducing the capacity.

---

Looks good.

-ck

#10 lore raw

PATCH v3 4/12 common/xfs: Limit fio size job to fit into xfs fs

In reply to Daniel Wagner

The usable capacity of the filesystem is less than the raw partition/device size due to the additional meta/log data.

Ensure that the job size for fio is not exceeding the limits.

Because we have hard coded the path where we mount the filesystem and don't want to expose this, we just update max size inside _xfs_run_fio_verify_io(). No need to leak this into the caller.

---
 common/xfs | 3 +++
 1 file changed, 3 insertions(+)
common/xfs +3 -0
index 413c2820ffaf..37ce85878df2 100644
@@ -37,6 +37,9 @@ _xfs_run_fio_verify_io() {
 		sz_mb="${avail_mb}"
 	else
 		sz_mb="$(convert_to_mb "${sz}")"
+		if [[ "${sz_mb}" -gt "${avail_mb}" ]]; then
+			sz_mb="${avail_mb}"
+		fi
 	fi
 
 	_run_fio_verify_io --size="${sz_mb}m" --directory="${mount_dir}/"
Signature · 1 line
2.40.0
#11 lore raw

Re: [PATCH blktests v3 04/12] common/xfs: Limit fio size job to fit into xfs fs

Quoted 19 lines · Daniel Wagner

The usable capacity of the filesystem is less than the raw partition/device size due to the additional meta/log data.

Ensure that the job size for fio is not exceeding the limits.

Because we have hard coded the path where we mount the filesystem and don't want to expose this, we just update max size inside _xfs_run_fio_verify_io(). No need to leak this into the caller.

---
  common/xfs | 3 +++
  1 file changed, 3 insertions(+)
common/xfs +0 -0
index 413c2820ffaf..37ce85878df2 100644

common/xfs _xfs_run_fio_verify_io() { · line 45

Quoted 9 lines
common/xfs +3 -0
@@ -37,6 +37,9 @@ _xfs_run_fio_verify_io() {
  		sz_mb="${avail_mb}"
  	else
  		sz_mb="$(convert_to_mb "${sz}")"
+		if [[ "${sz_mb}" -gt "${avail_mb}" ]]; then
+			sz_mb="${avail_mb}"
+		fi
  	fi
 
  	_run_fio_verify_io --size="${sz_mb}m" --directory="${mount_dir}/"

this is exactly how it should to start with, the only
is now we are silently reducing the fio job size maybe that is okay ?

or we should error out here instead of being smart ?

-ck

#12 lore raw

Re: [PATCH blktests v3 04/12] common/xfs: Limit fio size job to fit into xfs fs

Quoted 28 lines · Chaitanya Kulkarni
Quoted 27 lines · Daniel Wagner

The usable capacity of the filesystem is less than the raw partition/device size due to the additional meta/log data.

Ensure that the job size for fio is not exceeding the limits.

Because we have hard coded the path where we mount the filesystem and don't want to expose this, we just update max size inside _xfs_run_fio_verify_io(). No need to leak this into the caller.

---
  common/xfs | 3 +++
  1 file changed, 3 insertions(+)
common/xfs +3 -0
index 413c2820ffaf..37ce85878df2 100644
@@ -37,6 +37,9 @@ _xfs_run_fio_verify_io() {
  		sz_mb="${avail_mb}"
  	else
  		sz_mb="$(convert_to_mb "${sz}")"
+		if [[ "${sz_mb}" -gt "${avail_mb}" ]]; then
+			sz_mb="${avail_mb}"
+		fi
  	fi
 
Quoted 7 lines

common/xfs _xfs_run_fio_verify_io() { · line 45

Quoted 1 line
common/xfs +0 -0
  	_run_fio_verify_io --size="${sz_mb}m" --directory="${mount_dir}/"

this is exactly how it should to start with, the only
is now we are silently reducing the fio job size maybe that is okay ?

or we should error out here instead of being smart ?

The problem I try to solve here is that on the caller side (nvme/035) we don't know yet the usable filesystem size. We only the size of the nvme_img_size.

If we want to move this logic to the caller side we need split _xfs_run_fio_verify_io() into steps. The first step which creates the fileystem and the second one which runs fio.

I don't know if this is worth doing it though.

#13 lore raw

PATCH v3 5/12 nvme: Use runtime fio background jobs

In reply to Daniel Wagner

The fio jobs are supposed to run long in background during the test. Instead relying on a job size use explicit runtime for this.

---
 tests/nvme/032 | 4 ++--
 tests/nvme/040 | 9 +++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
tests/nvme/032 +2 -2
index 017d4a339971..2e4b7f0760c7 100755
@@ -38,8 +38,8 @@ test_device() {
 	sysfs="/sys/bus/pci/devices/${pdev}"
 
 	# start fio job
-	_run_fio_rand_io --filename="$TEST_DEV" --size=1g \
-		--group_reporting  &> /dev/null &
+	_run_fio_rand_io --filename="$TEST_DEV" \
+		--group_reporting --time_based --runtime=-1 &> /dev/null &
 
 	sleep 5
 
tests/nvme/040 +7 -2
index 04bd726cd309..05b4f5472ef5 100755
@@ -21,6 +21,7 @@ test() {
 	local port
 	local loop_dev
 	local nvmedev
+	local fio_pid
 
 	echo "Running ${TEST_NAME}"
 
@@ -37,8 +38,10 @@ test() {
 
 	# start fio job
 	echo "starting background fio"
-	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size=1g \
-		--group_reporting --ramp_time=5  &> /dev/null &
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" \
+		--group_reporting --ramp_time=5 \
+		--time_based --runtime=-1 &> /dev/null &
+	fio_pid=$!
 	sleep 5
 
 	# do reset/remove operation
@@ -48,6 +51,8 @@ test() {
 	echo "deleting controller"
 	_nvme_delete_ctrl "${nvmedev}"
 
+	{ kill "${fio_pid}"; wait; } &> /dev/null
+
 	_remove_nvmet_subsystem_from_port "${port}" "${subsys}"
 	_remove_nvmet_subsystem "${subsys}"
 	_remove_nvmet_port "${port}"
Signature · 1 line
2.40.0
#14 lore raw

Re: [PATCH blktests v3 05/12] nvme: Use runtime fio background jobs

Quoted 7 lines · Daniel Wagner

The fio jobs are supposed to run long in background during the test. Instead relying on a job size use explicit runtime for this.

---
 tests/nvme/032 | 4 ++--
 tests/nvme/040 | 9 +++++++--

Nit: I suggest "nvme/{032,040}" as the commit title prefix.

Quoted 7 lines
 2 files changed, 9 insertions(+), 4 deletions(-)
tests/nvme/032 +0 -0
index 017d4a339971..2e4b7f0760c7 100755

tests/nvme/032 test_device() { · line 42

Quoted 7 lines
tests/nvme/032 +2 -2
@@ -38,8 +38,8 @@ test_device() {
 	sysfs="/sys/bus/pci/devices/${pdev}"
 
 	# start fio job
-	_run_fio_rand_io --filename="$TEST_DEV" --size=1g \
-		--group_reporting  &> /dev/null &
+	_run_fio_rand_io --filename="$TEST_DEV" \
+		--group_reporting --time_based --runtime=-1 &> /dev/null &

Nit: I checked fio man page, and did not find meaning of negative value for the --runtime option. I also checked fio code, it looks that -1 is handled as ULONG_MAX by type cast from singed long long to unsigned long long. Assuming such negative values for the options are not well defined, --runtime=1d or --runtime=365d would be the better to mean 'infinite runtime'.

Quoted 16 lines
tests/nvme/032 +0 -0
 	sleep 5
 
tests/nvme/040 +1 -0
index 04bd726cd309..05b4f5472ef5 100755
@@ -21,6 +21,7 @@ test() {
 	local port
 	local loop_dev
 	local nvmedev
+	local fio_pid
 
 	echo "Running ${TEST_NAME}"
 

tests/nvme/040 test() { · line 43

Quoted 8 lines
tests/nvme/040 +3 -2
@@ -37,8 +38,10 @@ test() {
 
 	# start fio job
 	echo "starting background fio"
-	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size=1g \
-		--group_reporting --ramp_time=5  &> /dev/null &
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" \
+		--group_reporting --ramp_time=5 \
+		--time_based --runtime=-1 &> /dev/null &

Same as above.

Quoted 16 lines
tests/nvme/040 +3 -0
+	fio_pid=$!
 	sleep 5
 
 	# do reset/remove operation
@@ -48,6 +51,8 @@ test() {
 	echo "deleting controller"
 	_nvme_delete_ctrl "${nvmedev}"
 
+	{ kill "${fio_pid}"; wait; } &> /dev/null
+
 	_remove_nvmet_subsystem_from_port "${port}" "${subsys}"
 	_remove_nvmet_subsystem "${subsys}"
 	_remove_nvmet_port "${port}"
Signature · 1 line
2.40.0
#15 lore raw

PATCH v3 6/12 Documentation: Add info on nvme_tr_type

In reply to Daniel Wagner

Mention that the nvme tests can be parametrized.

---
 Documentation/running-tests.md | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/running-tests.md +7 -0
index 3550f377f487..7e827fba7ac0 100644
@@ -98,6 +98,13 @@ requires that the kernel be compiled with `CONFIG_BLK_DEV_ZONED` enabled.
 RUN_ZONED_TESTS=1
 ```
 
+### NVMe test parameterizing
+
+The NVMe tests can be additionally parameterized via environment variables.
+
+- nvme_tr_type: 'loop' (default), 'tcp', 'rdma' and 'fc'
+  Run the tests with the given transport.
+
 ### Running nvme-rdma nvmeof-mp srp tests
 
 Most of these tests will use the rdma_rxe (soft-RoCE) driver by default. The siw (soft-iWARP) driver is also supported.
Signature · 1 line
2.40.0
Reviewed-by on v3 6/12
#16 lore raw

Re: [PATCH blktests v3 06/12] Documentation: Add info on nvme_tr_type

Quoted 15 lines · Daniel Wagner

Mention that the nvme tests can be parametrized.

---
  Documentation/running-tests.md | 7 +++++++
  1 file changed, 7 insertions(+)
Documentation/running-tests.md +0 -0
index 3550f377f487..7e827fba7ac0 100644
@@ -98,6 +98,13 @@ requires that the kernel be compiled with `CONFIG_BLK_DEV_ZONED` enabled.
  RUN_ZONED_TESTS=1
  ```
 

Documentation/running-tests.md requires that the kernel be compiled with `CONFIG_BLK_DEV_ZONED` enabled. · line 110

Quoted 10 lines
Documentation/running-tests.md +7 -0
+### NVMe test parameterizing
+
+The NVMe tests can be additionally parameterized via environment variables.
+
+- nvme_tr_type: 'loop' (default), 'tcp', 'rdma' and 'fc'
+  Run the tests with the given transport.
+
  ### Running nvme-rdma nvmeof-mp srp tests
 
  Most of these tests will use the rdma_rxe (soft-RoCE) driver by default. The siw (soft-iWARP) driver is also supported.

Looks good.

-ck

#17 lore raw

Re: [PATCH blktests v3 06/12] Documentation: Add info on nvme_tr_type

In reply to Daniel Wagner

Oh, thank you for adding this missing piece! Please find a nit below.

Quoted 12 lines · Daniel Wagner

Mention that the nvme tests can be parametrized.

---
 Documentation/running-tests.md | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/running-tests.md +0 -0
index 3550f377f487..7e827fba7ac0 100644

Documentation/running-tests.md requires that the kernel be compiled with `CONFIG_BLK_DEV_ZONED` enabled. · line 105

Quoted 8 lines
Documentation/running-tests.md +5 -0
@@ -98,6 +98,13 @@ requires that the kernel be compiled with `CONFIG_BLK_DEV_ZONED` enabled.
 RUN_ZONED_TESTS=1
 ```
 
+### NVMe test parameterizing
+
+The NVMe tests can be additionally parameterized via environment variables.
+
+- nvme_tr_type: 'loop' (default), 'tcp', 'rdma' and 'fc'

nvme_tr_type should be nvme_trtype. Same for the commit title.

Quoted 8 lines
Documentation/running-tests.md +2 -0
+  Run the tests with the given transport.
+
 ### Running nvme-rdma nvmeof-mp srp tests
 
 Most of these tests will use the rdma_rxe (soft-RoCE) driver by default. The siw (soft-iWARP) driver is also supported.
Signature · 1 line
2.40.0
#18 lore raw

PATCH v3 7/12 nvme: Make test image size configurable

In reply to Daniel Wagner

The reduce the overall runtime of the testsuite by making the default size of the test image small. For verification jobs, the default can be overwriten via the newly introduced nvme_img_size environment variable.

---
 Documentation/running-tests.md | 3 +++
 tests/nvme/004                 | 2 +-
 tests/nvme/005                 | 2 +-
 tests/nvme/006                 | 2 +-
 tests/nvme/007                 | 2 +-
 tests/nvme/008                 | 2 +-
 tests/nvme/009                 | 2 +-
 tests/nvme/010                 | 5 +++--
 tests/nvme/011                 | 5 +++--
 tests/nvme/012                 | 2 +-
 tests/nvme/013                 | 2 +-
 tests/nvme/014                 | 2 +-
 tests/nvme/015                 | 2 +-
 tests/nvme/017                 | 2 +-
 tests/nvme/018                 | 2 +-
 tests/nvme/019                 | 2 +-
 tests/nvme/020                 | 2 +-
 tests/nvme/021                 | 2 +-
 tests/nvme/022                 | 2 +-
 tests/nvme/023                 | 2 +-
 tests/nvme/024                 | 2 +-
 tests/nvme/025                 | 2 +-
 tests/nvme/026                 | 2 +-
 tests/nvme/027                 | 2 +-
 tests/nvme/028                 | 2 +-
 tests/nvme/029                 | 3 ++-
 tests/nvme/031                 | 2 +-
 tests/nvme/032                 | 1 -
 tests/nvme/034                 | 2 +-
 tests/nvme/035                 | 4 ++--
 tests/nvme/040                 | 2 +-
 tests/nvme/041                 | 2 +-
 tests/nvme/042                 | 2 +-
 tests/nvme/043                 | 2 +-
 tests/nvme/044                 | 2 +-
 tests/nvme/045                 | 2 +-
 tests/nvme/047                 | 2 +-
 tests/nvme/048                 | 2 +-
 tests/nvme/rc                  | 1 +
 39 files changed, 46 insertions(+), 40 deletions(-)
Documentation/running-tests.md +3 -0
index 7e827fba7ac0..6b34a253fd97 100644
@@ -104,6 +104,9 @@ The NVMe tests can be additionally parameterized via environment variables.
 
 - nvme_tr_type: 'loop' (default), 'tcp', 'rdma' and 'fc'
   Run the tests with the given transport.
+- nvme_img_size: '1G' (default)
+  Run the tests with given image size in bytes. 'm' and 'g' postfix
+	are supported.
 
 ### Running nvme-rdma nvmeof-mp srp tests
 
tests/nvme/004 +1 -1
index 9dda538b1ac0..cab98ff44326 100755
@@ -25,7 +25,7 @@ test() {
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	local loop_dev
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/005 +1 -1
index de567a74a891..8e15a13f3794 100755
@@ -24,7 +24,7 @@ test() {
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	local loop_dev
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/006 +1 -1
index d993861c06ba..ea0db93791a7 100755
@@ -24,7 +24,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
tests/nvme/007 +1 -1
index d53100f3ff7b..243a79f5a254 100755
@@ -25,7 +25,7 @@ test() {
 
 	file_path="${TMPDIR}/img"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/008 +1 -1
index 5568fe46e463..5abc4240ca46 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/009 +1 -1
index 2814c79164ee..491d3c809ab0 100755
@@ -24,7 +24,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/010 +3 -2
index b7b1d5188e9b..805f80d40620 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
@@ -41,7 +41,8 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1"
+	_run_fio_verify_io --size=${nvme_img_size} \
+		--filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/011 +3 -2
index 4bfe9af084e4..da8cbac11124 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -39,7 +39,8 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1"
+	_run_fio_verify_io --size="${nvme_img_size}" \
+		--filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/012 +1 -1
index c9d24388306d..ecf44fcb5a51 100755
@@ -29,7 +29,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/013 +1 -1
index 265b6968fd34..e249add46295 100755
@@ -28,7 +28,7 @@ test() {
 
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/014 +1 -1
index 875e99eea346..55d920f2660b 100755
@@ -29,7 +29,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/015 +1 -1
index 8cb343e1d31c..071141380e43 100755
@@ -28,7 +28,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		 "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/017 +1 -1
index f2a95cf276cb..0248aee9bc41 100755
@@ -25,7 +25,7 @@ test() {
 
 	file_path="${TMPDIR}/img"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/018 +1 -1
index 315e79534348..78e9b2bb94d8 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		 "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/019 +1 -1
index 4cb3509a12b2..9fff8ccaac9c 100755
@@ -28,7 +28,7 @@ test() {
 	local nblk_range="10,10,10,10,10,10,10,10,10,10"
 	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/020 +1 -1
index 16fdfcc94918..1966d5925213 100755
@@ -26,7 +26,7 @@ test() {
 	local nblk_range="10,10,10,10,10,10,10,10,10,10"
 	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/021 +1 -1
index 6ee0af1fe158..1fefc0fbca00 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/022 +1 -1
index 1d76ffa44178..1ff915786f86 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/023 +1 -1
index b65be07edc38..90316230a3d7 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/024 +1 -1
index f756797d6f29..384a8266e741 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/025 +1 -1
index 941bf36f67fb..815223d1c28d 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/026 +1 -1
index c3f06c2a377c..d2203f19f026 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/027 +1 -1
index 0ad663ace811..97fe70e78344 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/028 +1 -1
index 7de977a81213..c539620bee28 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/029 +2 -1
index f8b4cbbb9156..1808b7b0edf1 100755
@@ -14,6 +14,7 @@ requires() {
 	_nvme_requires
 	_have_loop
 	_require_nvme_trtype_is_fabrics
+	_require_test_dev_size 1M
 }
 
 test_user_io()
@@ -59,7 +60,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/031 +1 -1
index 4e1798246db1..e70898819a86 100755
@@ -33,7 +33,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
tests/nvme/032 +0 -1
index 2e4b7f0760c7..46bbff25e70d 100755
@@ -40,7 +40,6 @@ test_device() {
 	# start fio job
 	_run_fio_rand_io --filename="$TEST_DEV" \
 		--group_reporting --time_based --runtime=-1 &> /dev/null &
-
 	sleep 5
 
 	if [[ ! -d "$sysfs" ]]; then
tests/nvme/034 +1 -1
index f92e5e20865b..e0ede717c373 100755
@@ -26,7 +26,7 @@ test_device() {
 	port=$(_nvmet_passthru_target_setup "${subsys}")
 	nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
 
-	_run_fio_verify_io --size=950m --filename="${nsdev}"
+	_run_fio_verify_io --size="${nvme_img_size}" --filename="${nsdev}"
 
 	_nvme_disconnect_subsys "${subsys}"
 	_nvmet_passthru_target_cleanup "${port}" "${subsys}"
tests/nvme/035 +2 -2
index eb1024edddbf..0896f7bb578d 100755
@@ -17,7 +17,7 @@ requires() {
 }
 
 device_requires() {
-	_require_test_dev_size 1024m
+	_require_test_dev_size "${nvme_img_size}"
 }
 
 test_device() {
@@ -32,7 +32,7 @@ test_device() {
 	port=$(_nvmet_passthru_target_setup "${subsys}")
 	nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
 
-	_xfs_run_fio_verify_io "${nsdev}" "900m"
+	_xfs_run_fio_verify_io "${nsdev}" "${nvme_img_size}"
 
 	_nvme_disconnect_subsys "${subsys}"
 	_nvmet_passthru_target_cleanup "${port}" "${subsys}"
tests/nvme/040 +1 -1
index 05b4f5472ef5..7a8742ec343d 100755
@@ -26,7 +26,7 @@ test() {
 	echo "Running ${TEST_NAME}"
 
 	_setup_nvmet
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/041 +1 -1
index 03e2dab25918..308655dd6090 100755
@@ -44,7 +44,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"b92842df-a394-44b1-84a4-92ae7d112861"
tests/nvme/042 +1 -1
index 4ad726f72f5a..fed2efead013 100755
@@ -41,7 +41,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/043 +1 -1
index c031cecf34a5..a030884aa4ed 100755
@@ -42,7 +42,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/044 +1 -1
index f2406ecadf7d..9928bcc55397 100755
@@ -53,7 +53,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/045 +1 -1
index 612e5f168e3c..7c51da27b5f1 100755
@@ -55,7 +55,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
tests/nvme/047 +1 -1
index d56d3be185b0..b5a8d469a983 100755
@@ -28,7 +28,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/048 +1 -1
index 09e205f69197..81084f0440c2 100755
@@ -84,7 +84,7 @@ test() {
 	fi
 	hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
 
-	truncate -s 512M "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"b92842df-a394-44b1-84a4-92ae7d112861"
tests/nvme/rc +1 -0
index 41f196b037d6..51dde39c2966 100644
@@ -17,6 +17,7 @@ def_local_wwpn="0x20001100aa000002"
 def_hostnqn="$(cat /etc/nvme/hostnqn 2> /dev/null)"
 def_hostid="$(cat /etc/nvme/hostid 2> /dev/null)"
 nvme_trtype=${nvme_trtype:-"loop"}
+nvme_img_size=${nvme_img_size:-"1G"}
 
 _nvme_requires() {
 	_have_program nvme
Signature · 1 line
2.40.0
Reviewed-by on v3 7/12
#19 lore raw

Re: [PATCH blktests v3 07/12] nvme: Make test image size configurable

Quoted 8 lines · Daniel Wagner

The reduce the overall runtime of the testsuite by making the default size of the test image small. For verification jobs, the default can be overwriten via the newly introduced nvme_img_size environment variable.

---

Looks good.

-ck

#20 lore raw

Re: [PATCH blktests v3 07/12] nvme: Make test image size configurable

In reply to Daniel Wagner

Please find three nit comments in line.

Quoted 53 lines · Daniel Wagner

The reduce the overall runtime of the testsuite by making the default size of the test image small. For verification jobs, the default can be overwriten via the newly introduced nvme_img_size environment variable.

---
 Documentation/running-tests.md | 3 +++
 tests/nvme/004                 | 2 +-
 tests/nvme/005                 | 2 +-
 tests/nvme/006                 | 2 +-
 tests/nvme/007                 | 2 +-
 tests/nvme/008                 | 2 +-
 tests/nvme/009                 | 2 +-
 tests/nvme/010                 | 5 +++--
 tests/nvme/011                 | 5 +++--
 tests/nvme/012                 | 2 +-
 tests/nvme/013                 | 2 +-
 tests/nvme/014                 | 2 +-
 tests/nvme/015                 | 2 +-
 tests/nvme/017                 | 2 +-
 tests/nvme/018                 | 2 +-
 tests/nvme/019                 | 2 +-
 tests/nvme/020                 | 2 +-
 tests/nvme/021                 | 2 +-
 tests/nvme/022                 | 2 +-
 tests/nvme/023                 | 2 +-
 tests/nvme/024                 | 2 +-
 tests/nvme/025                 | 2 +-
 tests/nvme/026                 | 2 +-
 tests/nvme/027                 | 2 +-
 tests/nvme/028                 | 2 +-
 tests/nvme/029                 | 3 ++-
 tests/nvme/031                 | 2 +-
 tests/nvme/032                 | 1 -
 tests/nvme/034                 | 2 +-
 tests/nvme/035                 | 4 ++--
 tests/nvme/040                 | 2 +-
 tests/nvme/041                 | 2 +-
 tests/nvme/042                 | 2 +-
 tests/nvme/043                 | 2 +-
 tests/nvme/044                 | 2 +-
 tests/nvme/045                 | 2 +-
 tests/nvme/047                 | 2 +-
 tests/nvme/048                 | 2 +-
 tests/nvme/rc                  | 1 +
 39 files changed, 46 insertions(+), 40 deletions(-)
Documentation/running-tests.md +0 -0
index 7e827fba7ac0..6b34a253fd97 100644

Documentation/running-tests.md The NVMe tests can be additionally parameterized via environment variables. · line 108

Quoted 5 lines
Documentation/running-tests.md +2 -0
@@ -104,6 +104,9 @@ The NVMe tests can be additionally parameterized via environment variables.
 
 - nvme_tr_type: 'loop' (default), 'tcp', 'rdma' and 'fc'
   Run the tests with the given transport.
+- nvme_img_size: '1G' (default)
+  Run the tests with given image size in bytes. 'm' and 'g' postfix

It would be the better to list all of 'm', 'M', 'g' and 'G', since '1G' is the default value.

Quoted 96 lines
Documentation/running-tests.md +1 -0
+	are supported.
 
 ### Running nvme-rdma nvmeof-mp srp tests
 
tests/nvme/004 +1 -1
index 9dda538b1ac0..cab98ff44326 100755
@@ -25,7 +25,7 @@ test() {
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	local loop_dev
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/005 +1 -1
index de567a74a891..8e15a13f3794 100755
@@ -24,7 +24,7 @@ test() {
 	local port
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	local loop_dev
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/006 +1 -1
index d993861c06ba..ea0db93791a7 100755
@@ -24,7 +24,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
tests/nvme/007 +1 -1
index d53100f3ff7b..243a79f5a254 100755
@@ -25,7 +25,7 @@ test() {
 
 	file_path="${TMPDIR}/img"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/008 +1 -1
index 5568fe46e463..5abc4240ca46 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/009 +1 -1
index 2814c79164ee..491d3c809ab0 100755
@@ -24,7 +24,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/010 +1 -1
index b7b1d5188e9b..805f80d40620 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 

tests/nvme/010 test() { · line 44

Quoted 5 lines
tests/nvme/010 +1 -1
@@ -41,7 +41,8 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1"
+	_run_fio_verify_io --size=${nvme_img_size} \

ShellCheck compains no double quotes in the line above.

Quoted 240 lines
tests/nvme/010 +1 -0
+		--filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/011 +3 -2
index 4bfe9af084e4..da8cbac11124 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -39,7 +39,8 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
-	_run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1"
+	_run_fio_verify_io --size="${nvme_img_size}" \
+		--filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/012 +1 -1
index c9d24388306d..ecf44fcb5a51 100755
@@ -29,7 +29,7 @@ test() {
 	local file_path="${TMPDIR}/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/013 +1 -1
index 265b6968fd34..e249add46295 100755
@@ -28,7 +28,7 @@ test() {
 
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/014 +1 -1
index 875e99eea346..55d920f2660b 100755
@@ -29,7 +29,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/015 +1 -1
index 8cb343e1d31c..071141380e43 100755
@@ -28,7 +28,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		 "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/017 +1 -1
index f2a95cf276cb..0248aee9bc41 100755
@@ -25,7 +25,7 @@ test() {
 
 	file_path="${TMPDIR}/img"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/018 +1 -1
index 315e79534348..78e9b2bb94d8 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		 "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/019 +1 -1
index 4cb3509a12b2..9fff8ccaac9c 100755
@@ -28,7 +28,7 @@ test() {
 	local nblk_range="10,10,10,10,10,10,10,10,10,10"
 	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/020 +1 -1
index 16fdfcc94918..1966d5925213 100755
@@ -26,7 +26,7 @@ test() {
 	local nblk_range="10,10,10,10,10,10,10,10,10,10"
 	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/021 +1 -1
index 6ee0af1fe158..1fefc0fbca00 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/022 +1 -1
index 1d76ffa44178..1ff915786f86 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/023 +1 -1
index b65be07edc38..90316230a3d7 100755
@@ -26,7 +26,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/024 +1 -1
index f756797d6f29..384a8266e741 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/025 +1 -1
index 941bf36f67fb..815223d1c28d 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/026 +1 -1
index c3f06c2a377c..d2203f19f026 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/027 +1 -1
index 0ad663ace811..97fe70e78344 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/028 +1 -1
index 7de977a81213..c539620bee28 100755
@@ -25,7 +25,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
 		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
tests/nvme/029 +0 -0
index f8b4cbbb9156..1808b7b0edf1 100755

tests/nvme/029 requires() { · line 17

Quoted 4 lines
tests/nvme/029 +1 -0
@@ -14,6 +14,7 @@ requires() {
 	_nvme_requires
 	_have_loop
 	_require_nvme_trtype_is_fabrics
+	_require_test_dev_size 1M

The line above is added here, and removed in the next patch. I suppose these are left over from the working code.

Quoted 30 lines
tests/nvme/029 +1 -1
 }
 
 test_user_io()
@@ -59,7 +60,7 @@ test() {
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
-	truncate -s 1G "${file_path}"
+	truncate -s "${nvme_img_size}" "${file_path}"
 
 	loop_dev="$(losetup -f --show "${file_path}")"
 
tests/nvme/031 +1 -1
index 4e1798246db1..e70898819a86 100755
@@ -33,7 +33,7 @@ test() {
 
 	_setup_nvmet
 
-	truncate -s 1G "$TMPDIR/img"
+	truncate -s "${nvme_img_size}" "$TMPDIR/img"
 
 	loop_dev="$(losetup -f --show "$TMPDIR/img")"
 
tests/nvme/032 +0 -0
index 2e4b7f0760c7..46bbff25e70d 100755

tests/nvme/032 test_device() { · line 45

Quoted 7 lines
tests/nvme/032 +0 -1
@@ -40,7 +40,6 @@ test_device() {
 	# start fio job
 	_run_fio_rand_io --filename="$TEST_DEV" \
 		--group_reporting --time_based --runtime=-1 &> /dev/null &
-
 	sleep 5
 
 	if [[ ! -d "$sysfs" ]]; then

The hunk above does not look required.

#21 lore raw

PATCH v3 8/12 nvme/rc: Add minimal test image size requirement

In reply to Daniel Wagner

Some tests need a minimal test image size to work correctly. Thus add a helper to check the size and update these tests accordingly.

The image minimum is 4M because some of the test have hard coded values. All tests which use the xfs fio verification job have a minimum requirement of 350M impossed by the xfs filesystem.

---
 tests/nvme/012 |  1 +
 tests/nvme/013 |  1 +
 tests/nvme/029 |  1 -
 tests/nvme/045 |  2 +-
 tests/nvme/rc  | 15 +++++++++++++++
 5 files changed, 18 insertions(+), 2 deletions(-)
tests/nvme/012 +1 -0
index ecf44fcb5a51..efe227538c57 100755
@@ -16,6 +16,7 @@ requires() {
 	_have_fio
 	_have_loop
 	_require_nvme_trtype_is_fabrics
+	_require_nvme_test_img_size 350m
 }
 
 test() {
tests/nvme/013 +1 -0
index e249add46295..14e646a19c47 100755
@@ -15,6 +15,7 @@ requires() {
 	_have_xfs
 	_have_fio
 	_require_nvme_trtype_is_fabrics
+	_require_nvme_test_img_size 350m
 }
 
 test() {
tests/nvme/029 +0 -1
index 1808b7b0edf1..c6d38b42af70 100755
@@ -14,7 +14,6 @@ requires() {
 	_nvme_requires
 	_have_loop
 	_require_nvme_trtype_is_fabrics
-	_require_test_dev_size 1M
 }
 
 test_user_io()
tests/nvme/045 +1 -1
index 7c51da27b5f1..99012f6bed8f 100755
@@ -120,7 +120,7 @@ test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_run_fio_rand_io --size=8m --filename="/dev/${nvmedev}n1"
+	_run_fio_rand_io --size=4m --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/rc +15 -0
index 51dde39c2966..0b4d5f6570d6 100644
@@ -21,6 +21,7 @@ nvme_img_size=${nvme_img_size:-"1G"}
 
 _nvme_requires() {
 	_have_program nvme
+	_require_nvme_test_img_size 4m
 	case ${nvme_trtype} in
 	loop)
 		_have_driver nvme-loop
@@ -94,6 +95,20 @@ _require_test_dev_is_nvme() {
 	return 0
 }
 
+_require_nvme_test_img_size() {
+	local require_sz_mb
+	local nvme_img_size_mb
+
+	require_sz_mb="$(convert_to_mb "$1")"
+	nvme_img_size_mb="$(convert_to_mb "${nvme_img_size}")"
+
+	if (( "${nvme_img_size_mb}" < "$require_sz_mb" )); then
+		SKIP_REASONS+=("nvme_img_size must be at least ${require_sz_mb}m")
+		return 1
+	fi
+	return 0
+}
+
 _require_nvme_trtype() {
 	local trtype
 	for trtype in "$@"; do
Signature · 1 line
2.40.0
Reviewed-by on v3 8/12
#22 lore raw

Re: [PATCH blktests v3 08/12] nvme/rc: Add minimal test image size requirement

Quoted 12 lines · Daniel Wagner

Some tests need a minimal test image size to work correctly. Thus add a helper to check the size and update these tests accordingly.

The image minimum is 4M because some of the test have hard coded values. All tests which use the xfs fio verification job have a minimum requirement of 350M impossed by the xfs filesystem.

---
  tests/nvme/012 |  1 +

thanks for documenting minimum limit imposed by fio, look good.

-ck

#23 lore raw

Re: [PATCH blktests v3 08/12] nvme/rc: Add minimal test image size requirement

In reply to Daniel Wagner

Nit: the commit title subject can be "nvme: " since it touches both nvme/rc and nvme test cases.

Quoted 46 lines · Daniel Wagner

Some tests need a minimal test image size to work correctly. Thus add a helper to check the size and update these tests accordingly.

The image minimum is 4M because some of the test have hard coded values. All tests which use the xfs fio verification job have a minimum requirement of 350M impossed by the xfs filesystem.

---
 tests/nvme/012 |  1 +
 tests/nvme/013 |  1 +
 tests/nvme/029 |  1 -
 tests/nvme/045 |  2 +-
 tests/nvme/rc  | 15 +++++++++++++++
 5 files changed, 18 insertions(+), 2 deletions(-)
tests/nvme/012 +1 -0
index ecf44fcb5a51..efe227538c57 100755
@@ -16,6 +16,7 @@ requires() {
 	_have_fio
 	_have_loop
 	_require_nvme_trtype_is_fabrics
+	_require_nvme_test_img_size 350m
 }
 
 test() {
tests/nvme/013 +1 -0
index e249add46295..14e646a19c47 100755
@@ -15,6 +15,7 @@ requires() {
 	_have_xfs
 	_have_fio
 	_require_nvme_trtype_is_fabrics
+	_require_nvme_test_img_size 350m
 }
 
 test() {
tests/nvme/029 +0 -0
index 1808b7b0edf1..c6d38b42af70 100755

tests/nvme/029 requires() { · line 17

Quoted 4 lines
tests/nvme/029 +0 -1
@@ -14,7 +14,6 @@ requires() {
 	_nvme_requires
 	_have_loop
 	_require_nvme_trtype_is_fabrics
-	_require_test_dev_size 1M

As I mentioned for the previous patch, this line was added and removed.

Quoted 30 lines
tests/nvme/029 +0 -0
 }
 
 test_user_io()
tests/nvme/045 +1 -1
index 7c51da27b5f1..99012f6bed8f 100755
@@ -120,7 +120,7 @@ test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_run_fio_rand_io --size=8m --filename="/dev/${nvmedev}n1"
+	_run_fio_rand_io --size=4m --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/rc +1 -0
index 51dde39c2966..0b4d5f6570d6 100644
@@ -21,6 +21,7 @@ nvme_img_size=${nvme_img_size:-"1G"}
 
 _nvme_requires() {
 	_have_program nvme
+	_require_nvme_test_img_size 4m
 	case ${nvme_trtype} in
 	loop)
 		_have_driver nvme-loop
@@ -94,6 +95,20 @@ _require_test_dev_is_nvme() {
 	return 0

tests/nvme/rc _require_test_dev_is_nvme() { · line 105

Quoted 10 lines
tests/nvme/rc +8 -0
 }
 
+_require_nvme_test_img_size() {
+	local require_sz_mb
+	local nvme_img_size_mb
+
+	require_sz_mb="$(convert_to_mb "$1")"
+	nvme_img_size_mb="$(convert_to_mb "${nvme_img_size}")"
+
+	if (( "${nvme_img_size_mb}" < "$require_sz_mb" )); then

FYI, in bash arithmetic operation (( )), we don't need to add "${}" for variables. Code below should work.

if ((nvme_img_size_mb < require_sz_mb)); then

Quoted 12 lines
tests/nvme/rc +6 -0
+		SKIP_REASONS+=("nvme_img_size must be at least ${require_sz_mb}m")
+		return 1
+	fi
+	return 0
+}
+
 _require_nvme_trtype() {
 	local trtype
 	for trtype in "$@"; do
Signature · 1 line
2.40.0
#24 lore raw

PATCH v3 9/12 common/fio: Limit number of random jobs

In reply to Daniel Wagner

Limit the number of random threads to 32 for big machines. This still gives enough randomness but limits the resource usage.

---
 common/fio | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
common/fio +2 -1
index 1db6128be632..06659d7d1d84 100644
@@ -189,7 +189,8 @@ _run_fio() {
 # Wrapper around _run_fio used if you need some I/O but don't really care much
 # about the details
 _run_fio_rand_io() {
-	_run_fio --bs=4k --rw=randread --norandommap --numjobs="$(nproc)" \
+	_run_fio --bs=4k --rw=randread --norandommap \
+		--numjobs="$(OMP_THREAD_LIMIT=32 nproc)" \
 		--name=reads --direct=1 "$@"
 }
 
Signature · 1 line
2.40.0
#25 lore raw

Re: [PATCH blktests v3 09/12] common/fio: Limit number of random jobs

Quoted 5 lines · Daniel Wagner

Limit the number of random threads to 32 for big machines. This still gives enough randomness but limits the resource usage.

---

I don't think we should change this, the point of all the tests is to not limit the resources but use threads at least equal to $(nproc), see recent patches from lenovo they have 448 cores, limiting 32 is < 10% CPUs and that is really small number for a large machine if we decide to run tests on that machine ...

-ck

#26 lore raw

Re: [PATCH blktests v3 09/12] common/fio: Limit number of random jobs

Quoted 4 lines · Chaitanya Kulkarni
Quoted 3 lines · Daniel Wagner

Limit the number of random threads to 32 for big machines. This still gives enough randomness but limits the resource usage.

Quoted 8 lines
Quoted 2 lines

---

I don't think we should change this, the point of all the tests is to not limit the resources but use threads at least equal to $(nproc), see recent patches from lenovo they have 448 cores, limiting 32 is < 10% CPUs and that is really small number for a large machine if we decide to run tests on that machine ...

I just wonder how handle the limits for the job size. Hannes asked to limit it to 32 CPUs so that the job size doesn't get small, e.g. nvme_img_size=16M job size per job with 448 CPUs is roughly 36kB. Is this good, bad or does it even make sense? I don't know.

My question is what should the policy be? Should we reject configuration which try to run too small jobs sizes? Reject anything below 1M for example? Or is there a metric which we could as base for a limit calculation (disk geometry)?

#27 lore raw

Re: [PATCH blktests v3 09/12] common/fio: Limit number of random jobs

Quoted 12 lines · Daniel Wagner
Quoted 11 lines · Chaitanya Kulkarni
Quoted 5 lines · Daniel Wagner

Limit the number of random threads to 32 for big machines. This still gives enough randomness but limits the resource usage.

---

I don't think we should change this, the point of all the tests is to not limit the resources but use threads at least equal to $(nproc), see recent patches from lenovo they have 448 cores, limiting 32 is < 10% CPUs and that is really small number for a large machine if we decide to run tests on that machine ...

Quoted 4 lines

I just wonder how handle the limits for the job size. Hannes asked to limit it to 32 CPUs so that the job size doesn't get small, e.g. nvme_img_size=16M job size per job with 448 CPUs is roughly 36kB. Is this good, bad or does it even make sense? I don't know.

16M is very small number ..

from my experience with smaller I/O sizes we don't see the lokdeps that we see with the large I/O sizes hence it is a bad idea to use small I/O sizes and limiting the jobs to hard coded 32 number ...

Quoted 3 lines

My question is what should the policy be? Should we reject configuration which try to run too small jobs sizes? Reject anything below 1M for example? Or is there a metric which we could as base for a limit calculation (disk geometry)?

the basic requirement here is we need to run the I/O from every processor, so let's keep --numjobs=($nproc) constant now and let the user set job size..
in this particular case for NVMe we set the size 1G and that is sufficient since
numbjobs are set to nproc and with this series user can set the size based on
a particular arch ...

See [1] if you are interested in how to quantify small or large job size.

For this series to merge let's keep is simple and not worry about erroring out on a particular job size but just keeping the nproc as it is ...

-ck

Ideally in past what I've done is  :-
1. Accept the % of the CPU cores that we want to keep it busy.
2. Accept the % of the disk space we want to exercise test.
3. Use the combination of the #1 and #2 to spread out the job size across the number of jobs.

with above design one doesn't have to assume what is small or what it large job size and system gets tested according to user's expectations such as 50% CPUs are busy on 80% disk size or 100% CPUs are busy with 50% of disk size.

#28 lore raw

Re: [PATCH blktests v3 09/12] common/fio: Limit number of random jobs

Quoted 2 lines · Chaitanya Kulkarni

For this series to merge let's keep is simple and not worry about erroring out on a particular job size but just keeping the nproc as it is ...

Works for me and as you pointed out, it avoids regressions with the default values. Anyone who is tinkering with nvme_img_size should be aware of the implications. I'll add a note about this to the documentation.

#29 lore raw

PATCH v3 10/12 nvme/rc: Calculate IO size for random fio jobs

In reply to Daniel Wagner

_nvme_calc_run_io_size() returns the jobs size for _run_fio_rand_io() function. The jobs size is the size per job, thus we have to divide through the number of CPUs.

---
 tests/nvme/045 |  4 +++-
 tests/nvme/047 |  6 ++++--
 tests/nvme/rc  | 10 ++++++++++
 3 files changed, 17 insertions(+), 3 deletions(-)
tests/nvme/045 +3 -1
index 99012f6bed8f..f50087cccb6a 100755
@@ -31,6 +31,7 @@ test() {
 	local ctrlkey
 	local new_ctrlkey
 	local ctrldev
+	local rand_io_size
 
 	echo "Running ${TEST_NAME}"
 
@@ -120,7 +121,8 @@ test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_run_fio_rand_io --size=4m --filename="/dev/${nvmedev}n1"
+	rand_io_size="$(_nvme_calc_rand_io_size 4m)"
+	_run_fio_rand_io --size="${rand_io_size}" --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/047 +4 -2
index b5a8d469a983..6a7599bc2e91 100755
@@ -25,6 +25,7 @@ test() {
 	local port
 	local nvmedev
 	local loop_dev
+	local rand_io_size
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 
@@ -42,7 +43,8 @@ test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_xfs_run_fio_verify_io /dev/"${nvmedev}n1" "1m" || echo FAIL
+	rand_io_size="$(_nvme_calc_rand_io_size 4M)"
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}"
 
 	_nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1
 
@@ -50,7 +52,7 @@ test() {
 		--nr-write-queues 1 \
 		--nr-poll-queues 1 || echo FAIL
 
-	_xfs_run_fio_verify_io /dev/"${nvmedev}n1" "1m" || echo FAIL
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}"
 
 	_nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1
 
tests/nvme/rc +10 -0
index 0b4d5f6570d6..268418e5b3e0 100644
@@ -150,6 +150,16 @@ _test_dev_nvme_nsid() {
 	cat "${TEST_DEV_SYSFS}/nsid"
 }
 
+_nvme_calc_rand_io_size() {
+	local img_size_mb
+	local io_size_kb
+
+	img_size_mb="$(convert_to_mb "$1")"
+	io_size_kb="$(((img_size_mb * 1024) / $(OMP_THREAD_LIMIT=32 nproc)))"
+
+	echo "${io_size_kb}k"
+}
+
 _nvme_fcloop_add_rport() {
 	local local_wwnn="$1"
 	local local_wwpn="$2"
Signature · 1 line
2.40.0
#30 lore raw

Re: [PATCH blktests v3 10/12] nvme/rc: Calculate IO size for random fio jobs

The commit title prefix could be "nvme: ". And please find a question in line.

Quoted 46 lines · Daniel Wagner

_nvme_calc_run_io_size() returns the jobs size for _run_fio_rand_io() function. The jobs size is the size per job, thus we have to divide through the number of CPUs.

---
 tests/nvme/045 |  4 +++-
 tests/nvme/047 |  6 ++++--
 tests/nvme/rc  | 10 ++++++++++
 3 files changed, 17 insertions(+), 3 deletions(-)
tests/nvme/045 +3 -1
index 99012f6bed8f..f50087cccb6a 100755
@@ -31,6 +31,7 @@ test() {
 	local ctrlkey
 	local new_ctrlkey
 	local ctrldev
+	local rand_io_size
 
 	echo "Running ${TEST_NAME}"
 
@@ -120,7 +121,8 @@ test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_run_fio_rand_io --size=4m --filename="/dev/${nvmedev}n1"
+	rand_io_size="$(_nvme_calc_rand_io_size 4m)"
+	_run_fio_rand_io --size="${rand_io_size}" --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
tests/nvme/047 +1 -0
index b5a8d469a983..6a7599bc2e91 100755
@@ -25,6 +25,7 @@ test() {
 	local port
 	local nvmedev
 	local loop_dev
+	local rand_io_size
 	local file_path="$TMPDIR/img"
 	local subsys_name="blktests-subsystem-1"
 

tests/nvme/047 test() { · line 47

Quoted 6 lines
tests/nvme/047 +2 -1
@@ -42,7 +43,8 @@ test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_xfs_run_fio_verify_io /dev/"${nvmedev}n1" "1m" || echo FAIL
+	rand_io_size="$(_nvme_calc_rand_io_size 4M)"
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}"

Here, _xfs_run_fio_verify_io is replaced with _run_fio_rand_io. May I confirm that this replacement does not affect this test case? Same question for the hunk below.

Quoted 37 lines
tests/nvme/047 +1 -1
 	_nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1
 
@@ -50,7 +52,7 @@ test() {
 		--nr-write-queues 1 \
 		--nr-poll-queues 1 || echo FAIL
 
-	_xfs_run_fio_verify_io /dev/"${nvmedev}n1" "1m" || echo FAIL
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}"
 
 
 	_nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1
tests/nvme/rc +10 -0
index 0b4d5f6570d6..268418e5b3e0 100644
@@ -150,6 +150,16 @@ _test_dev_nvme_nsid() {
 	cat "${TEST_DEV_SYSFS}/nsid"
 }
 
+_nvme_calc_rand_io_size() {
+	local img_size_mb
+	local io_size_kb
+
+	img_size_mb="$(convert_to_mb "$1")"
+	io_size_kb="$(((img_size_mb * 1024) / $(OMP_THREAD_LIMIT=32 nproc)))"
+
+	echo "${io_size_kb}k"
+}
+
 _nvme_fcloop_add_rport() {
 	local local_wwnn="$1"
 	local local_wwpn="$2"
Signature · 1 line
2.40.0
#31 lore raw

Re: [PATCH blktests v3 10/12] nvme/rc: Calculate IO size for random fio jobs

Quoted 7 lines · Shinichiro Kawasaki
(quoted diff) +0 -1
-	_xfs_run_fio_verify_io /dev/"${nvmedev}n1" "1m" || echo FAIL

tests/nvme/047 test() { · line 47

Quoted 2 lines
tests/nvme/047 +2 -0
+	rand_io_size="$(_nvme_calc_rand_io_size 4M)"
+	_run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}"

Here, _xfs_run_fio_verify_io is replaced with _run_fio_rand_io. May I confirm that this replacement does not affect this test case? Same question for the hunk below.

This is on purpose. The test just wants only verify that IO is still working. Because _xfs_run_fio_verify_io has the minimum requirement of 350M for nvme_img_size. When I wrote the test I didn't know this and thus this change.

I'll update the commit message to include this info.

#32 lore raw

PATCH v3 11/12 nvme/rc: Move discovery generation counter code to rc

In reply to Daniel Wagner

Move the discovery generation counter code to rc so that we can reuse it in 002.

---
 tests/nvme/002     |    4 +-
 tests/nvme/002.out | 3004 --------------------------------------------
 tests/nvme/030     |   22 +-
 tests/nvme/rc      |   13 +
 4 files changed, 20 insertions(+), 3023 deletions(-)
tests/nvme/002 +3 -1
index 6c6ae5fea89b..6b8484844b4d 100755
@@ -27,12 +27,14 @@ test() {
 	local loop_dev
 	loop_dev="$(losetup -f)"
 
+	local genctr=1
+
 	for ((i = 0; i < iterations; i++)); do
 		_create_nvmet_subsystem "blktests-subsystem-$i" "${loop_dev}"
 		_add_nvmet_subsys_to_port "${port}" "blktests-subsystem-$i"
 	done
 
-	_nvme_discover "${nvme_trtype}" | _filter_discovery
+	genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port")
 
 	for ((i = iterations - 1; i >= 0; i--)); do
 		_remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-$i"
tests/nvme/002.out +0 -3004

2,985 lines not on this page · raw message

tests/nvme/030 +4 -18
index 20fef696e565..cfcdcbe6be23 100755

Lines of this file are not shown. View the raw message.

tests/nvme/rc +13 -0
index 268418e5b3e0..a14458d5b80f 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.40.0

Part of the diff is not shown here. View the raw message.

#33 lore raw

Re: [PATCH blktests v3 11/12] nvme/rc: Move discovery generation counter code to rc

Quoted 2 lines · Daniel Wagner

Move the discovery generation counter code to rc so that we can reuse it in 002.

The last #12 patch no longer touches nvme/002, then I'm not so sure this patch is valuable. IMO, the lengthy 002.out has the role to check all of the 1000 times discoveries are successful. So it looks the better to keep current nvme/002 as is.

#34 lore raw

Re: [PATCH blktests v3 11/12] nvme/rc: Move discovery generation counter code to rc

Quoted 8 lines · Shinichiro Kawasaki
Quoted 2 lines · Daniel Wagner

Move the discovery generation counter code to rc so that we can reuse it in 002.

The last #12 patch no longer touches nvme/002, then I'm not so sure this patch is valuable. IMO, the lengthy 002.out has the role to check all of the 1000 times discoveries are successful. So it looks the better to keep current nvme/002 as is.

While we don't update the counter anymore, I still think it's worthwhile to do some cleanup. We have two tests which do the same thing so why not use common code?

#35 lore raw

Re: [PATCH blktests v3 11/12] nvme/rc: Move discovery generation counter code to rc

Quoted 5 lines · Daniel Wagner
Quoted 4 lines · Shinichiro Kawasaki
Quoted 2 lines · Daniel Wagner

Move the discovery generation counter code to rc so that we can reuse it in 002.

Quoted 8 lines
Quoted 4 lines

The last #12 patch no longer touches nvme/002, then I'm not so sure this patch is valuable. IMO, the lengthy 002.out has the role to check all of the 1000 times discoveries are successful. So it looks the better to keep current nvme/002 as is.

While we don't update the counter anymore, I still think it's worthwhile to do some cleanup. We have two tests which do the same thing so why not use common code?

Now nvme/002 checks 1000 discovery logs, and nvme/030 doesn't. For the common code clean up, this patch removes the 1000 logs check from nvme/002. It looks for me the check to remove has some value. Do you think the check is meaningless?

#36 lore raw

PATCH v3 12/12 nvme: Make the number iterations configurable

In reply to Daniel Wagner

Some tests hard code high values of iterations. This makes them run relatively long compared to the other tests. Introduce a new environment variable nvme_num_iter to allow tune the runtime.

---
 Documentation/running-tests.md | 2 ++
 tests/nvme/016                 | 2 +-
 tests/nvme/017                 | 2 +-
 tests/nvme/rc                  | 1 +
 4 files changed, 5 insertions(+), 2 deletions(-)
Documentation/running-tests.md +2 -0
index 6b34a253fd97..243975e43583 100644
@@ -107,6 +107,8 @@ The NVMe tests can be additionally parameterized via environment variables.
 - nvme_img_size: '1G' (default)
   Run the tests with given image size in bytes. 'm' and 'g' postfix
 	are supported.
+- nvme_num_iter: 1000 (default)
+  The number of iterations a test should do.
 
 ### Running nvme-rdma nvmeof-mp srp tests
 
tests/nvme/016 +1 -1
index 4eba30223a08..c0c31a55b190 100755
@@ -17,7 +17,7 @@ test() {
 	echo "Running ${TEST_NAME}"
 
 	local port
-	local iterations=1000
+	local iterations="${nvme_num_iter}"
 	local loop_dev
 	local subsys_nqn="blktests-subsystem-1"
 
tests/nvme/017 +1 -1
index 0248aee9bc41..e1674508f654 100755
@@ -18,7 +18,7 @@ test() {
 
 	local port
 	local file_path
-	local iterations=1000
+	local iterations="${nvme_num_iter}"
 	local subsys_name="blktests-subsystem-1"
 
 	_setup_nvmet
tests/nvme/rc +1 -0
index a14458d5b80f..76ca683a40b4 100644
@@ -18,6 +18,7 @@ def_hostnqn="$(cat /etc/nvme/hostnqn 2> /dev/null)"
 def_hostid="$(cat /etc/nvme/hostid 2> /dev/null)"
 nvme_trtype=${nvme_trtype:-"loop"}
 nvme_img_size=${nvme_img_size:-"1G"}
+nvme_num_iter=${nvme_num_iter:-"1000"}
 
 _nvme_requires() {
 	_have_program nvme
Signature · 1 line
2.40.0
Reviewed-by on v3 12/12
#37 lore raw

Re: [PATCH blktests v3 12/12] nvme: Make the number iterations configurable

Quoted 8 lines · Daniel Wagner

Some tests hard code high values of iterations. This makes them run relatively long compared to the other tests. Introduce a new environment variable nvme_num_iter to allow tune the runtime.

---
D

Looks good.

-ck