* [PATCH V3 blktests] nvme: Add new test case about nvme rescan/reset/remove during IO
@ 2019-09-11 8:53 Yi Zhang
2019-09-11 20:43 ` Chaitanya Kulkarni
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yi Zhang @ 2019-09-11 8:53 UTC (permalink / raw)
To: linux-block; +Cc: osandov, Chaitanya.Kulkarni, ming.lei
Add one test to cover NVMe SSD rescan/reset/remove operation during
IO, the steps found several issues during my previous testing, check
them here:
http://lists.infradead.org/pipermail/linux-nvme/2017-February/008358.html
http://lists.infradead.org/pipermail/linux-nvme/2017-May/010259.html
Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
---
changes from v2:
- add check_sysfs function for rescan/reset/remove operation
- declare all local variables at the start
- alignment fix
- add udevadm settle
- change to QUICK=1
changes from v1:
- add variable for "/sys/bus/pci/devices/${pdev}"
- add kill $!; wait; for background fio
- add rescan/reset/remove sysfs node check
- add loop checking for nvme reinitialized
---
---
tests/nvme/031 | 75 ++++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/031.out | 2 ++
2 files changed, 77 insertions(+)
create mode 100755 tests/nvme/031
create mode 100644 tests/nvme/031.out
diff --git a/tests/nvme/031 b/tests/nvme/031
new file mode 100755
index 0000000..31db8a5
--- /dev/null
+++ b/tests/nvme/031
@@ -0,0 +1,75 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2019 Yi Zhang <yi.zhang@redhat.com>
+#
+# Test nvme pci adapter rescan/reset/remove operation during I/O
+#
+# Regression test for bellow two commits:
+# http://lists.infradead.org/pipermail/linux-nvme/2017-May/010367.html
+# 986f75c876db nvme: avoid to use blk_mq_abort_requeue_list()
+# 806f026f9b90 nvme: use blk_mq_start_hw_queues() in nvme_kill_queues()
+
+. tests/nvme/rc
+
+DESCRIPTION="test nvme pci adapter rescan/reset/remove during I/O"
+QUICK=1
+
+requires() {
+ _have_fio
+}
+
+device_requires() {
+ _test_dev_is_nvme
+}
+
+check_sysfs()
+{
+ local sysfs_attr="$sysfs/$1"
+
+ if [[ -f "$sysfs_attr" ]]; then
+ echo 1 > "${sysfs_attr}"
+ else
+ # QEMU VM doesn't have the "reset" attribute, skip it
+ [[ "$sysfs_attr" == *reset ]] && return
+ echo "${sysfs_attr} doesn't exist!"
+ fi
+}
+
+test_device() {
+ echo "Running ${TEST_NAME}"
+
+ local sysfs
+ local m
+
+ pdev="$(_get_pci_dev_from_blkdev)"
+ sysfs="/sys/bus/pci/devices/${pdev}"
+
+ # start fio job
+ _run_fio_rand_io --filename="$TEST_DEV" --size=1g \
+ --group_reporting &> /dev/null &
+
+ sleep 5
+
+ # do rescan/reset/remove operation
+ for i in rescan reset remove; do
+ check_sysfs $i
+ done
+
+ { kill $!; wait; } &> /dev/null
+
+ echo 1 > /sys/bus/pci/rescan
+
+ # wait nvme reinitialized
+ for ((m = 0; m < 10; m++)); do
+ if [[ -b "${TEST_DEV}" ]]; then
+ break
+ fi
+ sleep 0.5
+ done
+ if (( m > 9 )); then
+ echo "nvme still not reinitialized after 5 seconds!"
+ fi
+ udevadm settle
+
+ echo "Test complete"
+}
diff --git a/tests/nvme/031.out b/tests/nvme/031.out
new file mode 100644
index 0000000..ae902bd
--- /dev/null
+++ b/tests/nvme/031.out
@@ -0,0 +1,2 @@
+Running nvme/031
+Test complete
--
2.17.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V3 blktests] nvme: Add new test case about nvme rescan/reset/remove during IO
2019-09-11 8:53 [PATCH V3 blktests] nvme: Add new test case about nvme rescan/reset/remove during IO Yi Zhang
@ 2019-09-11 20:43 ` Chaitanya Kulkarni
2019-09-12 0:09 ` Ming Lei
2019-10-15 23:21 ` Omar Sandoval
2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-09-11 20:43 UTC (permalink / raw)
To: Yi Zhang, linux-block; +Cc: osandov, ming.lei
Looks good.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
On 09/11/2019 01:54 AM, Yi Zhang wrote:
> Add one test to cover NVMe SSD rescan/reset/remove operation during
> IO, the steps found several issues during my previous testing, check
> them here:
> http://lists.infradead.org/pipermail/linux-nvme/2017-February/008358.html
> http://lists.infradead.org/pipermail/linux-nvme/2017-May/010259.html
>
> Signed-off-by: Yi Zhang<yi.zhang@redhat.com>
>
> ---
>
> changes from v2:
> - add check_sysfs function for rescan/reset/remove operation
> - declare all local variables at the start
> - alignment fix
> - add udevadm settle
> - change to QUICK=1
> changes from v1:
> - add variable for "/sys/bus/pci/devices/${pdev}"
> - add kill $!; wait; for background fio
> - add rescan/reset/remove sysfs node check
> - add loop checking for nvme reinitialized
>
> ---
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3 blktests] nvme: Add new test case about nvme rescan/reset/remove during IO
2019-09-11 8:53 [PATCH V3 blktests] nvme: Add new test case about nvme rescan/reset/remove during IO Yi Zhang
2019-09-11 20:43 ` Chaitanya Kulkarni
@ 2019-09-12 0:09 ` Ming Lei
2019-10-15 23:21 ` Omar Sandoval
2 siblings, 0 replies; 4+ messages in thread
From: Ming Lei @ 2019-09-12 0:09 UTC (permalink / raw)
To: Yi Zhang; +Cc: linux-block, osandov, Chaitanya.Kulkarni
On Wed, Sep 11, 2019 at 04:53:43PM +0800, Yi Zhang wrote:
> Add one test to cover NVMe SSD rescan/reset/remove operation during
> IO, the steps found several issues during my previous testing, check
> them here:
> http://lists.infradead.org/pipermail/linux-nvme/2017-February/008358.html
> http://lists.infradead.org/pipermail/linux-nvme/2017-May/010259.html
>
> Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
>
> ---
>
> changes from v2:
> - add check_sysfs function for rescan/reset/remove operation
> - declare all local variables at the start
> - alignment fix
> - add udevadm settle
> - change to QUICK=1
> changes from v1:
> - add variable for "/sys/bus/pci/devices/${pdev}"
> - add kill $!; wait; for background fio
> - add rescan/reset/remove sysfs node check
> - add loop checking for nvme reinitialized
>
> ---
> ---
> tests/nvme/031 | 75 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/nvme/031.out | 2 ++
> 2 files changed, 77 insertions(+)
> create mode 100755 tests/nvme/031
> create mode 100644 tests/nvme/031.out
>
> diff --git a/tests/nvme/031 b/tests/nvme/031
> new file mode 100755
> index 0000000..31db8a5
> --- /dev/null
> +++ b/tests/nvme/031
> @@ -0,0 +1,75 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2019 Yi Zhang <yi.zhang@redhat.com>
> +#
> +# Test nvme pci adapter rescan/reset/remove operation during I/O
> +#
> +# Regression test for bellow two commits:
> +# http://lists.infradead.org/pipermail/linux-nvme/2017-May/010367.html
> +# 986f75c876db nvme: avoid to use blk_mq_abort_requeue_list()
> +# 806f026f9b90 nvme: use blk_mq_start_hw_queues() in nvme_kill_queues()
> +
> +. tests/nvme/rc
> +
> +DESCRIPTION="test nvme pci adapter rescan/reset/remove during I/O"
> +QUICK=1
> +
> +requires() {
> + _have_fio
> +}
> +
> +device_requires() {
> + _test_dev_is_nvme
> +}
> +
> +check_sysfs()
> +{
> + local sysfs_attr="$sysfs/$1"
> +
> + if [[ -f "$sysfs_attr" ]]; then
> + echo 1 > "${sysfs_attr}"
> + else
> + # QEMU VM doesn't have the "reset" attribute, skip it
> + [[ "$sysfs_attr" == *reset ]] && return
> + echo "${sysfs_attr} doesn't exist!"
> + fi
> +}
> +
> +test_device() {
> + echo "Running ${TEST_NAME}"
> +
> + local sysfs
> + local m
> +
> + pdev="$(_get_pci_dev_from_blkdev)"
> + sysfs="/sys/bus/pci/devices/${pdev}"
> +
> + # start fio job
> + _run_fio_rand_io --filename="$TEST_DEV" --size=1g \
> + --group_reporting &> /dev/null &
> +
> + sleep 5
> +
> + # do rescan/reset/remove operation
> + for i in rescan reset remove; do
> + check_sysfs $i
> + done
> +
> + { kill $!; wait; } &> /dev/null
> +
> + echo 1 > /sys/bus/pci/rescan
> +
> + # wait nvme reinitialized
> + for ((m = 0; m < 10; m++)); do
> + if [[ -b "${TEST_DEV}" ]]; then
> + break
> + fi
> + sleep 0.5
> + done
> + if (( m > 9 )); then
> + echo "nvme still not reinitialized after 5 seconds!"
> + fi
> + udevadm settle
> +
> + echo "Test complete"
> +}
> diff --git a/tests/nvme/031.out b/tests/nvme/031.out
> new file mode 100644
> index 0000000..ae902bd
> --- /dev/null
> +++ b/tests/nvme/031.out
> @@ -0,0 +1,2 @@
> +Running nvme/031
> +Test complete
> --
> 2.17.2
>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3 blktests] nvme: Add new test case about nvme rescan/reset/remove during IO
2019-09-11 8:53 [PATCH V3 blktests] nvme: Add new test case about nvme rescan/reset/remove during IO Yi Zhang
2019-09-11 20:43 ` Chaitanya Kulkarni
2019-09-12 0:09 ` Ming Lei
@ 2019-10-15 23:21 ` Omar Sandoval
2 siblings, 0 replies; 4+ messages in thread
From: Omar Sandoval @ 2019-10-15 23:21 UTC (permalink / raw)
To: Yi Zhang; +Cc: linux-block, Chaitanya.Kulkarni, ming.lei
On Wed, Sep 11, 2019 at 04:53:43PM +0800, Yi Zhang wrote:
> Add one test to cover NVMe SSD rescan/reset/remove operation during
> IO, the steps found several issues during my previous testing, check
> them here:
> http://lists.infradead.org/pipermail/linux-nvme/2017-February/008358.html
> http://lists.infradead.org/pipermail/linux-nvme/2017-May/010259.html
>
> Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
>
> ---
>
> changes from v2:
> - add check_sysfs function for rescan/reset/remove operation
> - declare all local variables at the start
> - alignment fix
> - add udevadm settle
> - change to QUICK=1
> changes from v1:
> - add variable for "/sys/bus/pci/devices/${pdev}"
> - add kill $!; wait; for background fio
> - add rescan/reset/remove sysfs node check
> - add loop checking for nvme reinitialized
Looks like I don't have the remove attribute, either. I made the check
less strict and folded the check_sysfs function into test().
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-15 23:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11 8:53 [PATCH V3 blktests] nvme: Add new test case about nvme rescan/reset/remove during IO Yi Zhang
2019-09-11 20:43 ` Chaitanya Kulkarni
2019-09-12 0:09 ` Ming Lei
2019-10-15 23:21 ` Omar Sandoval
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).