Skip to contentSkip to conversation

selftests: ublk: make IO & device removal test more stressful

PATCH Applied Ming Lei 2 participants 2 messages May 19, 2025 – May 20, 2025

Subsystems (3)
lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 selftests: ublk: make IO & device removal test more stressful

__run_io_and_remove() is used in several stress tests for running heavy IO vs. removing device meantime.

However, sequential readwrite is taken in the fio script, which isn't correct, we should take random IO for saturating ublk device.

Also turns out '--num_jobs=4' isn't stressful enough, so change it to '--num_jobs=$(nproc)'.

Finally we don't cover single queue test in test_stress_02.sh, so add single queue test which can trigger request tag recycling easier.

With above change the issue in #1 can be reproduced reliably in stress_02.sh.

---
 tools/testing/selftests/ublk/test_common.sh    |  2 +-
 tools/testing/selftests/ublk/test_stress_02.sh | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
tools/testing/selftests/ublk/test_common.sh +1 -1
index a81210ca3e99..c17fd66b73ac 100755
@@ -251,7 +251,7 @@ __run_io_and_remove()
 	local kill_server=$3
 
 	fio --name=job1 --filename=/dev/ublkb"${dev_id}" --ioengine=libaio \
-		--rw=readwrite --iodepth=256 --size="${size}" --numjobs=4 \
+		--rw=randrw --norandommap --iodepth=256 --size="${size}" --numjobs="$(nproc)" \
 		--runtime=20 --time_based > /dev/null 2>&1 &
 	sleep 2
 	if [ "${kill_server}" = "yes" ]; then
tools/testing/selftests/ublk/test_stress_02.sh +6 -4
index 1a9065125ae1..4bdd921081e5 100755
@@ -25,10 +25,12 @@ _create_backfile 0 256M
 _create_backfile 1 128M
 _create_backfile 2 128M
 
-ublk_io_and_kill_daemon 8G -t null -q 4 &
-ublk_io_and_kill_daemon 256M -t loop -q 4 "${UBLK_BACKFILES[0]}" &
-ublk_io_and_kill_daemon 256M -t stripe -q 4 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
-wait
+for nr_queue in 1 4; do
+	ublk_io_and_kill_daemon 8G -t null -q "$nr_queue" &
+	ublk_io_and_kill_daemon 256M -t loop -q "$nr_queue" "${UBLK_BACKFILES[0]}" &
+	ublk_io_and_kill_daemon 256M -t stripe -q "$nr_queue" "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
+	wait
+done
 
 _cleanup_test "stress"
 _show_result $TID $ERR_CODE
Signature · 1 line
2.47.1
maintainer Applied
#1 lore raw
Quoted 10 lines · Ming Lei

__run_io_and_remove() is used in several stress tests for running heavy IO vs. removing device meantime.

However, sequential readwrite is taken in the fio script, which isn't correct, we should take random IO for saturating ublk device.

Also turns out '--num_jobs=4' isn't stressful enough, so change it to '--num_jobs=$(nproc)'.

[...]

Applied, thanks!

[1/1] selftests: ublk: make IO & device removal test more stressful

      commit: 3fee1257ab6be5b52c9f002f27d5620583a8dc40

Best regards,

Signature · 1 line
Jens Axboe