All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests] block/35: enable io_uring if it is disabled
@ 2024-11-28 14:30 Frank Liang
  2024-11-29 14:26 ` Jens Axboe
  2024-11-30  4:32 ` Shinichiro Kawasaki
  0 siblings, 2 replies; 4+ messages in thread
From: Frank Liang @ 2024-11-28 14:30 UTC (permalink / raw)
  To: linux-block, osandov; +Cc: Changhui Zhong, Ming Lei, Libing He


[-- Attachment #1.1: Type: text/plain, Size: 1444 bytes --]

Enable io_uring to avoid below test failure.
block/035 (shared tag set fairness)                          [failed]
    runtime    ...  0.540s
    --- tests/block/035.out 2024-09-03 04:31:30.000000000 +0000
    +++ /usr/local/blktests/results/nodev/block/035.out.bad 2024-11-25
17:30:10.726751452 +0000
    @@ -1,2 +1,2 @@
     Running block/035
    -Passed
    +Failed (fio status = 2)

Signed-off-by: Frank Liang <xiliang@redhat.com>
---
 tests/block/035 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/block/035 b/tests/block/035
index 4228dd0..f602e9a 100755
--- a/tests/block/035
+++ b/tests/block/035
@@ -55,6 +55,11 @@ test() {
  echo "Configuring null_blk failed (2/2)"
  return 1
  fi
+ # enable io_uring when it is disabled
+ local io_uring_disabled=$(cat /proc/sys/kernel/io_uring_disabled)
+ if [ $io_uring_disabled != 0 ]; then
+    echo 0 > /proc/sys/kernel/io_uring_disabled
+ fi
  local fio_output=${RESULTS_DIR}/block/fio-output-block-035.txt
  fio --rw=randwrite --ioengine=io_uring --iodepth=64 \
  --direct=1 --runtime="${runtime}" --time_based=1 \
@@ -66,6 +71,10 @@ test() {
  local fio_status=$?
  rmdir /sys/kernel/config/nullb/nullb*
  _exit_null_blk
+ # reset io_uring setting before exits test
+ if [ $io_uring_disabled != 0 ]; then
+    echo $io_uring_disabled > /proc/sys/kernel/io_uring_disabled
+ fi
  if [ $fio_status != 0 ]; then
  echo "Failed (fio status = $fio_status)"
  return
-- 
2.47.0

[-- Attachment #1.2: Type: text/html, Size: 1737 bytes --]

[-- Attachment #2: 0001-block-35-enable-io_uring-if-it-is-disabled.patch --]
[-- Type: text/x-patch, Size: 1662 bytes --]

From d2d64b7ee418c48ab475e13c2081a149d02d7db4 Mon Sep 17 00:00:00 2001
From: Frank Liang <xiliang@redhat.com>
Date: Thu, 28 Nov 2024 22:19:20 +0800
Subject: [PATCH] block/35: enable io_uring if it is disabled

Enable io_uring to avoid below test failure.
block/035 (shared tag set fairness)                          [failed]
    runtime    ...  0.540s
    --- tests/block/035.out	2024-09-03 04:31:30.000000000 +0000
    +++ /usr/local/blktests/results/nodev/block/035.out.bad	2024-11-25 17:30:10.726751452 +0000
    @@ -1,2 +1,2 @@
     Running block/035
    -Passed
    +Failed (fio status = 2)

Signed-off-by: Frank Liang <xiliang@redhat.com>
---
 tests/block/035 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/block/035 b/tests/block/035
index 4228dd0..f602e9a 100755
--- a/tests/block/035
+++ b/tests/block/035
@@ -55,6 +55,11 @@ test() {
 		echo "Configuring null_blk failed (2/2)"
 		return 1
 	fi
+	# enable io_uring when it is disabled
+	local io_uring_disabled=$(cat /proc/sys/kernel/io_uring_disabled)
+	if [ $io_uring_disabled != 0 ]; then
+	    echo 0 > /proc/sys/kernel/io_uring_disabled
+	fi
 	local fio_output=${RESULTS_DIR}/block/fio-output-block-035.txt
 	fio --rw=randwrite --ioengine=io_uring --iodepth=64 \
 		--direct=1 --runtime="${runtime}" --time_based=1 \
@@ -66,6 +71,10 @@ test() {
 	local fio_status=$?
 	rmdir /sys/kernel/config/nullb/nullb*
 	_exit_null_blk
+	# reset io_uring setting before exits test
+	if [ $io_uring_disabled != 0 ]; then
+	    echo $io_uring_disabled > /proc/sys/kernel/io_uring_disabled
+	fi
 	if [ $fio_status != 0 ]; then
 		echo "Failed (fio status = $fio_status)"
 		return
-- 
2.47.0


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

* Re: [PATCH blktests] block/35: enable io_uring if it is disabled
  2024-11-28 14:30 [PATCH blktests] block/35: enable io_uring if it is disabled Frank Liang
@ 2024-11-29 14:26 ` Jens Axboe
  2024-11-30  4:32 ` Shinichiro Kawasaki
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2024-11-29 14:26 UTC (permalink / raw)
  To: Frank Liang, linux-block, osandov; +Cc: Changhui Zhong, Ming Lei, Libing He

Looks fine to me:

Reviewed-by: Jens Axboe <axboe@kernel.dk>

-- 
Jens Axboe


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

* Re: [PATCH blktests] block/35: enable io_uring if it is disabled
  2024-11-28 14:30 [PATCH blktests] block/35: enable io_uring if it is disabled Frank Liang
  2024-11-29 14:26 ` Jens Axboe
@ 2024-11-30  4:32 ` Shinichiro Kawasaki
       [not found]   ` <CAAb+4C4rH70h8ALUKktWqkyvkoij0P=2rbYUtjSzZSQ7vFoAsQ@mail.gmail.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Shinichiro Kawasaki @ 2024-11-30  4:32 UTC (permalink / raw)
  To: Frank Liang
  Cc: linux-block@vger.kernel.org, osandov@fb.com, Changhui Zhong,
	Ming Lei, Libing He

Hello Frank, thank you for finding the issue and fixing it.

I have three comments on the patch:

- I think the io_uring_disabled proc file was introduced with the kernel version
  6.6. To care the kernels older than that, I suggest to check if the proc file
  exists or not before touching it.
- A few ShellCheck warnings to be addressed (SC2155, SC2086).
- Tab indent is preferred to space indent.

IOW, I suggest the change below on top of your patch. May I amend your path
with this change? Or if you like, you can send v2. Please let me know your
preference.

liff --git a/tests/block/035 b/tests/block/035
index f602e9a..8fcc9c6 100755
--- a/tests/block/035
+++ b/tests/block/035
@@ -56,9 +56,12 @@ test() {
 		return 1
 	fi
 	# enable io_uring when it is disabled
-	local io_uring_disabled=$(cat /proc/sys/kernel/io_uring_disabled)
-	if [ $io_uring_disabled != 0 ]; then
-	    echo 0 > /proc/sys/kernel/io_uring_disabled
+	local io_uring_disabled=0
+	if [ -f /proc/sys/kernel/io_uring_disabled ]; then
+		io_uring_disabled=$(cat /proc/sys/kernel/io_uring_disabled)
+		if [ "$io_uring_disabled" != 0 ]; then
+			echo 0 > /proc/sys/kernel/io_uring_disabled
+		fi
 	fi
 	local fio_output=${RESULTS_DIR}/block/fio-output-block-035.txt
 	fio --rw=randwrite --ioengine=io_uring --iodepth=64 \
@@ -72,8 +75,8 @@ test() {
 	rmdir /sys/kernel/config/nullb/nullb*
 	_exit_null_blk
 	# reset io_uring setting before exits test
-	if [ $io_uring_disabled != 0 ]; then
-	    echo $io_uring_disabled > /proc/sys/kernel/io_uring_disabled
+	if [ "$io_uring_disabled" != 0 ]; then
+		echo "$io_uring_disabled" > /proc/sys/kernel/io_uring_disabled
 	fi
 	if [ $fio_status != 0 ]; then
 		echo "Failed (fio status = $fio_status)"

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

* Re: [PATCH blktests] block/35: enable io_uring if it is disabled
       [not found]   ` <CAAb+4C4rH70h8ALUKktWqkyvkoij0P=2rbYUtjSzZSQ7vFoAsQ@mail.gmail.com>
@ 2024-12-03  8:46     ` Shinichiro Kawasaki
  0 siblings, 0 replies; 4+ messages in thread
From: Shinichiro Kawasaki @ 2024-12-03  8:46 UTC (permalink / raw)
  To: Frank Liang
  Cc: linux-block@vger.kernel.org, osandov@fb.com, Changhui Zhong,
	Ming Lei, Libing He

On Dec 01, 2024 / 22:40, Frank Liang wrote:
> Thanks, Kawasaki
> 
> Please feel free to amend the patch.

Thanks! I have applied the patch

> 
> How about keeping the reset part after the fio? It is good to restore the
> default setting.
> 
> # reset io_uring setting before exits test
> -       if [ $io_uring_disabled != 0 ]; then
> -           echo $io_uring_disabled > /proc/sys/kernel/io_uring_disabled

Yes, we should keep that part. Please confirm the the amended commit is ok.

https://github.com/osandov/blktests/commit/dadbcb0e681bcf54f53a79785dae9ef2deee1952

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

end of thread, other threads:[~2024-12-03  8:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-28 14:30 [PATCH blktests] block/35: enable io_uring if it is disabled Frank Liang
2024-11-29 14:26 ` Jens Axboe
2024-11-30  4:32 ` Shinichiro Kawasaki
     [not found]   ` <CAAb+4C4rH70h8ALUKktWqkyvkoij0P=2rbYUtjSzZSQ7vFoAsQ@mail.gmail.com>
2024-12-03  8:46     ` Shinichiro Kawasaki

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.