[PATCH blktests V3] nvme: add nvme pci timeout testcase

Shinichiro Kawasaki shinichiro.kawasaki at wdc.com
Mon Jan 29 03:57:35 PST 2024


On Jan 29, 2024 / 11:13, Chaitanya Kulkarni wrote:
> On 1/23/24 14:55, Chaitanya Kulkarni wrote:
> > Trigger and test nvme-pci timeout with concurrent fio jobs.
> >
> > Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
> > ---
> > V3:-
> >
> > 1. Add CAN_BE_ZONED.
> > 2. Add FAULT_INJECTION_DEBUG_FS check in requires.
> > 3. Remove _require_nvme_trtype pci in requires().
> > 4. Remove device_requires().
> > 5. Store fio output in FULL.
> > 6. Revmoe shellcheck and use grep I/O error value to pass/fail testcase.
> >
> > ---
> >
> 
> is there any objections on this patch ?

Thanks for the V3 patch. It looks almost good, except one thing: as I commented
on V1 and V2, this test case often leaves the target NVME device with zero size.
It will make the following test cases fail (I mean the future test cases to be
added).

I suggest to remove and rescan the device to regain the good status of the
device. The following change will do it. What do you think?

(If we take this change as it is, it will recover the io_timeout_fail sysfs
attribute also, so the code to save and restore io_timeout_fail can be removed.)

diff --git a/tests/nvme/050 b/tests/nvme/050
index cacaba6..cb1c6f5 100755
--- a/tests/nvme/050
+++ b/tests/nvme/050
@@ -41,9 +41,12 @@ restore_fi_settings() {
 test_device() {
 	local nvme_ns
 	local io_fimeout_fail
+	local pdev
 
 	echo "Running ${TEST_NAME}"
 
+	pdev=$(_get_pci_dev_from_blkdev)
+
 	nvme_ns="$(basename "${TEST_DEV}")"
 	io_fimeout_fail="$(cat /sys/block/"${nvme_ns}"/io-timeout-fail)"
 	save_fi_settings
@@ -66,4 +69,11 @@ test_device() {
 	fi
 	restore_fi_settings
 	echo "${io_fimeout_fail}" > /sys/block/"${nvme_ns}"/io-timeout-fail
+
+	# Remove and rescan the NVME device to ensure that it has come back
+	echo 1 > "/sys/bus/pci/devices/$pdev/remove"
+	echo 1 > /sys/bus/pci/rescan
+	if [[ ! -b $TEST_DEV ]]; then
+		echo "Failed to regain $TEST_DEV"
+	fi
 }



More information about the Linux-nvme mailing list