* [PATCH blktests v2 0/2] Add a test that triggers blk_mq_update_nr_hw_queues()
@ 2019-10-24 21:03 Bart Van Assche
2019-10-24 21:03 ` [PATCH blktests v2 1/2] Move and rename uptime_s() Bart Van Assche
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bart Van Assche @ 2019-10-24 21:03 UTC (permalink / raw)
To: Omar Sandoval
Cc: linux-block, Johannes Thumshirn, Chaitanya Kulkarni, Bart Van Assche
Hi Omar,
This patch series includes the test that I used to verify my recently posted
blk_mq_update_nr_hw_queues() patches. Please consider these patches for
inclusion in the blktests repository.
Thanks,
Bart.
Changes compared to v1:
- _uptime_s() now uses awk to read /proc/uptime.
- Removed subshells from tests/block/029.
- Changed find ... | wc -l into nproc.
- Skip kernel versions that do not support modifying the null_blk submit_queues
attribute.
Bart Van Assche (2):
Move and rename uptime_s()
Add a test that triggers blk_mq_update_nr_hw_queues()
common/multipath-over-rdma | 9 +-----
common/rc | 5 +++
tests/block/029 | 64 ++++++++++++++++++++++++++++++++++++++
tests/block/029.out | 1 +
tests/nvmeof-mp/rc | 2 +-
tests/srp/014 | 2 +-
tests/srp/rc | 2 +-
7 files changed, 74 insertions(+), 11 deletions(-)
create mode 100755 tests/block/029
create mode 100644 tests/block/029.out
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH blktests v2 1/2] Move and rename uptime_s()
2019-10-24 21:03 [PATCH blktests v2 0/2] Add a test that triggers blk_mq_update_nr_hw_queues() Bart Van Assche
@ 2019-10-24 21:03 ` Bart Van Assche
2019-10-24 21:03 ` [PATCH blktests v2 2/2] Add a test that triggers blk_mq_update_nr_hw_queues() Bart Van Assche
2019-10-30 20:45 ` [PATCH blktests v2 0/2] " Omar Sandoval
2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2019-10-24 21:03 UTC (permalink / raw)
To: Omar Sandoval
Cc: linux-block, Johannes Thumshirn, Chaitanya Kulkarni, Bart Van Assche
Make it easy to use the uptime_s() function from block tests. Change the
implementation of this function into something that is easier to read.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
common/multipath-over-rdma | 9 +--------
common/rc | 5 +++++
tests/nvmeof-mp/rc | 2 +-
tests/srp/014 | 2 +-
tests/srp/rc | 2 +-
5 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma
index 65ebb7b7f5f7..545a81e8c18e 100644
--- a/common/multipath-over-rdma
+++ b/common/multipath-over-rdma
@@ -129,19 +129,12 @@ held_by() {
done
}
-# System uptime in seconds.
-uptime_s() {
- local a b
-
- echo "$(</proc/uptime)" | { read -r a b && echo "${a%%.*}"; }
-}
-
# Sleep until either $1 seconds have elapsed or until the deadline $2 has been
# reached. Return 1 if and only if the deadline has been met.
sleep_until() {
local duration=$1 deadline=$2 u
- u=$(uptime_s)
+ u=$(_uptime_s)
if [ $((u + duration)) -le "$deadline" ]; then
sleep "$duration"
else
diff --git a/common/rc b/common/rc
index 41aee3aaa735..87b1e0718382 100644
--- a/common/rc
+++ b/common/rc
@@ -246,3 +246,8 @@ _test_dev_is_partition() {
_filter_xfs_io_error() {
sed -e 's/^\(.*\)64\(: .*$\)/\1\2/'
}
+
+# System uptime in seconds.
+_uptime_s() {
+ awk '{ print int($1) }' /proc/uptime
+}
diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc
index 2493fcee12de..278843a1270d 100755
--- a/tests/nvmeof-mp/rc
+++ b/tests/nvmeof-mp/rc
@@ -113,7 +113,7 @@ simulate_network_failure_loop() {
[ -e "$dev" ] || return $?
[ -n "$duration" ] || return $?
- deadline=$(($(uptime_s) + duration))
+ deadline=$(($(_uptime_s) + duration))
while [ $rc = 0 ]; do
sleep_until 5 ${deadline} || break
for d in $(held_by "$dev"); do
diff --git a/tests/srp/014 b/tests/srp/014
index 8ecd8a439a82..7afde6284b83 100755
--- a/tests/srp/014
+++ b/tests/srp/014
@@ -69,7 +69,7 @@ sg_reset_loop() {
[ -e "$dev" ] || return $?
[ -n "$duration" ] || return $?
reset_type=(-d -b)
- deadline=$(($(uptime_s) + duration))
+ deadline=$(($(_uptime_s) + duration))
while true; do
sleep_until 1 ${deadline} || break
cmd="sg_reset --no-esc ${reset_type[i++ % 2]} $dev"
diff --git a/tests/srp/rc b/tests/srp/rc
index 696d94e5fb97..a1bc09b496ec 100755
--- a/tests/srp/rc
+++ b/tests/srp/rc
@@ -247,7 +247,7 @@ simulate_network_failure_loop() {
[ -e "$dev" ] || return $?
[ -n "$duration" ] || return $?
- deadline=$(($(uptime_s) + duration))
+ deadline=$(($(_uptime_s) + duration))
s=5
while [ $rc = 0 ]; do
sleep_until 5 ${deadline} || break
--
2.24.0.rc0.303.g954a862665-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH blktests v2 2/2] Add a test that triggers blk_mq_update_nr_hw_queues()
2019-10-24 21:03 [PATCH blktests v2 0/2] Add a test that triggers blk_mq_update_nr_hw_queues() Bart Van Assche
2019-10-24 21:03 ` [PATCH blktests v2 1/2] Move and rename uptime_s() Bart Van Assche
@ 2019-10-24 21:03 ` Bart Van Assche
2019-10-30 20:45 ` [PATCH blktests v2 0/2] " Omar Sandoval
2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2019-10-24 21:03 UTC (permalink / raw)
To: Omar Sandoval
Cc: linux-block, Johannes Thumshirn, Chaitanya Kulkarni, Bart Van Assche
Note: the newly added test script only triggers blk_mq_update_nr_hw_queues()
for kernel versions that include commit 45919fbfe1c4 ("null_blk: Enable
modifying 'submit_queues' after an instance has been configured").
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
tests/block/029 | 64 +++++++++++++++++++++++++++++++++++++++++++++
tests/block/029.out | 1 +
2 files changed, 65 insertions(+)
create mode 100755 tests/block/029
create mode 100644 tests/block/029.out
diff --git a/tests/block/029 b/tests/block/029
new file mode 100755
index 000000000000..d298bac8db5c
--- /dev/null
+++ b/tests/block/029
@@ -0,0 +1,64 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2019 Google LLC
+#
+# Trigger blk_mq_update_nr_hw_queues().
+
+. tests/block/rc
+. common/null_blk
+
+DESCRIPTION="trigger blk_mq_update_nr_hw_queues()"
+QUICK=1
+
+requires() {
+ _have_null_blk
+}
+
+# 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" &&
+ echo 1 > "$nullb0/memory_backed" &&
+ echo 1 > "$nullb0/power" &&
+ ls -l /dev/nullb* &>>"$FULL"
+}
+
+modify_nr_hw_queues() {
+ local deadline num_cpus
+
+ deadline=$(($(_uptime_s) + TIMEOUT))
+ num_cpus=$(nproc)
+ while [ "$(_uptime_s)" -lt "$deadline" ]; do
+ sleep .1
+ echo 1 > /sys/kernel/config/nullb/nullb0/submit_queues
+ sleep .1
+ echo "$num_cpus" > /sys/kernel/config/nullb/nullb0/submit_queues
+ done
+}
+
+test() {
+ local sq=/sys/kernel/config/nullb/nullb0/submit_queues
+
+ : "${TIMEOUT:=30}"
+ _init_null_blk nr_devices=0 queue_mode=2 &&
+ configure_null_blk
+ 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 \
+ --output="${RESULTS_DIR}/block/fio-output-029.txt" \
+ >>"$FULL"
+ wait
+ 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/029.out b/tests/block/029.out
new file mode 100644
index 000000000000..863339fb8ced
--- /dev/null
+++ b/tests/block/029.out
@@ -0,0 +1 @@
+Passed
--
2.24.0.rc0.303.g954a862665-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH blktests v2 0/2] Add a test that triggers blk_mq_update_nr_hw_queues()
2019-10-24 21:03 [PATCH blktests v2 0/2] Add a test that triggers blk_mq_update_nr_hw_queues() Bart Van Assche
2019-10-24 21:03 ` [PATCH blktests v2 1/2] Move and rename uptime_s() Bart Van Assche
2019-10-24 21:03 ` [PATCH blktests v2 2/2] Add a test that triggers blk_mq_update_nr_hw_queues() Bart Van Assche
@ 2019-10-30 20:45 ` Omar Sandoval
2 siblings, 0 replies; 4+ messages in thread
From: Omar Sandoval @ 2019-10-30 20:45 UTC (permalink / raw)
To: Bart Van Assche
Cc: Omar Sandoval, linux-block, Johannes Thumshirn, Chaitanya Kulkarni
On Thu, Oct 24, 2019 at 02:03:50PM -0700, Bart Van Assche wrote:
> Hi Omar,
>
> This patch series includes the test that I used to verify my recently posted
> blk_mq_update_nr_hw_queues() patches. Please consider these patches for
> inclusion in the blktests repository.
>
> Thanks,
>
> Bart.
>
> Changes compared to v1:
> - _uptime_s() now uses awk to read /proc/uptime.
> - Removed subshells from tests/block/029.
> - Changed find ... | wc -l into nproc.
> - Skip kernel versions that do not support modifying the null_blk submit_queues
> attribute.
>
> Bart Van Assche (2):
> Move and rename uptime_s()
> Add a test that triggers blk_mq_update_nr_hw_queues()
Thanks, Bart, applied and pushed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-30 20:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24 21:03 [PATCH blktests v2 0/2] Add a test that triggers blk_mq_update_nr_hw_queues() Bart Van Assche
2019-10-24 21:03 ` [PATCH blktests v2 1/2] Move and rename uptime_s() Bart Van Assche
2019-10-24 21:03 ` [PATCH blktests v2 2/2] Add a test that triggers blk_mq_update_nr_hw_queues() Bart Van Assche
2019-10-30 20:45 ` [PATCH blktests v2 0/2] " Omar Sandoval
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.