All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test
@ 2022-06-30 15:44 Sagi Grimberg
  2022-06-30 21:24 ` Alan Adamson
  2022-07-01  9:43 ` Chaitanya Kulkarni
  0 siblings, 2 replies; 6+ messages in thread
From: Sagi Grimberg @ 2022-06-30 15:44 UTC (permalink / raw)
  To: Shinichiro Kawasaki
  Cc: Hannes Reinecke, linux-nvme, Christoph Hellwig,
	Chaitanya Kulkarni, Keith Busch

Test traffic controller reset and disconnect during traffic.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
Changes from v1:
- fix copyright
- change subsys name
- fix test cleanup warnings
- don't log device names
- fix shellcheck

 tests/nvme/040     | 59 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/040.out |  6 +++++
 tests/nvme/rc      |  8 +++++++
 3 files changed, 73 insertions(+)
 create mode 100755 tests/nvme/040
 create mode 100644 tests/nvme/040.out

diff --git a/tests/nvme/040 b/tests/nvme/040
new file mode 100755
index 000000000000..d259784698d9
--- /dev/null
+++ b/tests/nvme/040
@@ -0,0 +1,59 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Sagi Grimberg <sagi@grimberg.me>
+#
+# Test nvme fabrics controller reset/disconnect/reconnect operation during I/O
+# This test is somewhat similar to test 032 but for fabrics controllers.
+
+. tests/nvme/rc
+
+DESCRIPTION="test nvme fabrics controller reset/disconnect operation during I/O"
+
+requires() {
+	_nvme_requires
+	_have_loop
+	_have_fio
+	_require_nvme_trtype_is_fabrics
+}
+
+test() {
+	local subsys="blktests-subsystem-1"
+	local port
+	local loop_dev
+	local nvmedev
+
+	echo "Running ${TEST_NAME}"
+
+	_setup_nvmet
+	truncate -s 1G "$TMPDIR/img"
+	loop_dev="$(losetup -f --show "$TMPDIR/img")"
+
+	port="$(_create_nvmet_port "${nvme_trtype}")"
+	_create_nvmet_subsystem "${subsys}" "${loop_dev}"
+	_add_nvmet_subsys_to_port "${port}" "${subsys}"
+	_nvme_connect_subsys "${nvme_trtype}" "${subsys}"
+	udevadm settle
+	nvmedev=$(_find_nvme_dev "${subsys}")
+
+	# start fio job
+	echo "starting background fio"
+	_run_fio_rand_io --filename="${nvmedev}n1" --size=1g \
+		--group_reporting --ramp_time=5  &> /dev/null &
+	sleep 5
+
+	# do reset/remove operation
+	echo "resetting controller"
+	_nvme_reset_ctrl ${nvmedev}
+	sleep 1
+	echo "deleting controller"
+	_nvme_delete_ctrl ${nvmedev}
+
+	echo "stopping background fio"
+	{ kill $!; wait; } &> /dev/null
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys}"
+	_remove_nvmet_subsystem "${subsys}"
+	_remove_nvmet_port "${port}"
+
+	echo "Test complete"
+}
diff --git a/tests/nvme/040.out b/tests/nvme/040.out
new file mode 100644
index 000000000000..50d02d4e3cd0
--- /dev/null
+++ b/tests/nvme/040.out
@@ -0,0 +1,6 @@
+Running nvme/040
+starting background fio
+resetting controller
+deleting controller
+stopping background fio
+Test complete
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 4bebbc762cbb..dfea7f3a0da4 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -447,3 +447,11 @@ _nvme_disable_err_inject()
         echo 0 > /sys/kernel/debug/"$1"/fault_inject/probability
         echo 0 > /sys/kernel/debug/"$1"/fault_inject/times
 }
+
+_nvme_reset_ctrl() {
+	echo 1 > /sys/class/nvme/"$1"/reset_controller
+}
+
+_nvme_delete_ctrl() {
+	echo 1 > /sys/class/nvme/"$1"/delete_controller
+}
-- 
2.34.1



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

* Re: [PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test
  2022-06-30 15:44 [PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test Sagi Grimberg
@ 2022-06-30 21:24 ` Alan Adamson
  2022-07-01  9:43 ` Chaitanya Kulkarni
  1 sibling, 0 replies; 6+ messages in thread
From: Alan Adamson @ 2022-06-30 21:24 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Shinichiro Kawasaki, Hannes Reinecke, linux-nvme,
	Christoph Hellwig, Chaitanya Kulkarni, Keith Busch

Looks good.  I’ve tested it on my config.

Reviewed-by: Alan Adamson <alan.adamson@oracle.com>

> On Jun 30, 2022, at 8:44 AM, Sagi Grimberg <sagi@grimberg.me> wrote:
> 
> Test traffic controller reset and disconnect during traffic.
> 
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
> Changes from v1:
> - fix copyright
> - change subsys name
> - fix test cleanup warnings
> - don't log device names
> - fix shellcheck
> 
> tests/nvme/040     | 59 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/nvme/040.out |  6 +++++
> tests/nvme/rc      |  8 +++++++
> 3 files changed, 73 insertions(+)
> create mode 100755 tests/nvme/040
> create mode 100644 tests/nvme/040.out
> 
> diff --git a/tests/nvme/040 b/tests/nvme/040
> new file mode 100755
> index 000000000000..d259784698d9
> --- /dev/null
> +++ b/tests/nvme/040
> @@ -0,0 +1,59 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2022 Sagi Grimberg <sagi@grimberg.me>
> +#
> +# Test nvme fabrics controller reset/disconnect/reconnect operation during I/O
> +# This test is somewhat similar to test 032 but for fabrics controllers.
> +
> +. tests/nvme/rc
> +
> +DESCRIPTION="test nvme fabrics controller reset/disconnect operation during I/O"
> +
> +requires() {
> +	_nvme_requires
> +	_have_loop
> +	_have_fio
> +	_require_nvme_trtype_is_fabrics
> +}
> +
> +test() {
> +	local subsys="blktests-subsystem-1"
> +	local port
> +	local loop_dev
> +	local nvmedev
> +
> +	echo "Running ${TEST_NAME}"
> +
> +	_setup_nvmet
> +	truncate -s 1G "$TMPDIR/img"
> +	loop_dev="$(losetup -f --show "$TMPDIR/img")"
> +
> +	port="$(_create_nvmet_port "${nvme_trtype}")"
> +	_create_nvmet_subsystem "${subsys}" "${loop_dev}"
> +	_add_nvmet_subsys_to_port "${port}" "${subsys}"
> +	_nvme_connect_subsys "${nvme_trtype}" "${subsys}"
> +	udevadm settle
> +	nvmedev=$(_find_nvme_dev "${subsys}")
> +
> +	# start fio job
> +	echo "starting background fio"
> +	_run_fio_rand_io --filename="${nvmedev}n1" --size=1g \
> +		--group_reporting --ramp_time=5  &> /dev/null &
> +	sleep 5
> +
> +	# do reset/remove operation
> +	echo "resetting controller"
> +	_nvme_reset_ctrl ${nvmedev}
> +	sleep 1
> +	echo "deleting controller"
> +	_nvme_delete_ctrl ${nvmedev}
> +
> +	echo "stopping background fio"
> +	{ kill $!; wait; } &> /dev/null
> +
> +	_remove_nvmet_subsystem_from_port "${port}" "${subsys}"
> +	_remove_nvmet_subsystem "${subsys}"
> +	_remove_nvmet_port "${port}"
> +
> +	echo "Test complete"
> +}
> diff --git a/tests/nvme/040.out b/tests/nvme/040.out
> new file mode 100644
> index 000000000000..50d02d4e3cd0
> --- /dev/null
> +++ b/tests/nvme/040.out
> @@ -0,0 +1,6 @@
> +Running nvme/040
> +starting background fio
> +resetting controller
> +deleting controller
> +stopping background fio
> +Test complete
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 4bebbc762cbb..dfea7f3a0da4 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -447,3 +447,11 @@ _nvme_disable_err_inject()
>         echo 0 > /sys/kernel/debug/"$1"/fault_inject/probability
>         echo 0 > /sys/kernel/debug/"$1"/fault_inject/times
> }
> +
> +_nvme_reset_ctrl() {
> +	echo 1 > /sys/class/nvme/"$1"/reset_controller
> +}
> +
> +_nvme_delete_ctrl() {
> +	echo 1 > /sys/class/nvme/"$1"/delete_controller
> +}
> -- 
> 2.34.1
> 
> 


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

* Re: [PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test
  2022-06-30 15:44 [PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test Sagi Grimberg
  2022-06-30 21:24 ` Alan Adamson
@ 2022-07-01  9:43 ` Chaitanya Kulkarni
  2022-07-11  0:41   ` Shinichiro Kawasaki
  1 sibling, 1 reply; 6+ messages in thread
From: Chaitanya Kulkarni @ 2022-07-01  9:43 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Hannes Reinecke, Shinichiro Kawasaki, linux-nvme,
	Christoph Hellwig, Chaitanya Kulkarni, Keith Busch

O
> +
> +	# do reset/remove operation
> +	echo "resetting controller"
> +	_nvme_reset_ctrl ${nvmedev}
> +	sleep 1
> +	echo "deleting controller"
> +	_nvme_delete_ctrl ${nvmedev}
> +
> +	echo "stopping background fio"
> +	{ kill $!; wait; } &> /dev/null

do we really need to kill the fio process explicitly ?
I think graceful termination of the traffic application should be
a part of this test without explicitly killing the process.

I ran the test with commenting above line it runs fine :-

blktests (master) # git diff
diff --git a/tests/nvme/040 b/tests/nvme/040
index d259784..0dce128 100755
--- a/tests/nvme/040
+++ b/tests/nvme/040
@@ -49,7 +49,7 @@ test() {
         _nvme_delete_ctrl ${nvmedev}

         echo "stopping background fio"
-       { kill $!; wait; } &> /dev/null
+#{ kill $!; wait; } &> /dev/null

         _remove_nvmet_subsystem_from_port "${port}" "${subsys}"
         _remove_nvmet_subsystem "${subsys}"
blktests (master) # ./check nvme/040
nvme/040 (test nvme fabrics controller reset/disconnect operation during 
I/O) [passed]
     runtime  8.119s  ...  8.084s
blktests (master) #

-ck



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

* Re: [PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test
  2022-07-01  9:43 ` Chaitanya Kulkarni
@ 2022-07-11  0:41   ` Shinichiro Kawasaki
  2022-07-11  8:22     ` Sagi Grimberg
  0 siblings, 1 reply; 6+ messages in thread
From: Shinichiro Kawasaki @ 2022-07-11  0:41 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: Sagi Grimberg, Hannes Reinecke, linux-nvme, Christoph Hellwig,
	Chaitanya Kulkarni, Keith Busch

On Jul 01, 2022 / 09:43, Chaitanya Kulkarni wrote:
> O
> > +
> > +	# do reset/remove operation
> > +	echo "resetting controller"
> > +	_nvme_reset_ctrl ${nvmedev}
> > +	sleep 1
> > +	echo "deleting controller"
> > +	_nvme_delete_ctrl ${nvmedev}
> > +
> > +	echo "stopping background fio"
> > +	{ kill $!; wait; } &> /dev/null
> 
> do we really need to kill the fio process explicitly ?
> I think graceful termination of the traffic application should be
> a part of this test without explicitly killing the process.
> 
> I ran the test with commenting above line it runs fine :-
> 
> blktests (master) # git diff
> diff --git a/tests/nvme/040 b/tests/nvme/040
> index d259784..0dce128 100755
> --- a/tests/nvme/040
> +++ b/tests/nvme/040
> @@ -49,7 +49,7 @@ test() {
>          _nvme_delete_ctrl ${nvmedev}
> 
>          echo "stopping background fio"
> -       { kill $!; wait; } &> /dev/null
> +#{ kill $!; wait; } &> /dev/null
> 
>          _remove_nvmet_subsystem_from_port "${port}" "${subsys}"
>          _remove_nvmet_subsystem "${subsys}"
> blktests (master) # ./check nvme/040
> nvme/040 (test nvme fabrics controller reset/disconnect operation during 
> I/O) [passed]
>      runtime  8.119s  ...  8.084s
> blktests (master) #
> 
> -ck

Sagi, what do you think on this comment?

To keep this test case consistent with nvme/032, it would be the better to keep
the kill and wait. But we may not need to stick to it if it does better testing
without the kill and wait.

-- 
Shin'ichiro Kawasaki

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

* Re: [PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test
  2022-07-11  0:41   ` Shinichiro Kawasaki
@ 2022-07-11  8:22     ` Sagi Grimberg
  2022-07-12  0:33       ` Shinichiro Kawasaki
  0 siblings, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2022-07-11  8:22 UTC (permalink / raw)
  To: Shinichiro Kawasaki, Chaitanya Kulkarni
  Cc: Hannes Reinecke, linux-nvme, Christoph Hellwig,
	Chaitanya Kulkarni, Keith Busch


>> O
>>> +
>>> +	# do reset/remove operation
>>> +	echo "resetting controller"
>>> +	_nvme_reset_ctrl ${nvmedev}
>>> +	sleep 1
>>> +	echo "deleting controller"
>>> +	_nvme_delete_ctrl ${nvmedev}
>>> +
>>> +	echo "stopping background fio"
>>> +	{ kill $!; wait; } &> /dev/null
>>
>> do we really need to kill the fio process explicitly ?
>> I think graceful termination of the traffic application should be
>> a part of this test without explicitly killing the process.
>>
>> I ran the test with commenting above line it runs fine :-
>>
>> blktests (master) # git diff
>> diff --git a/tests/nvme/040 b/tests/nvme/040
>> index d259784..0dce128 100755
>> --- a/tests/nvme/040
>> +++ b/tests/nvme/040
>> @@ -49,7 +49,7 @@ test() {
>>           _nvme_delete_ctrl ${nvmedev}
>>
>>           echo "stopping background fio"
>> -       { kill $!; wait; } &> /dev/null
>> +#{ kill $!; wait; } &> /dev/null
>>
>>           _remove_nvmet_subsystem_from_port "${port}" "${subsys}"
>>           _remove_nvmet_subsystem "${subsys}"
>> blktests (master) # ./check nvme/040
>> nvme/040 (test nvme fabrics controller reset/disconnect operation during
>> I/O) [passed]
>>       runtime  8.119s  ...  8.084s
>> blktests (master) #
>>
>> -ck
> 
> Sagi, what do you think on this comment?
> 
> To keep this test case consistent with nvme/032, it would be the better to keep
> the kill and wait. But we may not need to stick to it if it does better testing
> without the kill and wait.

I don't particularly care. Can you remove it when applying?


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

* Re: [PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test
  2022-07-11  8:22     ` Sagi Grimberg
@ 2022-07-12  0:33       ` Shinichiro Kawasaki
  0 siblings, 0 replies; 6+ messages in thread
From: Shinichiro Kawasaki @ 2022-07-12  0:33 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Chaitanya Kulkarni, Hannes Reinecke, linux-nvme,
	Christoph Hellwig, Chaitanya Kulkarni, Keith Busch

On Jul 11, 2022 / 11:22, Sagi Grimberg wrote:
> 
> > > O
> > > > +
> > > > +	# do reset/remove operation
> > > > +	echo "resetting controller"
> > > > +	_nvme_reset_ctrl ${nvmedev}
> > > > +	sleep 1
> > > > +	echo "deleting controller"
> > > > +	_nvme_delete_ctrl ${nvmedev}
> > > > +
> > > > +	echo "stopping background fio"
> > > > +	{ kill $!; wait; } &> /dev/null
> > > 
> > > do we really need to kill the fio process explicitly ?
> > > I think graceful termination of the traffic application should be
> > > a part of this test without explicitly killing the process.
> > > 
> > > I ran the test with commenting above line it runs fine :-
> > > 
> > > blktests (master) # git diff
> > > diff --git a/tests/nvme/040 b/tests/nvme/040
> > > index d259784..0dce128 100755
> > > --- a/tests/nvme/040
> > > +++ b/tests/nvme/040
> > > @@ -49,7 +49,7 @@ test() {
> > >           _nvme_delete_ctrl ${nvmedev}
> > > 
> > >           echo "stopping background fio"
> > > -       { kill $!; wait; } &> /dev/null
> > > +#{ kill $!; wait; } &> /dev/null
> > > 
> > >           _remove_nvmet_subsystem_from_port "${port}" "${subsys}"
> > >           _remove_nvmet_subsystem "${subsys}"
> > > blktests (master) # ./check nvme/040
> > > nvme/040 (test nvme fabrics controller reset/disconnect operation during
> > > I/O) [passed]
> > >       runtime  8.119s  ...  8.084s
> > > blktests (master) #
> > > 
> > > -ck
> > 
> > Sagi, what do you think on this comment?
> > 
> > To keep this test case consistent with nvme/032, it would be the better to keep
> > the kill and wait. But we may not need to stick to it if it does better testing
> > without the kill and wait.
> 
> I don't particularly care. Can you remove it when applying?

Sure, I've applied with the edit.

-- 
Shin'ichiro Kawasaki

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

end of thread, other threads:[~2022-07-12  0:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 15:44 [PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test Sagi Grimberg
2022-06-30 21:24 ` Alan Adamson
2022-07-01  9:43 ` Chaitanya Kulkarni
2022-07-11  0:41   ` Shinichiro Kawasaki
2022-07-11  8:22     ` Sagi Grimberg
2022-07-12  0:33       ` 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.