linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH blktests] nvme/050: repeat checking test device restoration
@ 2025-08-18 12:14 Shin'ichiro Kawasaki
  2025-08-18 16:10 ` Chaitanya Kulkarni
  2025-08-26 13:51 ` Shinichiro Kawasaki
  0 siblings, 2 replies; 4+ messages in thread
From: Shin'ichiro Kawasaki @ 2025-08-18 12:14 UTC (permalink / raw)
  To: linux-nvme; +Cc: Shin'ichiro Kawasaki

Since kernel version 6.17-rc1, the test case nvme/050 has been failing
with the error message "Failed to restore ${TEST_DEV}". This failure
happens because the device restoration check is executed too early,
shortly after writing to /sys/bus/pci/rescan. To avoid the failure,
implement repeated checks for the device restoration with short sleeps.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
This is the blktests side fix for the nvme/050 failure reported for v6.16-rc1
kernel [1].

[1] https://lore.kernel.org/linux-block/suhzith2uj75uiprq4m3cglvr7qwm3d7gi4tmjeohlxl6fcmv3@zu6zym6nmvun/

 tests/nvme/050 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/nvme/050 b/tests/nvme/050
index c710832..ba55c6e 100755
--- a/tests/nvme/050
+++ b/tests/nvme/050
@@ -23,6 +23,7 @@ requires() {
 test_device() {
 	local nvme_ns
 	local pdev
+	local i
 
 	echo "Running ${TEST_NAME}"
 
@@ -49,7 +50,13 @@ test_device() {
 	# Remove and rescan the NVME device to ensure that it has come back
 	echo 1 > "/sys/bus/pci/devices/${pdev}/remove"
 	echo 1 > /sys/bus/pci/rescan
-	if [[ ! -b ${TEST_DEV} ]]; then
+	for ((i = 0; i < 10; i++)); do
+		if [[ -b ${TEST_DEV} ]]; then
+			break
+		fi
+		sleep .5
+	done
+	if (( i >= 10 )); then
 		echo "Failed to restore ${TEST_DEV}"
 	fi
 }
-- 
2.50.1



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

* Re: [PATCH blktests] nvme/050: repeat checking test device restoration
  2025-08-18 12:14 [PATCH blktests] nvme/050: repeat checking test device restoration Shin'ichiro Kawasaki
@ 2025-08-18 16:10 ` Chaitanya Kulkarni
  2025-08-20  0:30   ` Shinichiro Kawasaki
  2025-08-26 13:51 ` Shinichiro Kawasaki
  1 sibling, 1 reply; 4+ messages in thread
From: Chaitanya Kulkarni @ 2025-08-18 16:10 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-nvme@lists.infradead.org

On 8/18/25 05:14, Shin'ichiro Kawasaki wrote:
> Since kernel version 6.17-rc1, the test case nvme/050 has been failing
> with the error message "Failed to restore ${TEST_DEV}". This failure
> happens because the device restoration check is executed too early,
> shortly after writing to /sys/bus/pci/rescan. To avoid the failure,
> implement repeated checks for the device restoration with short sleeps.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
> This is the blktests side fix for the nvme/050 failure reported for v6.16-rc1
> kernel [1].
>
> [1] https://lore.kernel.org/linux-block/suhzith2uj75uiprq4m3cglvr7qwm3d7gi4tmjeohlxl6fcmv3@zu6zym6nmvun/
>
>   tests/nvme/050 | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tests/nvme/050 b/tests/nvme/050
> index c710832..ba55c6e 100755
> --- a/tests/nvme/050
> +++ b/tests/nvme/050
> @@ -23,6 +23,7 @@ requires() {
>   test_device() {
>   	local nvme_ns
>   	local pdev
> +	local i
>   
>   	echo "Running ${TEST_NAME}"
>   
> @@ -49,7 +50,13 @@ test_device() {
>   	# Remove and rescan the NVME device to ensure that it has come back
>   	echo 1 > "/sys/bus/pci/devices/${pdev}/remove"
>   	echo 1 > /sys/bus/pci/rescan
> -	if [[ ! -b ${TEST_DEV} ]]; then
> +	for ((i = 0; i < 10; i++)); do

This looks good to me, however do we want this loop bounded by 
hard-coded value
or we create a config var that user can set on respective setup ?
either way :-


Looks good.

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

-ck



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

* Re: [PATCH blktests] nvme/050: repeat checking test device restoration
  2025-08-18 16:10 ` Chaitanya Kulkarni
@ 2025-08-20  0:30   ` Shinichiro Kawasaki
  0 siblings, 0 replies; 4+ messages in thread
From: Shinichiro Kawasaki @ 2025-08-20  0:30 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-nvme@lists.infradead.org

On Aug 18, 2025 / 16:10, Chaitanya Kulkarni wrote:
...
> > diff --git a/tests/nvme/050 b/tests/nvme/050
> > index c710832..ba55c6e 100755
> > --- a/tests/nvme/050
> > +++ b/tests/nvme/050
...
> > @@ -49,7 +50,13 @@ test_device() {
> >   	# Remove and rescan the NVME device to ensure that it has come back
> >   	echo 1 > "/sys/bus/pci/devices/${pdev}/remove"
> >   	echo 1 > /sys/bus/pci/rescan
> > -	if [[ ! -b ${TEST_DEV} ]]; then
> > +	for ((i = 0; i < 10; i++)); do
> 
> This looks good to me, however do we want this loop bounded by 
> hard-coded value
> or we create a config var that user can set on respective setup ?

Thought it is an improvement idea, it looks too much for me.

Actually, the test case nvme/032 has the same wait logic using the same hard-
coded loop count and the sleep time, as a test item. So I can have some
confidence that the numbers work good on all blktests running systems.

> either way :-
> 
> 
> Looks good.
> 
> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

Thanks!

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

* Re: [PATCH blktests] nvme/050: repeat checking test device restoration
  2025-08-18 12:14 [PATCH blktests] nvme/050: repeat checking test device restoration Shin'ichiro Kawasaki
  2025-08-18 16:10 ` Chaitanya Kulkarni
@ 2025-08-26 13:51 ` Shinichiro Kawasaki
  1 sibling, 0 replies; 4+ messages in thread
From: Shinichiro Kawasaki @ 2025-08-26 13:51 UTC (permalink / raw)
  To: linux-nvme@lists.infradead.org

On Aug 18, 2025 / 21:14, Shin'ichiro Kawasaki wrote:
> Since kernel version 6.17-rc1, the test case nvme/050 has been failing
> with the error message "Failed to restore ${TEST_DEV}". This failure
> happens because the device restoration check is executed too early,
> shortly after writing to /sys/bus/pci/rescan. To avoid the failure,
> implement repeated checks for the device restoration with short sleeps.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

FYI, I applied this patch.

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

end of thread, other threads:[~2025-08-26 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18 12:14 [PATCH blktests] nvme/050: repeat checking test device restoration Shin'ichiro Kawasaki
2025-08-18 16:10 ` Chaitanya Kulkarni
2025-08-20  0:30   ` Shinichiro Kawasaki
2025-08-26 13:51 ` Shinichiro 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).