]> www.infradead.org Git - users/hch/blktests.git/commitdiff
tests/block/031: Add a test for sharing a tag set across hardware queues
authorBart Van Assche <bvanassche@acm.org>
Sun, 28 Mar 2021 23:12:09 +0000 (16:12 -0700)
committerOmar Sandoval <osandov@fb.com>
Thu, 22 Apr 2021 17:44:54 +0000 (10:44 -0700)
Support for sharing a tag set across hardware queues has been added
recently to the Linux kernel. See also the BLK_MQ_F_TAG_HCTX_SHARED flag,
Linux kernel commit 32bc15afed04 ("blk-mq: Facilitate a shared sbitmap per
tagset"; v5.10) and commit 0905053bdb5b ("null_blk: Support shared tag
bitmap"; v5.10). Add a test that triggers the shared tag set code in the
block layer core.

Cc: John Garry <john.garry@huawei.com>
Cc: Don Brace<don.brace@microsemi.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
tests/block/031 [new file with mode: 0755]
tests/block/031.out [new file with mode: 0644]

diff --git a/tests/block/031 b/tests/block/031
new file mode 100755 (executable)
index 0000000..b6927cf
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2021 Google LLC
+#
+# Test support for sharing a tag set across hardware queues ("host tag set").
+
+. tests/block/rc
+. common/null_blk
+
+DESCRIPTION="do IO on null-blk with a host tag set"
+TIMED=1
+
+requires() {
+       _have_null_blk && _have_module_param null_blk shared_tag_bitmap
+}
+
+test() {
+       local fio_status bs=512
+
+       : "${TIMEOUT:=30}"
+       if ! _init_null_blk nr_devices=0 queue_mode=2 shared_tag_bitmap=1; then
+               echo "Loading null_blk failed"
+               return 1
+       fi
+       if ! _configure_null_blk nullb0 completion_nsec=0 blocksize=$bs size=1\
+            submit_queues="$(nproc)" memory_backed=1 power=1; then
+               echo "Configuring null_blk failed"
+               return 1
+       fi
+       fio --verify=md5 --rw=randwrite --bs=$bs --loops=$((10**6)) \
+               --iodepth=64 --group_reporting --sync=1 --direct=1 \
+               --ioengine=libaio --runtime="${TIMEOUT}" --thread \
+               --name=block-031 --filename=/dev/nullb0 \
+               --output="${RESULTS_DIR}/block/fio-output-031.txt" \
+               >>"$FULL"
+       fio_status=$?
+       rmdir /sys/kernel/config/nullb/nullb0
+       _exit_null_blk
+       case $fio_status in
+               0) echo "Passed";;
+               *) echo "Failed (fio status = $fio_status)";;
+       esac
+}
diff --git a/tests/block/031.out b/tests/block/031.out
new file mode 100644 (file)
index 0000000..863339f
--- /dev/null
@@ -0,0 +1 @@
+Passed