Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: ublk: add stress test for per io daemons

Add a new test_stress_06 for the per io daemons feature. This is just a
copy of test_stress_01 with the per_io_tasks flag added, with varying
amounts of nthreads. This test is able to reproduce a panic which was
caught manually during development [1]; in the current version of this
patch set, it passes.

Note that this commit also makes all stress tests using the
run_io_and_remove helper more stressful by additionally exercising the
batch submit (queue_rqs) path.

[1] https://lore.kernel.org/linux-block/aDgwGoGCEpwd1mFY@fedora/

Suggested-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Uday Shankar <ushankar@purestorage.com>
Link: https://lore.kernel.org/r/20250529-ublk_task_per_io-v8-8-e9d3b119336a@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Uday Shankar and committed by
Jens Axboe
17574aa2 236918d3

+42
+1
tools/testing/selftests/ublk/Makefile
··· 38 38 TEST_PROGS += test_stress_03.sh 39 39 TEST_PROGS += test_stress_04.sh 40 40 TEST_PROGS += test_stress_05.sh 41 + TEST_PROGS += test_stress_06.sh 41 42 42 43 TEST_GEN_PROGS_EXTENDED = kublk 43 44
+5
tools/testing/selftests/ublk/test_common.sh
··· 278 278 fio --name=job1 --filename=/dev/ublkb"${dev_id}" --ioengine=libaio \ 279 279 --rw=randrw --norandommap --iodepth=256 --size="${size}" --numjobs="$(nproc)" \ 280 280 --runtime=20 --time_based > /dev/null 2>&1 & 281 + fio --name=batchjob --filename=/dev/ublkb"${dev_id}" --ioengine=io_uring \ 282 + --rw=randrw --norandommap --iodepth=256 --size="${size}" \ 283 + --numjobs="$(nproc)" --runtime=20 --time_based \ 284 + --iodepth_batch_submit=32 --iodepth_batch_complete_min=32 \ 285 + --force_async=7 > /dev/null 2>&1 & 281 286 sleep 2 282 287 if [ "${kill_server}" = "yes" ]; then 283 288 local state
+36
tools/testing/selftests/ublk/test_stress_06.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + TID="stress_06" 6 + ERR_CODE=0 7 + 8 + ublk_io_and_remove() 9 + { 10 + run_io_and_remove "$@" 11 + ERR_CODE=$? 12 + if [ ${ERR_CODE} -ne 0 ]; then 13 + echo "$TID failure: $*" 14 + _show_result $TID $ERR_CODE 15 + fi 16 + } 17 + 18 + if ! _have_program fio; then 19 + exit "$UBLK_SKIP_CODE" 20 + fi 21 + 22 + _prep_test "stress" "run IO and remove device with per_io_tasks" 23 + 24 + _create_backfile 0 256M 25 + _create_backfile 1 128M 26 + _create_backfile 2 128M 27 + 28 + ublk_io_and_remove 8G -t null -q 4 --nthreads 5 --per_io_tasks & 29 + ublk_io_and_remove 256M -t loop -q 4 --nthreads 3 --per_io_tasks \ 30 + "${UBLK_BACKFILES[0]}" & 31 + ublk_io_and_remove 256M -t stripe -q 4 --nthreads 4 --per_io_tasks \ 32 + "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 33 + wait 34 + 35 + _cleanup_test "stress" 36 + _show_result $TID $ERR_CODE