* [PATCH blktests] nvme: Add new test case about nvme rescan/reset/remove during IO
@ 2019-09-03 8:17 Yi Zhang
2019-09-04 18:21 ` Omar Sandoval
2019-09-07 18:23 ` Chaitanya Kulkarni
0 siblings, 2 replies; 4+ messages in thread
From: Yi Zhang @ 2019-09-03 8:17 UTC (permalink / raw)
To: linux-block; +Cc: osandov, 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>
---
tests/nvme/031 | 43 +++++++++++++++++++++++++++++++++++++++++++
tests/nvme/031.out | 2 ++
2 files changed, 45 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..4113d12
--- /dev/null
+++ b/tests/nvme/031
@@ -0,0 +1,43 @@
+#!/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"
+TIMED=1
+
+requires() {
+ _have_fio
+}
+
+device_requires() {
+ _test_dev_is_nvme
+}
+
+test_device() {
+ echo "Running ${TEST_NAME}"
+
+ pdev="$(_get_pci_dev_from_blkdev)"
+
+ # start fio job
+ _run_fio_rand_io --filename="$TEST_DEV" --size=1g \
+ --ignore_error=EIO,ENXIO,ENODEV --group_reporting &> /dev/null &
+
+ # do rescan/reset/remove operation
+ echo 1 > /sys/bus/pci/devices/"${pdev}"/rescan
+ echo 1 > /sys/bus/pci/devices/"${pdev}"/reset
+ echo 1 > /sys/bus/pci/devices/"${pdev}"/remove
+ sleep .5
+ echo 1 > /sys/bus/pci/rescan
+ sleep 5
+
+ 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 blktests] nvme: Add new test case about nvme rescan/reset/remove during IO
2019-09-03 8:17 [PATCH blktests] nvme: Add new test case about nvme rescan/reset/remove during IO Yi Zhang
@ 2019-09-04 18:21 ` Omar Sandoval
2019-09-07 18:23 ` Chaitanya Kulkarni
1 sibling, 0 replies; 4+ messages in thread
From: Omar Sandoval @ 2019-09-04 18:21 UTC (permalink / raw)
To: Yi Zhang; +Cc: linux-block, osandov, ming.lei
On Tue, Sep 03, 2019 at 04:17:52PM +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>
> ---
> tests/nvme/031 | 43 +++++++++++++++++++++++++++++++++++++++++++
> tests/nvme/031.out | 2 ++
> 2 files changed, 45 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..4113d12
> --- /dev/null
> +++ b/tests/nvme/031
> @@ -0,0 +1,43 @@
> +#!/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"
> +TIMED=1
> +
> +requires() {
> + _have_fio
> +}
> +
> +device_requires() {
> + _test_dev_is_nvme
> +}
> +
> +test_device() {
> + echo "Running ${TEST_NAME}"
> +
> + pdev="$(_get_pci_dev_from_blkdev)"
> +
> + # start fio job
> + _run_fio_rand_io --filename="$TEST_DEV" --size=1g \
> + --ignore_error=EIO,ENXIO,ENODEV --group_reporting &> /dev/null &
> +
> + # do rescan/reset/remove operation
> + echo 1 > /sys/bus/pci/devices/"${pdev}"/rescan
> + echo 1 > /sys/bus/pci/devices/"${pdev}"/reset
My QEMU VM doesn't have the "reset" attribute, I'm guessing because of
this code in pci_create_capabilities_sysfs():
if (dev->reset_fn) {
retval = device_create_file(&dev->dev, &reset_attr);
if (retval)
goto error;
}
We can skip the reset if the attribute doesn't exist.
> + echo 1 > /sys/bus/pci/devices/"${pdev}"/remove
> + sleep .5
> + echo 1 > /sys/bus/pci/rescan
> + sleep 5
Instead of sleep, we can kill and wait for fio.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH blktests] nvme: Add new test case about nvme rescan/reset/remove during IO
2019-09-03 8:17 [PATCH blktests] nvme: Add new test case about nvme rescan/reset/remove during IO Yi Zhang
2019-09-04 18:21 ` Omar Sandoval
@ 2019-09-07 18:23 ` Chaitanya Kulkarni
2019-09-09 9:29 ` Yi Zhang
1 sibling, 1 reply; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-09-07 18:23 UTC (permalink / raw)
To: Yi Zhang, linux-block; +Cc: osandov, ming.lei
On 09/03/2019 01:18 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>
> ---
> tests/nvme/031 | 43 +++++++++++++++++++++++++++++++++++++++++++
> tests/nvme/031.out | 2 ++
> 2 files changed, 45 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..4113d12
> --- /dev/null
> +++ b/tests/nvme/031
> @@ -0,0 +1,43 @@
> +#!/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"
> +TIMED=1
> +
> +requires() {
> + _have_fio
> +}
> +
> +device_requires() {
> + _test_dev_is_nvme
> +}
> +
> +test_device() {
> + echo "Running ${TEST_NAME}"
> +
> + pdev="$(_get_pci_dev_from_blkdev)"
> +
> + # start fio job
> + _run_fio_rand_io --filename="$TEST_DEV" --size=1g \
> + --ignore_error=EIO,ENXIO,ENODEV --group_reporting &> /dev/null &
> +
> + # do rescan/reset/remove operation
> + echo 1 > /sys/bus/pci/devices/"${pdev}"/rescan
> + echo 1 > /sys/bus/pci/devices/"${pdev}"/reset
> + echo 1 > /sys/bus/pci/devices/"${pdev}"/remove
Can you please use a variable for "/sys/bus/pci/devices/"${pdev}"/" ?
Also we need to validate above files rescan/reset/remove with if [ -f ]
and report appropriate error if any of that is not preset.
> + sleep .5
> + echo 1 > /sys/bus/pci/rescan
> + sleep 5
> +
> + 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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH blktests] nvme: Add new test case about nvme rescan/reset/remove during IO
2019-09-07 18:23 ` Chaitanya Kulkarni
@ 2019-09-09 9:29 ` Yi Zhang
0 siblings, 0 replies; 4+ messages in thread
From: Yi Zhang @ 2019-09-09 9:29 UTC (permalink / raw)
To: Chaitanya Kulkarni, linux-block; +Cc: osandov, ming.lei
On 9/8/19 2:23 AM, Chaitanya Kulkarni wrote:
> On 09/03/2019 01:18 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>
>> ---
>> tests/nvme/031 | 43 +++++++++++++++++++++++++++++++++++++++++++
>> tests/nvme/031.out | 2 ++
>> 2 files changed, 45 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..4113d12
>> --- /dev/null
>> +++ b/tests/nvme/031
>> @@ -0,0 +1,43 @@
>> +#!/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"
>> +TIMED=1
>> +
>> +requires() {
>> + _have_fio
>> +}
>> +
>> +device_requires() {
>> + _test_dev_is_nvme
>> +}
>> +
>> +test_device() {
>> + echo "Running ${TEST_NAME}"
>> +
>> + pdev="$(_get_pci_dev_from_blkdev)"
>> +
>> + # start fio job
>> + _run_fio_rand_io --filename="$TEST_DEV" --size=1g \
>> + --ignore_error=EIO,ENXIO,ENODEV --group_reporting &> /dev/null &
>> +
>> + # do rescan/reset/remove operation
>> + echo 1 > /sys/bus/pci/devices/"${pdev}"/rescan
>> + echo 1 > /sys/bus/pci/devices/"${pdev}"/reset
>> + echo 1 > /sys/bus/pci/devices/"${pdev}"/remove
> Can you please use a variable for "/sys/bus/pci/devices/"${pdev}"/" ?
OK, will do that
>
> Also we need to validate above files rescan/reset/remove with if [ -f ]
> and report appropriate error if any of that is not preset.
OK, will do for rescan/remove sysfs.
As Omar said, the QEMU env doesn't have the "reset" attribute, I will
skip the error reporting for "reset".
[root@dhcp-12-153 blktests]# lspci | grep -i nvm
00:01.0 Non-Volatile memory controller: Intel Corporation QEMU NVM
Express Controller (rev 02)
[root@dhcp-12-153 blktests]# ll /sys/bus/pci/devices/0000\:00\:01.0/re*
--w--w----. 1 root root 4096 Sep 9 05:24
/sys/bus/pci/devices/0000:00:01.0/remove
--w--w----. 1 root root 4096 Sep 9 05:24
/sys/bus/pci/devices/0000:00:01.0/rescan
-r--r--r--. 1 root root 4096 Sep 9 05:24
/sys/bus/pci/devices/0000:00:01.0/resource
-rw-------. 1 root root 8192 Sep 9 05:24
/sys/bus/pci/devices/0000:00:01.0/resource0
-rw-------. 1 root root 4096 Sep 9 05:24
/sys/bus/pci/devices/0000:00:01.0/resource4
-r--r--r--. 1 root root 4096 Sep 9 05:24
/sys/bus/pci/devices/0000:00:01.0/revision
Thanks for the review, will send the V2 later.
>> + sleep .5
>> + echo 1 > /sys/bus/pci/rescan
>> + sleep 5
>> +
>> + 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
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-09 9:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 8:17 [PATCH blktests] nvme: Add new test case about nvme rescan/reset/remove during IO Yi Zhang
2019-09-04 18:21 ` Omar Sandoval
2019-09-07 18:23 ` Chaitanya Kulkarni
2019-09-09 9:29 ` Yi Zhang
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).