Skip to contentSkip to conversation

block/011: remove and rescan for evicted device

PATCH In review Klaus Jensen 1 participant 2 messages Sep 22, 2020 – Sep 23, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/011: remove and rescan for evicted device

From: Klaus Jensen <[email protected]>

Devices that actually honor the Bus Master Enable bit and considers the resulting failure to read/write a fatal error, often ends up getting disabled by the kernel when running block/011.

Remove the device and rescan the pci bus after completing the test to make sure we bring the device back up if required.

Cc Keith Busch <[email protected]>
Cc Johannes Thumshirn <[email protected]>
---
 tests/block/011 | 5 +++++
 1 file changed, 5 insertions(+)
tests/block/011 +5 -0
index 4f331b4a7522..f1306ae3896f 100755
@@ -22,6 +22,7 @@ test_device() {
 	echo "Running ${TEST_NAME}"
 
 	pdev="$(_get_pci_dev_from_blkdev)"
+	sysfs="/sys/bus/pci/devices/${pdev}"
 
 	if _test_dev_is_rotational; then
 		size="32m"
@@ -42,4 +43,8 @@ test_device() {
 	done
 
 	echo "Test complete"
+
+	# bring the device back up if it was disabled by the kernel
+	echo 1 > "${sysfs}/remove"
+	echo 1 > /sys/bus/pci/rescan
 }
Signature · 1 line
2.28.0
#1 lore raw
Quoted 40 lines · Klaus Jensen

From: Klaus Jensen <[email protected]>

Devices that actually honor the Bus Master Enable bit and considers the resulting failure to read/write a fatal error, often ends up getting disabled by the kernel when running block/011.

Remove the device and rescan the pci bus after completing the test to make sure we bring the device back up if required.

Cc Keith Busch <[email protected]>
Cc Johannes Thumshirn <[email protected]>
---
 tests/block/011 | 5 +++++
 1 file changed, 5 insertions(+)
tests/block/011 +5 -0
index 4f331b4a7522..f1306ae3896f 100755
@@ -22,6 +22,7 @@ test_device() {
 	echo "Running ${TEST_NAME}"
 
 	pdev="$(_get_pci_dev_from_blkdev)"
+	sysfs="/sys/bus/pci/devices/${pdev}"
 
 	if _test_dev_is_rotational; then
 		size="32m"
@@ -42,4 +43,8 @@ test_device() {
 	done
 
 	echo "Test complete"
+
+	# bring the device back up if it was disabled by the kernel
+	echo 1 > "${sysfs}/remove"
+	echo 1 > /sys/bus/pci/rescan
 }
Signature · 1 line
2.28.0

Hmfh. Looks like this at least needs a wait for TEST_DEV being back or something. Please disregard this patch for now as I try out some other work arounds.