* [PATCH blktests] Add a test that triggers the blk_mq_realloc_hw_ctxs() error path
@ 2020-03-15 2:46 Bart Van Assche
2020-03-15 6:08 ` Chaitanya Kulkarni
0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2020-03-15 2:46 UTC (permalink / raw)
To: Omar Sandoval; +Cc: linux-block, Bart Van Assche, Ming Lei
Add a test that triggers the code touched by commit d0930bb8f46b ("blk-mq:
Fix a recently introduced regression in blk_mq_realloc_hw_ctxs()"). This
test only runs if a recently added fault injection feature is available,
namely commit 596444e75705 ("null_blk: Add support for init_hctx() fault
injection").
Cc: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
tests/block/030 | 55 +++++++++++++++++++++++++++++++++++++++++++++
tests/block/030.out | 1 +
2 files changed, 56 insertions(+)
create mode 100755 tests/block/030
create mode 100644 tests/block/030.out
diff --git a/tests/block/030 b/tests/block/030
new file mode 100755
index 000000000000..028b0a1a6e9a
--- /dev/null
+++ b/tests/block/030
@@ -0,0 +1,55 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2020 Google LLC
+#
+# Trigger the blk_mq_realloc_hw_ctxs() error path.
+
+. tests/block/rc
+. common/null_blk
+
+DESCRIPTION="trigger the blk_mq_realloc_hw_ctxs() error path"
+QUICK=1
+
+requires() {
+ _have_null_blk || return $?
+ _have_module_param null_blk init_hctx || return $?
+}
+
+# Configure one null_blk instance.
+configure_null_blk() {
+ local nullb0="/sys/kernel/config/nullb/nullb0"
+
+ mkdir "$nullb0" &&
+ echo 0 > "$nullb0/completion_nsec" &&
+ echo 512 > "$nullb0/blocksize" &&
+ echo 16 > "$nullb0/size" &&
+ nproc > "$nullb0/submit_queues" &&
+ echo 1 > "$nullb0/memory_backed" &&
+ echo 1 > "$nullb0/power" &&
+ ls -l /dev/nullb* &>>"$FULL"
+}
+
+test() {
+ local i sq=/sys/kernel/config/nullb/nullb0/submit_queues
+
+ : "${TIMEOUT:=30}"
+ if ! _init_null_blk nr_devices=0 queue_mode=2 "init_hctx=$(nproc),100,0,0"; then
+ echo "Loading null_blk failed"
+ return 1
+ fi
+ if ! configure_null_blk; then
+ echo "Configuring null_blk failed"
+ return 1
+ fi
+ if { echo "$(<"$sq")" >$sq; } 2>/dev/null; then
+ for ((i=0;i<100;i++)); do
+ echo 1 >$sq
+ nproc >$sq
+ done
+ else
+ echo "Skipping test because $sq cannot be modified" >>"$FULL"
+ fi
+ rmdir /sys/kernel/config/nullb/nullb0
+ _exit_null_blk
+ echo Passed
+}
diff --git a/tests/block/030.out b/tests/block/030.out
new file mode 100644
index 000000000000..863339fb8ced
--- /dev/null
+++ b/tests/block/030.out
@@ -0,0 +1 @@
+Passed
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH blktests] Add a test that triggers the blk_mq_realloc_hw_ctxs() error path
2020-03-15 2:46 [PATCH blktests] Add a test that triggers the blk_mq_realloc_hw_ctxs() error path Bart Van Assche
@ 2020-03-15 6:08 ` Chaitanya Kulkarni
0 siblings, 0 replies; 2+ messages in thread
From: Chaitanya Kulkarni @ 2020-03-15 6:08 UTC (permalink / raw)
To: Bart Van Assche, Omar Sandoval; +Cc: linux-block, Ming Lei
Hi Bart,
How about we create a generic helper in rc for creating null_blk
instance ?
This functionality is needed and pretty common, so that future
test-cases can reuse the code instead of duplicating code all over ?
e.g. For NVMe blktest category we have helpers for creating
subsystems/namespaces.
On 03/14/2020 07:47 PM, Bart Van Assche wrote:
> +# Configure one null_blk instance.
> +configure_null_blk() {
> + local nullb0="/sys/kernel/config/nullb/nullb0"
> +
> + mkdir "$nullb0" &&
> + echo 0 > "$nullb0/completion_nsec" &&
> + echo 512 > "$nullb0/blocksize" &&
> + echo 16 > "$nullb0/size" &&
> + nproc > "$nullb0/submit_queues" &&
> + echo 1 > "$nullb0/memory_backed" &&
> + echo 1 > "$nullb0/power" &&
> + ls -l /dev/nullb* &>>"$FULL"
> +}
> +
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-15 6:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-15 2:46 [PATCH blktests] Add a test that triggers the blk_mq_realloc_hw_ctxs() error path Bart Van Assche
2020-03-15 6:08 ` Chaitanya Kulkarni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.