All of lore.kernel.org
 help / color / mirror / Atom feed
* allow to run most tests with built-in null_blk v2
@ 2022-06-07 12:47 Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 01/13] common/null_blk: remove explicit queue_mode=2 parameters Christoph Hellwig
                   ` (13 more replies)
  0 siblings, 14 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Hi Shin'ichiro,

this series updates most tests that use null_blk so that they can
work with a built-in null_blk driver.  The onces that require
shared_tags or failure injection, which currently can only be
controlled through module parameters still require a module until
the kernel is updated (which I plan to look into).

Changes since v1:
 - spelling fixes
 - fix the off by order of 1024 device sizing
 - make the modprobe -r call in _exit_null_blk quiet
 - explicitly load null_blk.ko in _configure_null_blk

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH blktests 01/13] common/null_blk: remove explicit queue_mode=2 parameters
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 02/13] common/null_blk: allow _configure_null_blk with built-in null_blk Christoph Hellwig
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block, Chaitanya Kulkarni

queue_mode 2 (aka blk-mq) is the default in null_blk, so remove the
extra explicitly parameter.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 tests/block/006 | 2 +-
 tests/block/010 | 4 ++--
 tests/block/014 | 2 +-
 tests/block/015 | 2 +-
 tests/block/016 | 2 +-
 tests/block/017 | 3 +--
 tests/block/018 | 3 +--
 tests/block/020 | 2 +-
 tests/block/022 | 2 +-
 tests/block/024 | 3 +--
 tests/block/029 | 2 +-
 tests/block/030 | 2 +-
 tests/block/031 | 2 +-
 13 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/tests/block/006 b/tests/block/006
index 0b8a3c0..7ca1021 100755
--- a/tests/block/006
+++ b/tests/block/006
@@ -24,7 +24,7 @@ test() {
 	_divide_timeout 2
 	FIO_PERF_FIELDS=("read iops")
 
-	if ! _init_null_blk queue_mode=2 submit_queues=2 blocking=1; then
+	if ! _init_null_blk submit_queues=2 blocking=1; then
 		return 1
 	fi
 
diff --git a/tests/block/010 b/tests/block/010
index b81208e..ed56135 100644
--- a/tests/block/010
+++ b/tests/block/010
@@ -49,7 +49,7 @@ test() {
 
 	_divide_timeout 2
 
-	if ! _init_null_blk queue_mode=2 submit_queues=16 nr_devices=32; then
+	if ! _init_null_blk submit_queues=16 nr_devices=32; then
 		return 1
 	fi
 
@@ -58,7 +58,7 @@ test() {
 	run_fio_job
 
 	_exit_null_blk
-	if ! _init_null_blk queue_mode=2 submit_queues=16 nr_devices=32 shared_tags=1; then
+	if ! _init_null_blk submit_queues=16 nr_devices=32 shared_tags=1; then
 		return 1
 	fi
 
diff --git a/tests/block/014 b/tests/block/014
index 04c34fa..449046a 100755
--- a/tests/block/014
+++ b/tests/block/014
@@ -18,7 +18,7 @@ test() {
 
 	# The format is "<interval>,<probability>,<space>,<times>". Here, we
 	# fail 50% of I/Os.
-	if ! _init_null_blk queue_mode=2 timeout='1,50,0,-1'; then
+	if ! _init_null_blk timeout='1,50,0,-1'; then
 		return 1
 	fi
 
diff --git a/tests/block/015 b/tests/block/015
index 79102a2..2e5cf35 100755
--- a/tests/block/015
+++ b/tests/block/015
@@ -20,7 +20,7 @@ test() {
 
 	# The format is "<interval>,<probability>,<space>,<times>". Here, we
 	# requeue 10% of the time.
-	if ! _init_null_blk queue_mode=2 requeue='1,10,0,-1'; then
+	if ! _init_null_blk requeue='1,10,0,-1'; then
 		return 1
 	fi
 
diff --git a/tests/block/016 b/tests/block/016
index c70b7d0..2b7a05f 100755
--- a/tests/block/016
+++ b/tests/block/016
@@ -20,7 +20,7 @@ requires() {
 test() {
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk queue_mode=2 irqmode=2 completion_nsec=2000000000; then
+	if ! _init_null_blk irqmode=2 completion_nsec=2000000000; then
 		return 1
 	fi
 
diff --git a/tests/block/017 b/tests/block/017
index e4a9259..c84b661 100755
--- a/tests/block/017
+++ b/tests/block/017
@@ -27,8 +27,7 @@ show_inflight() {
 test() {
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk queue_mode=2 irqmode=2 \
-	     completion_nsec=500000000; then
+	if ! _init_null_blk irqmode=2 completion_nsec=500000000; then
 		return 1
 	fi
 
diff --git a/tests/block/018 b/tests/block/018
index 7312723..a80ecbc 100755
--- a/tests/block/018
+++ b/tests/block/018
@@ -33,8 +33,7 @@ test() {
 
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk queue_mode=2 irqmode=2 \
-	     completion_nsec=1000000000; then
+	if ! _init_null_blk irqmode=2 completion_nsec=1000000000; then
 		return 1
 	fi
 
diff --git a/tests/block/020 b/tests/block/020
index b4887a2..eef63cb 100755
--- a/tests/block/020
+++ b/tests/block/020
@@ -20,7 +20,7 @@ requires() {
 test() {
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk queue_mode=2 irqmode=2 completion_nsec=2000000 \
+	if ! _init_null_blk irqmode=2 completion_nsec=2000000 \
 	     submit_queues=4 hw_queue_depth=1; then
 		return 1
 	fi
diff --git a/tests/block/022 b/tests/block/022
index 30b2a68..10851ff 100755
--- a/tests/block/022
+++ b/tests/block/022
@@ -28,7 +28,7 @@ test() {
 	echo "Running ${TEST_NAME}"
 	: "${TIMEOUT:=30}"
 
-	if ! _init_null_blk shared_tags=1 nr_devices=0 queue_mode=2; then
+	if ! _init_null_blk shared_tags=1 nr_devices=0; then
 		return 1
 	fi
 
diff --git a/tests/block/024 b/tests/block/024
index b40a869..6808db0 100755
--- a/tests/block/024
+++ b/tests/block/024
@@ -37,8 +37,7 @@ test() {
 
 	# The maximum value for CONFIG_HZ is 1000. I.e., a tick is one
 	# millisecond. So, make each I/O take half a millisecond.
-	if ! _init_null_blk queue_mode=2 irqmode=2 \
-	     completion_nsec=500000; then
+	if ! _init_null_blk irqmode=2 completion_nsec=500000; then
 		return 1
 	fi
 
diff --git a/tests/block/029 b/tests/block/029
index 0c4fe08..dcf4024 100755
--- a/tests/block/029
+++ b/tests/block/029
@@ -31,7 +31,7 @@ test() {
 	local sq=/sys/kernel/config/nullb/nullb0/submit_queues
 
 	: "${TIMEOUT:=30}"
-	_init_null_blk nr_devices=0 queue_mode=2 &&
+	_init_null_blk nr_devices=0 &&
 	_configure_null_blk nullb0 completion_nsec=0 blocksize=512 \
 			    size=16 memory_backed=1 power=1 &&
 	if { echo 1 >$sq; } 2>/dev/null; then
diff --git a/tests/block/030 b/tests/block/030
index d2e5286..f08f772 100755
--- a/tests/block/030
+++ b/tests/block/030
@@ -22,7 +22,7 @@ test() {
 	: "${TIMEOUT:=30}"
 	# Legend: init_hctx=<interval>,<probability>,<space>,<times>
 	# Set <space> to $(nproc) + 1 to make loading of null_blk succeed.
-	if ! _init_null_blk nr_devices=0 queue_mode=2 \
+	if ! _init_null_blk nr_devices=0 \
 	     "init_hctx=$(nproc),100,$(($(nproc) + 1)),-1"; then
 		echo "Loading null_blk failed"
 		return 1
diff --git a/tests/block/031 b/tests/block/031
index cb4ba67..d253af8 100755
--- a/tests/block/031
+++ b/tests/block/031
@@ -18,7 +18,7 @@ test() {
 	local fio_status bs=512
 
 	: "${TIMEOUT:=30}"
-	if ! _init_null_blk nr_devices=0 queue_mode=2 shared_tag_bitmap=1; then
+	if ! _init_null_blk nr_devices=0 shared_tag_bitmap=1; then
 		echo "Loading null_blk failed"
 		return 1
 	fi
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 02/13] common/null_blk: allow _configure_null_blk with built-in null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 01/13] common/null_blk: remove explicit queue_mode=2 parameters Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 03/13] common/null_blk: respect RUN_FOR_ZONED in _configure_null_blk Christoph Hellwig
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Test that do use _configure_null_blk already configure do not actually
require a built-in null_blk driver.  Relax the check in _have_null_blk
to just require a driver instead of a module, and instead set a skip
reason instead of failing in _init_null_blk when null_blk is built-in
or otherwise not available.

Also try to load the null_blk module in _configure_null_blk as
_init_null_blk is optional now and we thus can't rely on the module
to be loaded.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 common/null_blk | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/common/null_blk b/common/null_blk
index 6611db0..30d54c2 100644
--- a/common/null_blk
+++ b/common/null_blk
@@ -4,8 +4,10 @@
 #
 # null_blk helper functions.
 
+. common/shellcheck
+
 _have_null_blk() {
-	_have_modules null_blk
+	_have_driver null_blk
 }
 
 _remove_null_blk_devices() {
@@ -22,6 +24,7 @@ _init_null_blk() {
 	if (( RUN_FOR_ZONED )); then zoned="zoned=1"; fi
 
 	if ! modprobe -r null_blk || ! modprobe null_blk "$@" "${zoned}" ; then
+		SKIP_REASON="requires modular null_blk"
 		return 1
 	fi
 
@@ -32,8 +35,12 @@ _init_null_blk() {
 # Configure one null_blk instance with name $1 and parameters $2..${$#}.
 _configure_null_blk() {
 	local nullb=/sys/kernel/config/nullb/$1 param val
-
 	shift
+
+	if [[ ! -d /sys/module/null_blk ]]; then
+		modprobe -q null_blk
+	fi
+
 	mkdir "$nullb" || return $?
 	while [[ $# -gt 0 ]]; do
 		param="${1%%=*}"
@@ -46,5 +53,5 @@ _configure_null_blk() {
 _exit_null_blk() {
 	_remove_null_blk_devices
 	udevadm settle
-	modprobe -r null_blk
+	modprobe -r -q null_blk
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 03/13] common/null_blk: respect RUN_FOR_ZONED in _configure_null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 01/13] common/null_blk: remove explicit queue_mode=2 parameters Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 02/13] common/null_blk: allow _configure_null_blk with built-in null_blk Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 04/13] block/029: don't require modular null_blk Christoph Hellwig
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Create zoned devices in _configure_null_blk when RUN_FOR_ZONED is
set, just like it is done in _init_null_blk

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 common/null_blk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/null_blk b/common/null_blk
index 30d54c2..918ba44 100644
--- a/common/null_blk
+++ b/common/null_blk
@@ -42,6 +42,11 @@ _configure_null_blk() {
 	fi
 
 	mkdir "$nullb" || return $?
+
+	if (( RUN_FOR_ZONED )); then
+		echo "1" > "$nullb/zoned" || return $?
+	fi
+
 	while [[ $# -gt 0 ]]; do
 		param="${1%%=*}"
 		val="${1#*=}"
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 04/13] block/029: don't require modular null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (2 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 03/13] common/null_blk: respect RUN_FOR_ZONED in _configure_null_blk Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 05/13] block/006: convert to use _configure_null_blk Christoph Hellwig
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Drop the call to _init_null_blk and just operate on nullb1 instead,
leaving the default device alone.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/029 | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tests/block/029 b/tests/block/029
index dcf4024..b9a897d 100755
--- a/tests/block/029
+++ b/tests/block/029
@@ -21,25 +21,24 @@ modify_nr_hw_queues() {
 	num_cpus=$(nproc)
 	while [ "$(_uptime_s)" -lt "$deadline" ]; do
 		sleep .1
-		echo 1 > /sys/kernel/config/nullb/nullb0/submit_queues
+		echo 1 > /sys/kernel/config/nullb/nullb1/submit_queues
 		sleep .1
-		echo "$num_cpus" > /sys/kernel/config/nullb/nullb0/submit_queues
+		echo "$num_cpus" > /sys/kernel/config/nullb/nullb1/submit_queues
 	done
 }
 
 test() {
-	local sq=/sys/kernel/config/nullb/nullb0/submit_queues
+	local sq=/sys/kernel/config/nullb/nullb1/submit_queues
 
 	: "${TIMEOUT:=30}"
-	_init_null_blk nr_devices=0 &&
-	_configure_null_blk nullb0 completion_nsec=0 blocksize=512 \
+	_configure_null_blk nullb1 completion_nsec=0 blocksize=512 \
 			    size=16 memory_backed=1 power=1 &&
 	if { echo 1 >$sq; } 2>/dev/null; then
 		modify_nr_hw_queues &
 		fio --rw=randwrite --bs=4K --loops=$((10**6)) \
 		    --iodepth=64 --group_reporting --sync=1 --direct=1 \
-		    --ioengine=libaio --filename="/dev/nullb0" \
-		    --runtime="${TIMEOUT}" --name=nullb0 \
+		    --ioengine=libaio --filename="/dev/nullb1" \
+		    --runtime="${TIMEOUT}" --name=nullb1 \
 		    --output="${RESULTS_DIR}/block/fio-output-029.txt" \
 		    >>"$FULL"
 		wait
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 05/13] block/006: convert to use _configure_null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (3 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 04/13] block/029: don't require modular null_blk Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 06/13] block/016: " Christoph Hellwig
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/006 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/block/006 b/tests/block/006
index 7ca1021..7d05b11 100755
--- a/tests/block/006
+++ b/tests/block/006
@@ -24,18 +24,18 @@ test() {
 	_divide_timeout 2
 	FIO_PERF_FIELDS=("read iops")
 
-	if ! _init_null_blk submit_queues=2 blocking=1; then
+	if ! _configure_null_blk nullb1 submit_queues=2 blocking=1 power=1; then
 		return 1
 	fi
 
 	# run sync test
 	_fio_perf --bs=4k --ioengine=sync --rw=randread --norandommap --name=sync \
-		--filename=/dev/nullb0 --size=5g --direct=1
+		--filename=/dev/nullb1 --size=5g --direct=1
 
 	# run async test
 	_fio_perf --bs=4k --ioengine=libaio --iodepth=8 --numjobs="$(nproc)" \
 		--rw=randread --norandommap --name=async \
-		--filename=/dev/nullb0 --size=5g --direct=1
+		--filename=/dev/nullb1 --size=5g --direct=1
 
 	_exit_null_blk
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 06/13] block/016: convert to use _configure_null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (4 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 05/13] block/006: convert to use _configure_null_blk Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 07/13] block/017: " Christoph Hellwig
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/016 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/block/016 b/tests/block/016
index 2b7a05f..775069c 100755
--- a/tests/block/016
+++ b/tests/block/016
@@ -20,21 +20,22 @@ requires() {
 test() {
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk irqmode=2 completion_nsec=2000000000; then
+	if ! _configure_null_blk nullb1 irqmode=2 completion_nsec=2000000000 \
+			power=1; then
 		return 1
 	fi
 
 	# Start an I/O, which will take two seconds.
-	dd if=/dev/nullb0 of=/dev/null bs=512 iflag=direct count=1 status=none &
+	dd if=/dev/nullb1 of=/dev/null bs=512 iflag=direct count=1 status=none &
 	sleep 0.5
 
 	# This will freeze the queue, and since we have an I/O in flight, it
 	# will stay frozen until the I/O completes.
-	echo 64 > /sys/block/nullb0/queue/nr_requests &
+	echo 64 > /sys/block/nullb1/queue/nr_requests &
 	sleep 0.5
 
 	# Do an I/O, which will wait for the queue to unfreeze.
-	dd if=/dev/nullb0 of=/dev/null bs=512 iflag=direct count=1 status=none &
+	dd if=/dev/nullb1 of=/dev/null bs=512 iflag=direct count=1 status=none &
 	sleep 0.5
 
 	# While dd is blocked, send a signal which we know dd has a handler
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 07/13] block/017: convert to use _configure_null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (5 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 06/13] block/016: " Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 08/13] block/018: " Christoph Hellwig
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/017 | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tests/block/017 b/tests/block/017
index c84b661..8596888 100755
--- a/tests/block/017
+++ b/tests/block/017
@@ -19,23 +19,24 @@ requires() {
 
 show_inflight() {
 	awk '{ printf "sysfs inflight reads %d\nsysfs inflight writes %d\n", $1, $2 }' \
-		/sys/block/nullb0/inflight
-	awk '{ print "sysfs stat " $9 }' /sys/block/nullb0/stat
-	awk '$3 == "nullb0" { print "diskstats " $12 }' /proc/diskstats
+		/sys/block/nullb1/inflight
+	awk '{ print "sysfs stat " $9 }' /sys/block/nullb1/stat
+	awk '$3 == "nullb1" { print "diskstats " $12 }' /proc/diskstats
 }
 
 test() {
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk irqmode=2 completion_nsec=500000000; then
+	if ! _configure_null_blk nullb1 irqmode=2 completion_nsec=500000000 \
+			power=1; then
 		return 1
 	fi
 
-	dd if=/dev/nullb0 of=/dev/null bs=4096 iflag=direct count=1 status=none &
+	dd if=/dev/nullb1 of=/dev/null bs=4096 iflag=direct count=1 status=none &
 	sleep 0.1
 	show_inflight
 
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1 status=none &
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1 status=none &
 	sleep 0.1
 	show_inflight
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 08/13] block/018: convert to use _configure_null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (6 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 07/13] block/017: " Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 09/13] block/020: " Christoph Hellwig
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/018 | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/tests/block/018 b/tests/block/018
index a80ecbc..e7ac445 100755
--- a/tests/block/018
+++ b/tests/block/018
@@ -15,13 +15,13 @@ requires() {
 }
 
 init_times() {
-	init_read_ms="$(awk '{ print $4 }' /sys/block/nullb0/stat)"
-	init_write_ms="$(awk '{ print $8 }' /sys/block/nullb0/stat)"
+	init_read_ms="$(awk '{ print $4 }' /sys/block/nullb1/stat)"
+	init_write_ms="$(awk '{ print $8 }' /sys/block/nullb1/stat)"
 }
 
 show_times() {
-	read_ms="$(awk '{ print $4 }' /sys/block/nullb0/stat)"
-	write_ms="$(awk '{ print $8 }' /sys/block/nullb0/stat)"
+	read_ms="$(awk '{ print $4 }' /sys/block/nullb1/stat)"
+	write_ms="$(awk '{ print $8 }' /sys/block/nullb1/stat)"
 
 	# Print rounded to the nearest second
 	printf 'read %d s\n' $(((read_ms - init_read_ms + 500) / 1000))
@@ -33,22 +33,23 @@ test() {
 
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk irqmode=2 completion_nsec=1000000000; then
+	if ! _configure_null_blk nullb1 irqmode=2 completion_nsec=1000000000 \
+			power=1; then
 		return 1
 	fi
 
 	init_times
 	show_times
 
-	dd if=/dev/nullb0 of=/dev/null bs=4096 iflag=direct count=1 status=none
+	dd if=/dev/nullb1 of=/dev/null bs=4096 iflag=direct count=1 status=none
 	show_times
 
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1 status=none
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1 status=none
 	show_times
 
-	dd if=/dev/nullb0 of=/dev/null bs=4096 iflag=direct count=1 status=none &
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1 status=none &
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1 status=none &
+	dd if=/dev/nullb1 of=/dev/null bs=4096 iflag=direct count=1 status=none &
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1 status=none &
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1 status=none &
 	wait
 	show_times
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 09/13] block/020: convert to use _configure_null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (7 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 08/13] block/018: " Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 10/13] block/021: " Christoph Hellwig
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/020 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/block/020 b/tests/block/020
index eef63cb..3e8cbbd 100755
--- a/tests/block/020
+++ b/tests/block/020
@@ -20,14 +20,14 @@ requires() {
 test() {
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk irqmode=2 completion_nsec=2000000 \
-	     submit_queues=4 hw_queue_depth=1; then
+	if ! _configure_null_blk nullb1 irqmode=2 completion_nsec=2000000 \
+	     submit_queues=4 hw_queue_depth=1 power=1; then
 		return 1
 	fi
 
 	local scheds
 	# shellcheck disable=SC2207
-	scheds=($(sed 's/[][]//g' /sys/block/nullb0/queue/scheduler))
+	scheds=($(sed 's/[][]//g' /sys/block/nullb1/queue/scheduler))
 
 	local max_iodepth=$(($(cat /proc/sys/fs/aio-max-nr) / $(nproc)))
 	local iodepth=1024
@@ -36,10 +36,10 @@ test() {
 	fi
 	for sched in "${scheds[@]}"; do
 		echo "Testing $sched" >> "$FULL"
-		echo "$sched" > /sys/block/nullb0/queue/scheduler
+		echo "$sched" > /sys/block/nullb1/queue/scheduler
 		_fio_perf --bs=4k --ioengine=libaio --iodepth=$iodepth \
 			--numjobs="$(nproc)" --rw=randread --name=async \
-			--filename=/dev/nullb0 --size=1g --direct=1 \
+			--filename=/dev/nullb1 --size=1g --direct=1 \
 			--runtime=10
 	done
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 10/13] block/021: convert to use _configure_null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (8 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 09/13] block/020: " Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 11/13] block/023: " Christoph Hellwig
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/021 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/block/021 b/tests/block/021
index a1bbf45..89ebcd0 100755
--- a/tests/block/021
+++ b/tests/block/021
@@ -20,7 +20,7 @@ requires() {
 test() {
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk; then
+	if ! _configure_null_blk nullb1 power=1; then
 		return 1
 	fi
 
@@ -28,14 +28,14 @@ test() {
 	local nr
 	local scheds
 	# shellcheck disable=SC2207
-	scheds=($(sed 's/[][]//g' /sys/block/nullb0/queue/scheduler))
+	scheds=($(sed 's/[][]//g' /sys/block/nullb1/queue/scheduler))
 
 	for sched in "${scheds[@]}"; do
 		echo "Testing $sched" >> "$FULL"
-		echo "$sched" > /sys/block/nullb0/queue/scheduler
-		max_nr="$(cat /sys/block/nullb0/queue/nr_requests)"
+		echo "$sched" > /sys/block/nullb1/queue/scheduler
+		max_nr="$(cat /sys/block/nullb1/queue/nr_requests)"
 		for ((nr = 4; nr <= max_nr; nr++)); do
-			echo "$nr" > /sys/block/nullb0/queue/nr_requests
+			echo "$nr" > /sys/block/nullb1/queue/nr_requests
 		done
 	done
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 11/13] block/023: convert to use _configure_null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (9 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 10/13] block/021: " Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 12/13] block/024: " Christoph Hellwig
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/023 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/block/023 b/tests/block/023
index 0f20f4a..db1cbe0 100755
--- a/tests/block/023
+++ b/tests/block/023
@@ -21,10 +21,11 @@ test() {
 
 	local queue_mode
 	for queue_mode in 0 2; do
-		if _init_null_blk gb=1 queue_mode="$queue_mode"; then
+		if _configure_null_blk nullb1 size=1024 \
+				queue_mode="$queue_mode" power=1; then
 			echo "Queue mode $queue_mode"
-			dd if=/dev/nullb0 of=/dev/null iflag=direct bs=64k status=none
-			dd if=/dev/null of=/dev/nullb0 oflag=direct bs=64k status=none
+			dd if=/dev/nullb1 of=/dev/null iflag=direct bs=64k status=none
+			dd if=/dev/null of=/dev/nullb1 oflag=direct bs=64k status=none
 			_exit_null_blk
 		fi
 	done
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 12/13] block/024: convert to use _configure_null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (10 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 11/13] block/023: " Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-07 12:47 ` [PATCH blktests 13/13] zbd: allow falling back to built-in null_blk Christoph Hellwig
  2022-06-08 10:15 ` allow to run most tests with built-in null_blk v2 Shinichiro Kawasaki
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/024 | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/tests/block/024 b/tests/block/024
index 6808db0..2a7c934 100755
--- a/tests/block/024
+++ b/tests/block/024
@@ -17,13 +17,13 @@ requires() {
 }
 
 init_times() {
-	init_read_ms="$(awk '{ print $4 }' /sys/block/nullb0/stat)"
-	init_write_ms="$(awk '{ print $8 }' /sys/block/nullb0/stat)"
+	init_read_ms="$(awk '{ print $4 }' /sys/block/nullb1/stat)"
+	init_write_ms="$(awk '{ print $8 }' /sys/block/nullb1/stat)"
 }
 
 show_times() {
-	read_ms="$(awk '{ print $4 }' /sys/block/nullb0/stat)"
-	write_ms="$(awk '{ print $8 }' /sys/block/nullb0/stat)"
+	read_ms="$(awk '{ print $4 }' /sys/block/nullb1/stat)"
+	write_ms="$(awk '{ print $8 }' /sys/block/nullb1/stat)"
 
 	# Print rounded to the nearest second
 	printf 'read %d s\n' $(((read_ms - init_read_ms + 500) / 1000))
@@ -37,7 +37,8 @@ test() {
 
 	# The maximum value for CONFIG_HZ is 1000. I.e., a tick is one
 	# millisecond. So, make each I/O take half a millisecond.
-	if ! _init_null_blk irqmode=2 completion_nsec=500000; then
+	if ! _configure_null_blk nullb1 irqmode=2 completion_nsec=500000 \
+			power=1; then
 		return 1
 	fi
 
@@ -46,16 +47,16 @@ test() {
 
 	# 1500 * 0.5 ms is 0.75 seconds, allowing for some overhead so
 	# that it rounds to one second.
-	dd if=/dev/nullb0 of=/dev/null bs=4096 iflag=direct count=1500 status=none
+	dd if=/dev/nullb1 of=/dev/null bs=4096 iflag=direct count=1500 status=none
 	show_times
 
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1500 status=none
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1500 status=none
 	show_times
 
 	# 1800 * 0.5 ms is 0.9 seconds.
-	dd if=/dev/nullb0 of=/dev/null bs=4096 iflag=direct count=1500 status=none &
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1800 status=none &
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1800 status=none &
+	dd if=/dev/nullb1 of=/dev/null bs=4096 iflag=direct count=1500 status=none &
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1800 status=none &
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1800 status=none &
 	wait
 	show_times
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH blktests 13/13] zbd: allow falling back to built-in null_blk
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (11 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 12/13] block/024: " Christoph Hellwig
@ 2022-06-07 12:47 ` Christoph Hellwig
  2022-06-08 10:15 ` allow to run most tests with built-in null_blk v2 Shinichiro Kawasaki
  13 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-07 12:47 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Use _configure_null_blk to configure the fallback device and thus allow
for a built-in null_blk driver.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/zbd/rc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/zbd/rc b/tests/zbd/rc
index 9deadc1..fea55d6 100644
--- a/tests/zbd/rc
+++ b/tests/zbd/rc
@@ -13,7 +13,7 @@
 
 group_requires() {
 	_have_root && _have_program blkzone && _have_program dd &&
-		_have_kernel_option BLK_DEV_ZONED && _have_modules null_blk &&
+		_have_kernel_option BLK_DEV_ZONED && _have_null_blk &&
 		_have_module_param null_blk zoned
 }
 
@@ -25,10 +25,11 @@ group_device_requires() {
 }
 
 _fallback_null_blk_zoned() {
-	if ! _init_null_blk zone_size=4 gb=1 zoned=1 ; then
+	if ! _configure_null_blk nullb1 zone_size=4 size=1024 zoned=1 \
+			power=1; then
 		return 1
 	fi
-	echo /dev/nullb0
+	echo /dev/nullb1
 }
 
 #
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: allow to run most tests with built-in null_blk v2
  2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
                   ` (12 preceding siblings ...)
  2022-06-07 12:47 ` [PATCH blktests 13/13] zbd: allow falling back to built-in null_blk Christoph Hellwig
@ 2022-06-08 10:15 ` Shinichiro Kawasaki
  13 siblings, 0 replies; 16+ messages in thread
From: Shinichiro Kawasaki @ 2022-06-08 10:15 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block

On Jun 07, 2022 / 14:47, Christoph Hellwig wrote:
> Hi Shin'ichiro,
> 
> this series updates most tests that use null_blk so that they can
> work with a built-in null_blk driver.  The onces that require
> shared_tags or failure injection, which currently can only be
> controlled through module parameters still require a module until
> the kernel is updated (which I plan to look into).

Thanks, applied!

-- 
Shin'ichiro Kawasaki

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH blktests 08/13] block/018: convert to use _configure_null_blk
  2022-06-03  4:55 allow to run most tests with built-in null_blk Christoph Hellwig
@ 2022-06-03  4:55 ` Christoph Hellwig
  0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2022-06-03  4:55 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block

Switch to use _configure_null_blk so that built-in null_blk can be
supported, which implies not using the default nullb0 device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/block/018 | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/tests/block/018 b/tests/block/018
index a80ecbc..e7ac445 100755
--- a/tests/block/018
+++ b/tests/block/018
@@ -15,13 +15,13 @@ requires() {
 }
 
 init_times() {
-	init_read_ms="$(awk '{ print $4 }' /sys/block/nullb0/stat)"
-	init_write_ms="$(awk '{ print $8 }' /sys/block/nullb0/stat)"
+	init_read_ms="$(awk '{ print $4 }' /sys/block/nullb1/stat)"
+	init_write_ms="$(awk '{ print $8 }' /sys/block/nullb1/stat)"
 }
 
 show_times() {
-	read_ms="$(awk '{ print $4 }' /sys/block/nullb0/stat)"
-	write_ms="$(awk '{ print $8 }' /sys/block/nullb0/stat)"
+	read_ms="$(awk '{ print $4 }' /sys/block/nullb1/stat)"
+	write_ms="$(awk '{ print $8 }' /sys/block/nullb1/stat)"
 
 	# Print rounded to the nearest second
 	printf 'read %d s\n' $(((read_ms - init_read_ms + 500) / 1000))
@@ -33,22 +33,23 @@ test() {
 
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_null_blk irqmode=2 completion_nsec=1000000000; then
+	if ! _configure_null_blk nullb1 irqmode=2 completion_nsec=1000000000 \
+			power=1; then
 		return 1
 	fi
 
 	init_times
 	show_times
 
-	dd if=/dev/nullb0 of=/dev/null bs=4096 iflag=direct count=1 status=none
+	dd if=/dev/nullb1 of=/dev/null bs=4096 iflag=direct count=1 status=none
 	show_times
 
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1 status=none
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1 status=none
 	show_times
 
-	dd if=/dev/nullb0 of=/dev/null bs=4096 iflag=direct count=1 status=none &
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1 status=none &
-	dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1 status=none &
+	dd if=/dev/nullb1 of=/dev/null bs=4096 iflag=direct count=1 status=none &
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1 status=none &
+	dd if=/dev/zero of=/dev/nullb1 bs=4096 oflag=direct count=1 status=none &
 	wait
 	show_times
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-06-08 10:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 12:47 allow to run most tests with built-in null_blk v2 Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 01/13] common/null_blk: remove explicit queue_mode=2 parameters Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 02/13] common/null_blk: allow _configure_null_blk with built-in null_blk Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 03/13] common/null_blk: respect RUN_FOR_ZONED in _configure_null_blk Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 04/13] block/029: don't require modular null_blk Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 05/13] block/006: convert to use _configure_null_blk Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 06/13] block/016: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 07/13] block/017: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 08/13] block/018: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 09/13] block/020: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 10/13] block/021: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 11/13] block/023: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 12/13] block/024: " Christoph Hellwig
2022-06-07 12:47 ` [PATCH blktests 13/13] zbd: allow falling back to built-in null_blk Christoph Hellwig
2022-06-08 10:15 ` allow to run most tests with built-in null_blk v2 Shinichiro Kawasaki
  -- strict thread matches above, loose matches on Subject: below --
2022-06-03  4:55 allow to run most tests with built-in null_blk Christoph Hellwig
2022-06-03  4:55 ` [PATCH blktests 08/13] block/018: convert to use _configure_null_blk Christoph Hellwig

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.