Skip to contentSkip to conversation

block/020: test IO req allocation

PATCH In review Ming Lei 2 participants 3 messages May 22, 2018 – May 23, 2018 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block/020: test IO req allocation

IO request allocation may hang for ever if the allocation process migrages. This test covers the request allocation code path.

The following patch can fix this issue on linus kernel:

https://marc.info/?l=linux-block&m=152671586923185&w=2

---
 tests/block/020     | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/block/020.out |  2 ++
 2 files changed, 52 insertions(+)
 create mode 100755 tests/block/020
 create mode 100755 tests/block/020.out
tests/block/020 new file +50 -0
new file mode 100755
index 000000000000..b102d7f12173
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Test blk-mq IO request allocation.
+#
+# Copyright (C) 2018 Ming Lei <[email protected]>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="check if IO req allocation may hang"
+QUICK=1
+
+requires() {
+	_have_module null_blk && _have_fio
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe -r null_blk
+	modprobe null_blk queue_mode=2 irqmode=2 completion_nsec=2000000 \
+			shared_tags=1 submit_queues=4 hw_queue_depth=1 || continue
+
+	local scheds
+	# shellcheck disable=SC2207
+	scheds=($(sed 's/[][]//g' /sys/block/nullb0/queue/scheduler))
+
+	for sched in "${scheds[@]}"; do
+		echo "Testing $sched" >> "$FULL"
+		echo "$sched" > /sys/block/nullb0/queue/scheduler
+		_fio_perf --bs=4k --ioengine=libaio --iodepth=1024 \
+				--numjobs="$(nproc)" --rw=randread --name=async \
+				--filename=/dev/nullb0 --size=1g --direct=1 \
+				--runtime=10
+	done
+
+	modprobe -r null_blk
+
+	echo "Test complete"
+}
tests/block/020.out new file +2 -0
new file mode 100755
index 000000000000..dcb584d22e3e
@@ -0,0 +1,2 @@
+Running block/020
+Test complete
Signature · 1 line
2.9.5
#1 lore raw
Quoted 21 lines · Ming Lei

IO request allocation may hang for ever if the allocation process migrages. This test covers the request allocation code path.

The following patch can fix this issue on linus kernel:

https://marc.info/?l=linux-block&m=152671586923185&w=2

---
 tests/block/020     | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/block/020.out |  2 ++
 2 files changed, 52 insertions(+)
 create mode 100755 tests/block/020
 create mode 100755 tests/block/020.out
tests/block/020 new file +0 -0
new file mode 100755
index 000000000000..b102d7f12173

tests/block/020 line 3

Quoted 3 lines
tests/block/020 new file +3 -0
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Test blk-mq IO request allocation.

This isn't very descriptive. How about

Test blk-mq request allocation when hardware tags are limited.

Additionally, for regression tests for specific patches, please reference what patch it is testing. In this case, it'd be

Regression test for patch "blk-mq: avoid to starve tag allocation after allocation process migrates".

Quoted 6 lines
tests/block/020 new file +6 -0
+# Copyright (C) 2018 Ming Lei <[email protected]>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.

tests/block/020 line 20

Quoted 10 lines
tests/block/020 new file +10 -0
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="check if IO req allocation may hang"

A better description would say what this test actually does. In this case, something like

DESCRIPTION="run null-blk on different schedulers with only one hardware tag"

I can fix this and apply when the discussion on the patch itself settles. Thanks, Ming!

Quoted 41 lines
tests/block/020 new file +30 -0
+QUICK=1
+
+requires() {
+	_have_module null_blk && _have_fio
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe -r null_blk
+	modprobe null_blk queue_mode=2 irqmode=2 completion_nsec=2000000 \
+			shared_tags=1 submit_queues=4 hw_queue_depth=1 || continue
+
+	local scheds
+	# shellcheck disable=SC2207
+	scheds=($(sed 's/[][]//g' /sys/block/nullb0/queue/scheduler))
+
+	for sched in "${scheds[@]}"; do
+		echo "Testing $sched" >> "$FULL"
+		echo "$sched" > /sys/block/nullb0/queue/scheduler
+		_fio_perf --bs=4k --ioengine=libaio --iodepth=1024 \
+				--numjobs="$(nproc)" --rw=randread --name=async \
+				--filename=/dev/nullb0 --size=1g --direct=1 \
+				--runtime=10
+	done
+
+	modprobe -r null_blk
+
+	echo "Test complete"
+}
tests/block/020.out new file +2 -0
new file mode 100755
index 000000000000..dcb584d22e3e
@@ -0,0 +1,2 @@
+Running block/020
+Test complete
Signature · 1 line
2.9.5
author
#2 lore raw
Quoted 28 lines · Omar Sandoval
Quoted 21 lines · Ming Lei

IO request allocation may hang for ever if the allocation process migrages. This test covers the request allocation code path.

The following patch can fix this issue on linus kernel:

https://marc.info/?l=linux-block&m=152671586923185&w=2

---
 tests/block/020     | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/block/020.out |  2 ++
 2 files changed, 52 insertions(+)
 create mode 100755 tests/block/020
 create mode 100755 tests/block/020.out
tests/block/020 new file +0 -0
new file mode 100755
index 000000000000..b102d7f12173

tests/block/020 line 3

Quoted 3 lines
tests/block/020 new file +3 -0
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Test blk-mq IO request allocation.

This isn't very descriptive. How about

Quoted 1 line

Test blk-mq request allocation when hardware tags are limited.

It is fine, except the issue isn't limited to small hw queue tags, and it might be triggered on NVMe if there are huge IO processes.

Quoted 6 lines

Additionally, for regression tests for specific patches, please reference what patch it is testing. In this case, it'd be

Regression test for patch "blk-mq: avoid to starve tag allocation after allocation process migrates".

OK.

Quoted 21 lines
Quoted 7 lines
tests/block/020 new file +6 -0
+# Copyright (C) 2018 Ming Lei <[email protected]>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.

tests/block/020 line 20

Quoted 10 lines
tests/block/020 new file +10 -0
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="check if IO req allocation may hang"

A better description would say what this test actually does. In this case, something like

Quoted 4 lines

DESCRIPTION="run null-blk on different schedulers with only one hardware tag"

I can fix this and apply when the discussion on the patch itself settles. Thanks, Ming!

OK, thanks!

Thanks,
Ming