Skip to contentSkip to conversation

Fix block/011 to not use sysfs for device disabling

PATCH In review Keith Busch 3 participants 3 messages Jun 4, 2018 – Jun 5, 2018 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Fix block/011 to not use sysfs for device disabling

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.

---
v1 -> v2:

Toggling only PCI Command Register BME bit, rather than including MEM.

 tests/block/011 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tests/block/011 +4 -3
index 62e89f7..2461442 100755
@@ -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
 
Signature · 1 line
2.14.3
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 3 lines · Keith Busch

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.

Signature · 1 line
Jens Axboe
#2 lore raw
In reply to Keith Busch
Quoted 9 lines · Keith Busch

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.

---
v1 -> v2:

Toggling only PCI Command Register BME bit, rather than including MEM.

Thanks, Keith, applied.