linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH blktests 5/9] scsi/004: allow to run with built-in scsi_debug
@ 2023-04-17 12:59 Shin'ichiro Kawasaki
  2023-04-17 12:59 ` [PATCH blktests 6/9] scsi/005: " Shin'ichiro Kawasaki
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Shin'ichiro Kawasaki @ 2023-04-17 12:59 UTC (permalink / raw)
  To: linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki, Shin'ichiro Kawasaki

From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

To allow the test case run with build-in scsi_debug, replace
'_have_module scsi_debug' with _have_scsi_debug, and replace
_init_scsi_debug with _configure_scsi_debug.

Also, save and restore the values of scsi_debug parameters 'opts' and
'ndelay'. The test case modifies the parameters and do not restore their
original values. It is fine when scsi_debug is loadable since scsi_debug
is unloaded after the test case run. However, when scsi_debug is built-
in, the modified parameters may affect following test cases. To avoid
potential impact on following test cases, save original values of the
parameters and restore them at the end of the test case.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/scsi/004 | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/scsi/004 b/tests/scsi/004
index f0845c1..110b5f4 100755
--- a/tests/scsi/004
+++ b/tests/scsi/004
@@ -18,15 +18,22 @@ DESCRIPTION="ensure repeated TASK SET FULL results in EIO on timing out command"
 CAN_BE_ZONED=1
 
 requires() {
-	_have_module scsi_debug
+	_have_scsi_debug
 }
 
 test() {
+	local opts ndelay
+
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_scsi_debug add_host=1 max_luns=1 statistics=1 every_nth=1; then
+	if ! _configure_scsi_debug max_luns=1 statistics=1 every_nth=1; then
 	    return 1
 	fi
+
+	# save scsi_debug parameters
+	opts=$(</sys/bus/pseudo/drivers/scsi_debug/opts)
+	ndelay=$(</sys/bus/pseudo/drivers/scsi_debug/ndelay)
+
 	echo 5 > "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/timeout"
 	# every_nth RW with full queue gets SAM_STAT_TASK_SET_FULL
 	echo 0x800 > /sys/bus/pseudo/drivers/scsi_debug/opts
@@ -42,7 +49,11 @@ test() {
 	while grep -q -F "in_use_bm BUSY:" "/proc/scsi/scsi_debug/${SCSI_DEBUG_HOSTS[0]}"; do
 		sleep 1
 	done
-	echo 1 > /sys/bus/pseudo/drivers/scsi_debug/ndelay
+
+	# restore scsi_debug parameters
+	echo "$opts" > /sys/bus/pseudo/drivers/scsi_debug/opts
+	echo "$ndelay" > /sys/bus/pseudo/drivers/scsi_debug/ndelay
+
 	_exit_scsi_debug
 
 	echo "Test complete"
-- 
2.39.2


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

* [PATCH blktests 6/9] scsi/005: allow to run with built-in scsi_debug
  2023-04-17 12:59 [PATCH blktests 5/9] scsi/004: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
@ 2023-04-17 12:59 ` Shin'ichiro Kawasaki
  2023-04-18 20:19   ` Chaitanya Kulkarni
  2023-04-17 12:59 ` [PATCH blktests 7/9] block/001: allow to run with built-in scsi_debug and sd_mod Shin'ichiro Kawasaki
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Shin'ichiro Kawasaki @ 2023-04-17 12:59 UTC (permalink / raw)
  To: linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki, Shin'ichiro Kawasaki

From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

To allow the test case run with build-in scsi_debug, replace
'_have_module scsi_debug' with _have_scsi_debug, and replace
_init_scsi_debug with _configure_scsi_debug.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/scsi/005 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/scsi/005 b/tests/scsi/005
index efd3d82..bfa1014 100755
--- a/tests/scsi/005
+++ b/tests/scsi/005
@@ -11,7 +11,7 @@ DESCRIPTION="test SCSI device blacklisting"
 QUICK=1
 
 requires() {
-	_have_module scsi_debug
+	_have_scsi_debug
 	_have_module_param scsi_debug inq_vendor
 }
 
@@ -33,7 +33,7 @@ test() {
 	for inq in "${inqs[@]}"; do
 		vendor="${inq:0:8}"
 		model="${inq:8:16}"
-		if ! _init_scsi_debug inq_vendor="$vendor" inq_product="$model"; then
+		if ! _configure_scsi_debug inq_vendor="$vendor" inq_product="$model"; then
 			continue
 		fi
 		vendor="$(cat "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/vendor")"
-- 
2.39.2


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

* [PATCH blktests 7/9] block/001: allow to run with built-in scsi_debug and sd_mod
  2023-04-17 12:59 [PATCH blktests 5/9] scsi/004: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
  2023-04-17 12:59 ` [PATCH blktests 6/9] scsi/005: " Shin'ichiro Kawasaki
@ 2023-04-17 12:59 ` Shin'ichiro Kawasaki
  2023-04-18 20:20   ` Chaitanya Kulkarni
  2023-04-17 12:59 ` [PATCH blktests 8/9] block/002: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Shin'ichiro Kawasaki @ 2023-04-17 12:59 UTC (permalink / raw)
  To: linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki, Shin'ichiro Kawasaki

From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

To allow the test case run with build-in scsi_debug, replace
'_have_module scsi_debug' with _have_scsi_debug, and replace
_init_scsi_debug with _configure_scsi_debug.

Also, to allow the test case run with build-in sd_mod, replace
'_have_module sd_mod' with '_have_kernel_option BLK_DEV_SD'. When sd_mod
driver is built-in, /sys/module/sd_mod directory is not created. Then
_have_driver() can not detect availability of the driver. Instead, refer
the kernel config to check availability of the driver.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/block/001 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/block/001 b/tests/block/001
index 2ea3754..32dd22f 100755
--- a/tests/block/001
+++ b/tests/block/001
@@ -13,13 +13,13 @@ DESCRIPTION="stress device hotplugging"
 TIMED=1
 
 requires() {
-	_have_module scsi_debug
-	_have_driver sd_mod
+	_have_scsi_debug
+	_have_kernel_option BLK_DEV_SD
 	_have_driver sr_mod
 }
 
 stress_scsi_debug() {
-	if ! _init_scsi_debug "$@"; then
+	if ! _configure_scsi_debug "$@"; then
 		return
 	fi
 
-- 
2.39.2


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

* [PATCH blktests 8/9] block/002: allow to run with built-in scsi_debug
  2023-04-17 12:59 [PATCH blktests 5/9] scsi/004: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
  2023-04-17 12:59 ` [PATCH blktests 6/9] scsi/005: " Shin'ichiro Kawasaki
  2023-04-17 12:59 ` [PATCH blktests 7/9] block/001: allow to run with built-in scsi_debug and sd_mod Shin'ichiro Kawasaki
@ 2023-04-17 12:59 ` Shin'ichiro Kawasaki
  2023-04-18 20:20   ` Chaitanya Kulkarni
  2023-04-17 12:59 ` [PATCH blktests 9/9] block/027: " Shin'ichiro Kawasaki
  2023-04-18 20:18 ` [PATCH blktests 5/9] scsi/004: " Chaitanya Kulkarni
  4 siblings, 1 reply; 11+ messages in thread
From: Shin'ichiro Kawasaki @ 2023-04-17 12:59 UTC (permalink / raw)
  To: linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki, Shin'ichiro Kawasaki

From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

To allow the test case run with build-in scsi_debug, replace
'_have_module scsi_debug' with _have_scsi_debug, and replace
_init_scsi_debug with _configure_scsi_debug.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/block/002 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/block/002 b/tests/block/002
index a5f3ee5..b16d014 100755
--- a/tests/block/002
+++ b/tests/block/002
@@ -13,13 +13,13 @@ QUICK=1
 
 requires() {
 	_have_blktrace
-	_have_module scsi_debug
+	_have_scsi_debug
 }
 
 test() {
 	echo "Running ${TEST_NAME}"
 
-	if ! _init_scsi_debug delay=0; then
+	if ! _configure_scsi_debug delay=0; then
 		return 1
 	fi
 
-- 
2.39.2


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

* [PATCH blktests 9/9] block/027: allow to run with built-in scsi_debug
  2023-04-17 12:59 [PATCH blktests 5/9] scsi/004: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
                   ` (2 preceding siblings ...)
  2023-04-17 12:59 ` [PATCH blktests 8/9] block/002: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
@ 2023-04-17 12:59 ` Shin'ichiro Kawasaki
  2023-04-18 20:21   ` Chaitanya Kulkarni
  2023-04-18 20:18 ` [PATCH blktests 5/9] scsi/004: " Chaitanya Kulkarni
  4 siblings, 1 reply; 11+ messages in thread
From: Shin'ichiro Kawasaki @ 2023-04-17 12:59 UTC (permalink / raw)
  To: linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki, Shin'ichiro Kawasaki

From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

To allow the test case run with build-in scsi_debug, replace
'_have_module scsi_debug' with _have_scsi_debug, and replace
_init_scsi_debug with _configure_scsi_debug.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/block/027 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/block/027 b/tests/block/027
index ab6369b..a79a115 100755
--- a/tests/block/027
+++ b/tests/block/027
@@ -20,12 +20,12 @@ CAN_BE_ZONED=1
 
 requires() {
 	_have_cgroup2_controller io
-	_have_module scsi_debug
+	_have_scsi_debug
 	_have_fio
 }
 
 scsi_debug_stress_remove() {
-	if ! _init_scsi_debug "$@"; then
+	if ! _configure_scsi_debug "$@"; then
 		return
 	fi
 
-- 
2.39.2


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

* Re: [PATCH blktests 5/9] scsi/004: allow to run with built-in scsi_debug
  2023-04-17 12:59 [PATCH blktests 5/9] scsi/004: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
                   ` (3 preceding siblings ...)
  2023-04-17 12:59 ` [PATCH blktests 9/9] block/027: " Shin'ichiro Kawasaki
@ 2023-04-18 20:18 ` Chaitanya Kulkarni
  2023-04-21 11:13   ` Shin'ichiro Kawasaki
  4 siblings, 1 reply; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-18 20:18 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki

On 4/17/23 05:59, Shin'ichiro Kawasaki wrote:
> From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>
> To allow the test case run with build-in scsi_debug, replace
> '_have_module scsi_debug' with _have_scsi_debug, and replace
> _init_scsi_debug with _configure_scsi_debug.
>
> Also, save and restore the values of scsi_debug parameters 'opts' and
> 'ndelay'. The test case modifies the parameters and do not restore their
> original values. It is fine when scsi_debug is loadable since scsi_debug
> is unloaded after the test case run. However, when scsi_debug is built-
> in, the modified parameters may affect following test cases. To avoid
> potential impact on following test cases, save original values of the
> parameters and restore them at the end of the test case.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>

Perhaps we should look into a helper to record other default
parameters before the testcase and restore it after when
it is built in ?

Irrespective of that, looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH blktests 6/9] scsi/005: allow to run with built-in scsi_debug
  2023-04-17 12:59 ` [PATCH blktests 6/9] scsi/005: " Shin'ichiro Kawasaki
@ 2023-04-18 20:19   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-18 20:19 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki

On 4/17/23 05:59, Shin'ichiro Kawasaki wrote:
> From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>
> To allow the test case run with build-in scsi_debug, replace
> '_have_module scsi_debug' with _have_scsi_debug, and replace
> _init_scsi_debug with _configure_scsi_debug.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH blktests 7/9] block/001: allow to run with built-in scsi_debug and sd_mod
  2023-04-17 12:59 ` [PATCH blktests 7/9] block/001: allow to run with built-in scsi_debug and sd_mod Shin'ichiro Kawasaki
@ 2023-04-18 20:20   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-18 20:20 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki

On 4/17/23 05:59, Shin'ichiro Kawasaki wrote:
> From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>
> To allow the test case run with build-in scsi_debug, replace
> '_have_module scsi_debug' with _have_scsi_debug, and replace
> _init_scsi_debug with _configure_scsi_debug.
>
> Also, to allow the test case run with build-in sd_mod, replace
> '_have_module sd_mod' with '_have_kernel_option BLK_DEV_SD'. When sd_mod
> driver is built-in, /sys/module/sd_mod directory is not created. Then
> _have_driver() can not detect availability of the driver. Instead, refer
> the kernel config to check availability of the driver.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH blktests 8/9] block/002: allow to run with built-in scsi_debug
  2023-04-17 12:59 ` [PATCH blktests 8/9] block/002: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
@ 2023-04-18 20:20   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-18 20:20 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki

On 4/17/23 05:59, Shin'ichiro Kawasaki wrote:
> From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>
> To allow the test case run with build-in scsi_debug, replace
> '_have_module scsi_debug' with _have_scsi_debug, and replace
> _init_scsi_debug with _configure_scsi_debug.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>   


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH blktests 9/9] block/027: allow to run with built-in scsi_debug
  2023-04-17 12:59 ` [PATCH blktests 9/9] block/027: " Shin'ichiro Kawasaki
@ 2023-04-18 20:21   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 11+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-18 20:21 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block, linux-scsi
  Cc: Shin'ichiro Kawasaki

On 4/17/23 05:59, Shin'ichiro Kawasaki wrote:
> From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>
> To allow the test case run with build-in scsi_debug, replace
> '_have_module scsi_debug' with _have_scsi_debug, and replace
> _init_scsi_debug with _configure_scsi_debug.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>

I think we can merge patches 5/6 into one patch and 7/8/9 into another
one, irrespective of that, looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH blktests 5/9] scsi/004: allow to run with built-in scsi_debug
  2023-04-18 20:18 ` [PATCH blktests 5/9] scsi/004: " Chaitanya Kulkarni
@ 2023-04-21 11:13   ` Shin'ichiro Kawasaki
  0 siblings, 0 replies; 11+ messages in thread
From: Shin'ichiro Kawasaki @ 2023-04-21 11:13 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block, linux-scsi, Shin'ichiro Kawasaki

On Apr 18, 2023 / 20:18, Chaitanya Kulkarni wrote:
> On 4/17/23 05:59, Shin'ichiro Kawasaki wrote:
> > From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> >
> > To allow the test case run with build-in scsi_debug, replace
> > '_have_module scsi_debug' with _have_scsi_debug, and replace
> > _init_scsi_debug with _configure_scsi_debug.
> >
> > Also, save and restore the values of scsi_debug parameters 'opts' and
> > 'ndelay'. The test case modifies the parameters and do not restore their
> > original values. It is fine when scsi_debug is loadable since scsi_debug
> > is unloaded after the test case run. However, when scsi_debug is built-
> > in, the modified parameters may affect following test cases. To avoid
> > potential impact on following test cases, save original values of the
> > parameters and restore them at the end of the test case.
> >
> > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> > ---
> >
> 
> Perhaps we should look into a helper to record other default
> parameters before the testcase and restore it after when
> it is built in ?

Hi Chaitanya, thanks for the review comments. Your idea sounds good. I will try
to implement it.

> 
> Irrespective of that, looks good.
> 
> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
> 
> -ck
> 
> 

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

end of thread, other threads:[~2023-04-21 11:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17 12:59 [PATCH blktests 5/9] scsi/004: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
2023-04-17 12:59 ` [PATCH blktests 6/9] scsi/005: " Shin'ichiro Kawasaki
2023-04-18 20:19   ` Chaitanya Kulkarni
2023-04-17 12:59 ` [PATCH blktests 7/9] block/001: allow to run with built-in scsi_debug and sd_mod Shin'ichiro Kawasaki
2023-04-18 20:20   ` Chaitanya Kulkarni
2023-04-17 12:59 ` [PATCH blktests 8/9] block/002: allow to run with built-in scsi_debug Shin'ichiro Kawasaki
2023-04-18 20:20   ` Chaitanya Kulkarni
2023-04-17 12:59 ` [PATCH blktests 9/9] block/027: " Shin'ichiro Kawasaki
2023-04-18 20:21   ` Chaitanya Kulkarni
2023-04-18 20:18 ` [PATCH blktests 5/9] scsi/004: " Chaitanya Kulkarni
2023-04-21 11:13   ` Shin'ichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).