]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
block/011: don't use sysfs for device disabling
authorKeith Busch <keith.busch@intel.com>
Mon, 4 Jun 2018 22:51:41 +0000 (16:51 -0600)
committerOmar Sandoval <osandov@fb.com>
Tue, 5 Jun 2018 00:06:56 +0000 (17:06 -0700)
The PCI sysfs interface may not be a dependable method for toggling the
PCI device state to trigger the timeouts. This patch goes directly to
the config space to make device failure occur.

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <keith.busch@intel.com>
tests/block/011

index 62e89f758ef17cadfd2359d86ffe541b6342a151..24614420461e7a0a35948b6f918352e091dfa21d 100755 (executable)
@@ -21,7 +21,7 @@ DESCRIPTION="disable PCI device while doing I/O"
 TIMED=1
 
 requires() {
-       _have_fio
+       _have_fio && _have_program setpci
 }
 
 device_requires() {
@@ -43,10 +43,11 @@ test_device() {
        _run_fio_rand_io --filename="$TEST_DEV" --size="$size" \
                        --ignore_error=EIO,ENXIO,ENODEV &
 
+       # toggle PCI Command Register's Bus Master Enabling
        while kill -0 $! 2>/dev/null; do
-               echo 0 > "/sys/bus/pci/devices/${pdev}/enable"
+               setpci -s "${pdev}" 4.w=0:4
                sleep .2
-               echo 1 > "/sys/bus/pci/devices/${pdev}/enable"
+               setpci -s "${pdev}" 4.w=4:4
                sleep .2
        done