All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests] block: add test for io hang due to blk-iolatency
@ 2019-01-29 23:54 Liu Bo
  2019-01-30  3:46 ` Chaitanya Kulkarni
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Bo @ 2019-01-29 23:54 UTC (permalink / raw)
  To: linux-block

Add test for verifying io hang when enabling blk-iolatency after a few
IOs have been done.

This is a regression test for
"blk-iolatency: fix IO hang due to negative inflight counter".

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
 tests/block/022     | 42 ++++++++++++++++++++++++++++++++++++++++++
 tests/block/022.out |  2 ++
 2 files changed, 44 insertions(+)
 create mode 100755 tests/block/022
 create mode 100644 tests/block/022.out

diff --git a/tests/block/022 b/tests/block/022
new file mode 100755
index 0000000..6e5ab42
--- /dev/null
+++ b/tests/block/022
@@ -0,0 +1,42 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2019 Bo Liu <bo.liu@linux.alibaba.com>
+#
+# This test is a regression test for io hang due to blk-iolatency, the patch is
+# "blk-iolatency: fix IO hang due to negative inflight counter"
+
+. tests/block/rc
+. common/cgroup
+. common/null_blk
+DESCRIPTION="This test will demonstrate io hang due to blk-iolatency"
+
+requires() {
+	_have_null_blk && _have_cgroup2_controller_file io io.latency
+}
+
+test() {
+	local CGROUP2_DIR
+	local dir
+	echo "Running ${TEST_NAME}"
+
+	if ! _init_null_blk queue_mode=2; then
+		return 1
+	fi
+
+	_init_cgroup2
+	dir=$(_cgroup2_base_dir)
+
+	echo $$ > ${CGROUP2_DIR}/cgroup.procs
+	xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0
+
+	# target=1s
+	echo "`cat /sys/block/nullb0/dev` target=1000000" > ${CGROUP2_DIR}/io.latency
+
+	xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0
+
+	echo $$ > ${dir}/cgroup.procs
+	_exit_cgroup2
+	_exit_null_blk
+
+	echo "Test complete"
+}
diff --git a/tests/block/022.out b/tests/block/022.out
new file mode 100644
index 0000000..14d43cb
--- /dev/null
+++ b/tests/block/022.out
@@ -0,0 +1,2 @@
+Running block/022
+Test complete
-- 
2.20.1.2.gb21ebb6


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

* Re: [PATCH blktests] block: add test for io hang due to blk-iolatency
  2019-01-29 23:54 [PATCH blktests] block: add test for io hang due to blk-iolatency Liu Bo
@ 2019-01-30  3:46 ` Chaitanya Kulkarni
  2019-01-30 22:55   ` Liu Bo
  0 siblings, 1 reply; 3+ messages in thread
From: Chaitanya Kulkarni @ 2019-01-30  3:46 UTC (permalink / raw)
  To: Liu Bo, linux-block

Thanks for the test Liu, please see my inline comments.

From: linux-block-owner@vger.kernel.org <linux-block-owner@vger.kernel.org> on behalf of Liu Bo <bo.liu@linux.alibaba.com>
Sent: Tuesday, January 29, 2019 3:54 PM
To: linux-block@vger.kernel.org
Subject: [PATCH blktests] block: add test for io hang due to blk-iolatency
 
Add test for verifying io hang when enabling blk-iolatency after a few
IOs have been done.

This is a regression test for
"blk-iolatency: fix IO hang due to negative inflight counter".

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
 tests/block/022     | 42 ++++++++++++++++++++++++++++++++++++++++++
 tests/block/022.out |  2 ++
 2 files changed, 44 insertions(+)
 create mode 100755 tests/block/022
 create mode 100644 tests/block/022.out

diff --git a/tests/block/022 b/tests/block/022
new file mode 100755
index 0000000..6e5ab42
--- /dev/null
+++ b/tests/block/022
@@ -0,0 +1,42 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2019 Bo Liu <bo.liu@linux.alibaba.com>
+#
+# This test is a regression test for io hang due to blk-iolatency, the patch is
+# "blk-iolatency: fix IO hang due to negative inflight counter"
+
+. tests/block/rc
+. common/cgroup
+. common/null_blk
+DESCRIPTION="This test will demonstrate io hang due to blk-iolatency"
+
+requires() {
+       _have_null_blk && _have_cgroup2_controller_file io io.latency
need to add _have_program xfs_io here.
+}
+
+test() {
+       local CGROUP2_DIR
+       local dir
+       echo "Running ${TEST_NAME}"
+
+       if ! _init_null_blk queue_mode=2; then
may be print a error message here and/or skip the test instred of just return  ?
+               return 1
+       fi
+
+       _init_cgroup2
+       dir=$(_cgroup2_base_dir)
+
I'm little bit confused, CGROUP2_DIR is not initialize or its an environment variable ?
+       echo $$ > ${CGROUP2_DIR}/cgroup.procs
+       xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0
+
+       # target=1s
+       echo "`cat /sys/block/nullb0/dev` target=1000000" > ${CGROUP2_DIR}/io.latency
+
+       xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0
+
+       echo $$ > ${dir}/cgroup.procs
+       _exit_cgroup2
+       _exit_null_blk
+
+       echo "Test complete"
+}
diff --git a/tests/block/022.out b/tests/block/022.out
new file mode 100644
index 0000000..14d43cb
--- /dev/null
+++ b/tests/block/022.out
@@ -0,0 +1,2 @@
+Running block/022
+Test complete
-- 
2.20.1.2.gb21ebb6


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

* Re: [PATCH blktests] block: add test for io hang due to blk-iolatency
  2019-01-30  3:46 ` Chaitanya Kulkarni
@ 2019-01-30 22:55   ` Liu Bo
  0 siblings, 0 replies; 3+ messages in thread
From: Liu Bo @ 2019-01-30 22:55 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block

On Wed, Jan 30, 2019 at 03:46:45AM +0000, Chaitanya Kulkarni wrote:
> Thanks for the test Liu, please see my inline comments.
> 
> From: linux-block-owner@vger.kernel.org <linux-block-owner@vger.kernel.org> on behalf of Liu Bo <bo.liu@linux.alibaba.com>
> Sent: Tuesday, January 29, 2019 3:54 PM
> To: linux-block@vger.kernel.org
> Subject: [PATCH blktests] block: add test for io hang due to blk-iolatency
>  
> Add test for verifying io hang when enabling blk-iolatency after a few
> IOs have been done.
> 
> This is a regression test for
> "blk-iolatency: fix IO hang due to negative inflight counter".
> 
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
> ---
>  tests/block/022     | 42 ++++++++++++++++++++++++++++++++++++++++++
>  tests/block/022.out |  2 ++
>  2 files changed, 44 insertions(+)
>  create mode 100755 tests/block/022
>  create mode 100644 tests/block/022.out
> 
> diff --git a/tests/block/022 b/tests/block/022
> new file mode 100755
> index 0000000..6e5ab42
> --- /dev/null
> +++ b/tests/block/022
> @@ -0,0 +1,42 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2019 Bo Liu <bo.liu@linux.alibaba.com>
> +#
> +# This test is a regression test for io hang due to blk-iolatency, the patch is
> +# "blk-iolatency: fix IO hang due to negative inflight counter"
> +
> +. tests/block/rc
> +. common/cgroup
> +. common/null_blk
> +DESCRIPTION="This test will demonstrate io hang due to blk-iolatency"
> +
> +requires() {
> +       _have_null_blk && _have_cgroup2_controller_file io io.latency
> need to add _have_program xfs_io here.

OK.

> +}
> +
> +test() {
> +       local CGROUP2_DIR
> +       local dir
> +       echo "Running ${TEST_NAME}"
> +
> +       if ! _init_null_blk queue_mode=2; then
> may be print a error message here and/or skip the test instred of just return  ?

Sure.

> +               return 1
> +       fi
> +
> +       _init_cgroup2
> +       dir=$(_cgroup2_base_dir)
> +
> I'm little bit confused, CGROUP2_DIR is not initialize or its an environment variable ?

It's defined in _init_cgroup2, but I'll add a comment for that.

thanks,
-liubo

> +       echo $$ > ${CGROUP2_DIR}/cgroup.procs
> +       xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0
> +
> +       # target=1s
> +       echo "`cat /sys/block/nullb0/dev` target=1000000" > ${CGROUP2_DIR}/io.latency
> +
> +       xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0
> +
> +       echo $$ > ${dir}/cgroup.procs
> +       _exit_cgroup2
> +       _exit_null_blk
> +
> +       echo "Test complete"
> +}
> diff --git a/tests/block/022.out b/tests/block/022.out
> new file mode 100644
> index 0000000..14d43cb
> --- /dev/null
> +++ b/tests/block/022.out
> @@ -0,0 +1,2 @@
> +Running block/022
> +Test complete
> -- 
> 2.20.1.2.gb21ebb6
> 

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

end of thread, other threads:[~2019-01-30 22:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 23:54 [PATCH blktests] block: add test for io hang due to blk-iolatency Liu Bo
2019-01-30  3:46 ` Chaitanya Kulkarni
2019-01-30 22:55   ` Liu Bo

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.