diff mbox series

[blktests,3/5] tests/nvmeof-mp/012: fix the schedulers list

Message ID 20201124010427.18595-4-yi.zhang@redhat.com (mailing list archive)
State New, archived
Headers show
Series nvmeof-mp/srp/nvme-rdma misc fix and enhancement | expand

Commit Message

Yi Zhang Nov. 24, 2020, 1:04 a.m. UTC
There is no cfg scheduler and new added kyber scheduler in lastest kernel,
so get the scheduler from sysfs

To reproduce it:
$ ./check nvmeof-mp/012
nvmeof-mp/012 (dm-mpath on top of multiple I/O schedulers)   [passed]
    runtime  5.922s  ...  8.804s

$ cat results/nodev/nvmeof-mp/012.full  | grep -n "Changing scheduler"
31:Changing scheduler of dm-3 from mq-deadline kyber [bfq] none into cfq failed
47:Changing scheduler of dm-3 from mq-deadline kyber [bfq] none into cfq failed

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
---
 tests/nvmeof-mp/012 | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Bart Van Assche Nov. 24, 2020, 3:28 a.m. UTC | #1
On 11/23/20 5:04 PM, Yi Zhang wrote:
> There is no cfg scheduler and new added kyber scheduler in lastest kernel,
              ^^^
              cfq?
> so get the scheduler from sysfs

[ ... ]

>  	# Load all I/O scheduler kernel modules
>  	for m in "/lib/modules/$(uname -r)/kernel/block/"*.ko; do
> @@ -17,15 +17,17 @@ test_io_schedulers() {
>  	for mq in y n; do
>  		use_blk_mq ${mq} || return $?
>  		dev=$(get_bdev 0) || return $?
> -		for sched in noop deadline bfq cfq; do
> -			set_scheduler "$(basename "$(readlink -f "${dev}")")" $sched \
> +		dm=$(basename "$(readlink -f "${dev}")") || return $?
> +		scheds=$(sed 's/[][]//g' /sys/block/"$dm"/queue/scheduler) || return $?
> +		for sched in $scheds; do
> +			set_scheduler "$dm" "$sched" \

Similar code occurs in tests/srp/012. Please introduce a function for
retrieving the scheduler list and also update tests/srp/012.

Thanks,

Bart.
Yi Zhang Nov. 24, 2020, 2:06 p.m. UTC | #2
On 11/24/20 11:28 AM, Bart Van Assche wrote:
> On 11/23/20 5:04 PM, Yi Zhang wrote:
>> There is no cfg scheduler and new added kyber scheduler in lastest kernel,
>                ^^^
>                cfq?
Thanks.
>> so get the scheduler from sysfs
> [ ... ]
>
>>   	# Load all I/O scheduler kernel modules
>>   	for m in "/lib/modules/$(uname -r)/kernel/block/"*.ko; do
>> @@ -17,15 +17,17 @@ test_io_schedulers() {
>>   	for mq in y n; do
>>   		use_blk_mq ${mq} || return $?
>>   		dev=$(get_bdev 0) || return $?
>> -		for sched in noop deadline bfq cfq; do
>> -			set_scheduler "$(basename "$(readlink -f "${dev}")")" $sched \
>> +		dm=$(basename "$(readlink -f "${dev}")") || return $?
>> +		scheds=$(sed 's/[][]//g' /sys/block/"$dm"/queue/scheduler) || return $?
>> +		for sched in $scheds; do
>> +			set_scheduler "$dm" "$sched" \
> Similar code occurs in tests/srp/012. Please introduce a function for
> retrieving the scheduler list and also update tests/srp/012.
OK, will add below function and update both nvmeof-mp/012 and srp/012

diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma
index d0fec6f..d156a12 100644
--- a/common/multipath-over-rdma
+++ b/common/multipath-over-rdma
@@ -326,6 +326,18 @@ set_scheduler() {
         fi
  }

+# Get block dev scheduler list
+get_scheduler_list() {
+       local b=$1 p
+       p=/sys/block/"$b"/queue/scheduler
+       if [ -e "$p" ]; then
+               scheds=$(sed 's/[][]//g' /sys/block/"$b"/queue/scheduler)
+               echo "$scheds"
+       else
+               return 1
+       fi
+}
+

> Thanks,
>
> Bart.
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
>
diff mbox series

Patch

diff --git a/tests/nvmeof-mp/012 b/tests/nvmeof-mp/012
index ae6a92c..96adc70 100755
--- a/tests/nvmeof-mp/012
+++ b/tests/nvmeof-mp/012
@@ -8,7 +8,7 @@  DESCRIPTION="dm-mpath on top of multiple I/O schedulers"
 QUICK=1
 
 test_io_schedulers() {
-	local dev m
+	local dev m dm scheds
 
 	# Load all I/O scheduler kernel modules
 	for m in "/lib/modules/$(uname -r)/kernel/block/"*.ko; do
@@ -17,15 +17,17 @@  test_io_schedulers() {
 	for mq in y n; do
 		use_blk_mq ${mq} || return $?
 		dev=$(get_bdev 0) || return $?
-		for sched in noop deadline bfq cfq; do
-			set_scheduler "$(basename "$(readlink -f "${dev}")")" $sched \
+		dm=$(basename "$(readlink -f "${dev}")") || return $?
+		scheds=$(sed 's/[][]//g' /sys/block/"$dm"/queue/scheduler) || return $?
+		for sched in $scheds; do
+			set_scheduler "$dm" "$sched" \
 				      >>"$FULL" 2>&1 || continue
 			echo "I/O scheduler: $sched; use_blk_mq: $mq" >>"$FULL"
 			run_fio --verify=md5 --rw=randwrite --bs=4K --size=64K \
 				--ioengine=libaio --iodepth=64 \
 				--iodepth_batch=32 --group_reporting --sync=1 \
 				--direct=1 --filename="$dev" \
-				--name=${sched} --thread --numjobs=1 \
+				--name="${sched}" --thread --numjobs=1 \
 				--output="${RESULTS_DIR}/nvmeof-mp/012-${sched}-${mq}.txt" \
 				>>"$FULL" ||
 				return $?