nvme: Add new test case about nvme rescan/reset/remove during IO
PATCH 1/1 nvme: Add new test case about nvme rescan/reset/remove during IO
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
--- 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
tests/nvme/031 new file +43 -0
@@ -0,0 +1,43 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Yi Zhang <[email protected]> +# +# 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" +}
tests/nvme/031.out new file +2 -0
@@ -0,0 +1,2 @@ +Running nvme/031 +Test complete
Signature · 1 line
2.17.2
Quoted 46 lines · Yi Zhang
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.htmlSigned-off-by Yi Zhang <[email protected]>--- 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.outtests/nvme/031 new file +26
-0@@ -0,0 +1,43 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Yi Zhang <[email protected]> +# +# 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}"
tests/nvme/031 line 36
Quoted 10 lines
tests/nvme/031 new file +10
-0+ + 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.
tests/nvme/031 line 40
Quoted 4 lines
tests/nvme/031 new file +4
-0+ 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!
Quoted 47 lines · Yi Zhang
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.htmlSigned-off-by Yi Zhang <[email protected]>--- 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.outtests/nvme/031 new file +27
-0@@ -0,0 +1,43 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Yi Zhang <[email protected]> +# +# 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}" +
tests/nvme/031 line 37
Quoted 10 lines
tests/nvme/031 new file +10
-0+ 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.
Quoted 15 lines
tests/nvme/031 new file +6
-0+ sleep .5 + echo 1 > /sys/bus/pci/rescan + sleep 5 + + echo "Test complete" +}tests/nvme/031.out new file +2
-0@@ -0,0 +1,2 @@ +Running nvme/031 +Test complete
Quoted 51 lines · Chaitanya Kulkarni
Quoted 50 lines · Yi Zhang
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.htmlSigned-off-by Yi Zhang <[email protected]>--- 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.outtests/nvme/031 new file +30
-0@@ -0,0 +1,43 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Yi Zhang <[email protected]> +# +# 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
Quoted 8 lines
tests/nvme/031 line 37
Quoted 7 lines
tests/nvme/031 new file +7
-0+ _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}"/removeCan you please use a variable for "/sys/bus/pci/devices/"${pdev}"/" ?
OK, will do that
Quoted 3 lines
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.
Quoted 15 lines
Quoted 15 lines
tests/nvme/031 new file +6
-0+ sleep .5 + echo 1 > /sys/bus/pci/rescan + sleep 5 + + echo "Test complete" +}tests/nvme/031.out new file +2
-0@@ -0,0 +1,2 @@ +Running nvme/031 +Test complete