[PATCH] nvme: add nvme pci timeout testcase

Nitesh Shetty nj.shetty at samsung.com
Tue Jan 9 22:17:19 PST 2024


On 09/01/24 07:57PM, Chaitanya Kulkarni wrote:
>Trigger and test nvme-pci timeout with concurrent fio jobs.
>
>Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
>---
> tests/nvme/050     | 43 +++++++++++++++++++++++++++++++++++++++++++
> tests/nvme/050.out |  2 ++
> 2 files changed, 45 insertions(+)
> create mode 100755 tests/nvme/050
> create mode 100644 tests/nvme/050.out
>
>diff --git a/tests/nvme/050 b/tests/nvme/050
>new file mode 100755
>index 0000000..ba54bcd
>--- /dev/null
>+++ b/tests/nvme/050
>@@ -0,0 +1,43 @@
>+#!/bin/bash
>+# SPDX-License-Identifier: GPL-3.0+
>+# Copyright (C) 2024 Chaitanya Kulkarni.
>+#
>+# Test NVMe-PCI timeout with FIO jobs by triggering the nvme_timeout function.
>+#
>+
>+. tests/nvme/rc
>+
>+DESCRIPTION="test nvme-pci timeout with fio jobs."
>+
>+requires() {
>+	_require_nvme_trtype pci
>+	_have_fio
>+	_nvme_requires
>+}
>+
>+test() {
>+	local dev="/dev/nvme0n1"

Should this be TEST_DEV instead ?

>+
>+	echo "Running ${TEST_NAME}"
>+
>+	echo 1 > /sys/block/nvme0n1/io-timeout-fail

nvme0n1, I think this hard coding can be changed

>+
>+	echo 99 > /sys/kernel/debug/fail_io_timeout/probability
>+	echo 10 > /sys/kernel/debug/fail_io_timeout/interval
>+	echo -1 > /sys/kernel/debug/fail_io_timeout/times
>+	echo  0 > /sys/kernel/debug/fail_io_timeout/space
>+	echo  1 > /sys/kernel/debug/fail_io_timeout/verbose
>+
>+	# shellcheck disable=SC2046
>+	fio --bs=4k --rw=randread --norandommap --numjobs=$(nproc) \
>+	    --name=reads --direct=1 --filename=${dev} --group_reporting \
>+	    --time_based --runtime=1m 2>&1 | grep -q "Input/output error"
>+
>+	# shellcheck disable=SC2181
>+	if [ $? -eq 0 ]; then
>+		echo "Test complete"
>+	else
>+		echo "Test failed"
>+	fi
>+	modprobe -r nvme
>+}
>diff --git a/tests/nvme/050.out b/tests/nvme/050.out
>new file mode 100644
>index 0000000..b78b05f
>--- /dev/null
>+++ b/tests/nvme/050.out
>@@ -0,0 +1,2 @@
>+Running nvme/050
>+Test complete
>-- 
>2.40.0
>


-- Nitesh Shetty


More information about the Linux-nvme mailing list