Skip to content

Commit 17574aa

Browse files
ps-ushankaraxboe
authored andcommitted
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 <[email protected]> Signed-off-by: Uday Shankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 236918d commit 17574aa

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

tools/testing/selftests/ublk/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ TEST_PROGS += test_stress_02.sh
3838
TEST_PROGS += test_stress_03.sh
3939
TEST_PROGS += test_stress_04.sh
4040
TEST_PROGS += test_stress_05.sh
41+
TEST_PROGS += test_stress_06.sh
4142

4243
TEST_GEN_PROGS_EXTENDED = kublk
4344

tools/testing/selftests/ublk/test_common.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ __run_io_and_remove()
278278
fio --name=job1 --filename=/dev/ublkb"${dev_id}" --ioengine=libaio \
279279
--rw=randrw --norandommap --iodepth=256 --size="${size}" --numjobs="$(nproc)" \
280280
--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 &
281286
sleep 2
282287
if [ "${kill_server}" = "yes" ]; then
283288
local state
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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

0 commit comments

Comments
 (0)