linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline
@ 2022-09-29  7:39 zhaogongyi
  2022-09-29  9:04 ` David Hildenbrand
  0 siblings, 1 reply; 7+ messages in thread
From: zhaogongyi @ 2022-09-29  7:39 UTC (permalink / raw)
  To: David Hildenbrand, linux-doc, linux-kernel, linux-mm, linux-kselftest
  Cc: akinobu.mita, corbet, osalvador, shuah

Hi,

We can not get the EBUSY from " echo 0 > /sys/devices/system/memory/memoryxxx/online", maybe, redirect the error ouput to /dev/null is suitable when calling offline_memory_expect_success():

# sh mem-on-off-test.sh -a
mem-on-off-test.sh: illegal option -- a
Test scope: 2% hotplug memory
         online all hot-pluggable memory in offline state:
                 SKIPPED - no hot-pluggable memory in offline state
         offline 2% hot-pluggable memory in online state
         trying to offline 4 out of 192 memory block(s):
online->offline memory0
online->offline memory10
online->offline memory100
online->offline memory101
online->offline memory102
online->offline memory103
online->offline memory104
online->offline memory105
online->offline memory106
online->offline memory107
online->offline memory108
online->offline memory109
online->offline memory11
online->offline memory110
online->offline memory111
online->offline memory112
online->offline memory113
online->offline memory114
online->offline memory115
online->offline memory116
online->offline memory117
online->offline memory118
online->offline memory119
online->offline memory12
online->offline memory120
online->offline memory121
online->offline memory122
online->offline memory123
online->offline memory124
         online all hot-pluggable memory in offline state:
offline->online memory121
offline->online memory122
offline->online memory123
offline->online memory124
         Test with memory notifier error injection
# echo $?
0

Thanks!
Gongyi


> 
> 
> >> Reviewed-by: David Hildenbrand <david@redhat.com>
> >>
> >>
> >> I am questioning the stability of the offlining test, though.
> >> Offlining a random memory block can fail easily, because
> >> "->removable" is not
> >> expressive:
> >>
> >> # tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
> >> Test scope: 2% hotplug memory
> >>            online all hot-pluggable memory in offline state:
> >>                    SKIPPED - no hot-pluggable memory in offline state
> >>            offline 2% hot-pluggable memory in online state
> >>            trying to offline 2 out of 96 memory block(s):
> >> online->offline memory0
> >> tools/testing/selftests/memory-hotplug/mem-on-off-test.sh: line 78: echo:
> >> write error: Invalid argument offline_memory_expect_success 0:
> >> unexpected fail
> >> online->offline memory10
> >> online->offline memory11
> >>
> >>
> >> I guess this test will almost always fail nowadays.
> >
> > Offline some memory node maybe failed as expected, but the error message
> is a bit annoying.
> 
> Ah, I see it now. We try offlining two and fail offlining the first one.
> Can we silence that warning in that case somehow?
> 
> --
> Thanks,
> 
> David / dhildenb


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

* Re: [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline
  2022-09-29  7:39 [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline zhaogongyi
@ 2022-09-29  9:04 ` David Hildenbrand
  0 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2022-09-29  9:04 UTC (permalink / raw)
  To: zhaogongyi, linux-doc, linux-kernel, linux-mm, linux-kselftest
  Cc: akinobu.mita, corbet, osalvador, shuah

On 29.09.22 09:39, zhaogongyi wrote:
> Hi,
> 
> We can not get the EBUSY from " echo 0 > /sys/devices/system/memory/memoryxxx/online", maybe, redirect the error ouput to /dev/null is suitable when calling offline_memory_expect_success():
> 
> # sh mem-on-off-test.sh -a
> mem-on-off-test.sh: illegal option -- a
> Test scope: 2% hotplug memory
>           online all hot-pluggable memory in offline state:
>                   SKIPPED - no hot-pluggable memory in offline state
>           offline 2% hot-pluggable memory in online state
>           trying to offline 4 out of 192 memory block(s):
> online->offline memory0
> online->offline memory10
> online->offline memory100
> online->offline memory101
> online->offline memory102
> online->offline memory103
> online->offline memory104
> online->offline memory105
> online->offline memory106
> online->offline memory107
> online->offline memory108
> online->offline memory109
> online->offline memory11
> online->offline memory110
> online->offline memory111
> online->offline memory112
> online->offline memory113
> online->offline memory114
> online->offline memory115
> online->offline memory116
> online->offline memory117
> online->offline memory118
> online->offline memory119
> online->offline memory12
> online->offline memory120
> online->offline memory121
> online->offline memory122
> online->offline memory123
> online->offline memory124

Can we have here an output like

online->offline memory0
-> Failure
online->offline memory10
-> Success

That would make much more sense for debugging purposes and understanding 
what is happening here. I was primarily concerned about the misleading 
error message, that indicated that something is "unexpected" -- it's 
perfectly reasonable here to *expect* that offlining a random memory 
blocks just fails.

-- 
Thanks,

David / dhildenb


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

* Re: [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline
@ 2022-09-29 12:08 zhaogongyi
  0 siblings, 0 replies; 7+ messages in thread
From: zhaogongyi @ 2022-09-29 12:08 UTC (permalink / raw)
  To: David Hildenbrand, linux-doc, linux-kernel, linux-mm, linux-kselftest
  Cc: akinobu.mita, corbet, osalvador, shuah

Hi!

> 
> On 29.09.22 09:39, zhaogongyi wrote:
> > Hi,
> >
> > We can not get the EBUSY from " echo 0 >
> /sys/devices/system/memory/memoryxxx/online", maybe, redirect the error
> ouput to /dev/null is suitable when calling offline_memory_expect_success():
> >
> > # sh mem-on-off-test.sh -a
> > mem-on-off-test.sh: illegal option -- a Test scope: 2% hotplug memory
> >           online all hot-pluggable memory in offline state:
> >                   SKIPPED - no hot-pluggable memory in offline state
> >           offline 2% hot-pluggable memory in online state
> >           trying to offline 4 out of 192 memory block(s):
> > online->offline memory0
> > online->offline memory10
> > online->offline memory100
> > online->offline memory101
> > online->offline memory102
> > online->offline memory103
> > online->offline memory104
> > online->offline memory105
> > online->offline memory106
> > online->offline memory107
> > online->offline memory108
> > online->offline memory109
> > online->offline memory11
> > online->offline memory110
> > online->offline memory111
> > online->offline memory112
> > online->offline memory113
> > online->offline memory114
> > online->offline memory115
> > online->offline memory116
> > online->offline memory117
> > online->offline memory118
> > online->offline memory119
> > online->offline memory12
> > online->offline memory120
> > online->offline memory121
> > online->offline memory122
> > online->offline memory123
> > online->offline memory124
> 
> Can we have here an output like
> 
> online->offline memory0
> -> Failure
> online->offline memory10
> -> Success
> 
> That would make much more sense for debugging purposes and understanding
> what is happening here. I was primarily concerned about the misleading error
> message, that indicated that something is "unexpected" -- it's perfectly
> reasonable here to *expect* that offlining a random memory blocks just fails.

Yes, I will submit a new version of patches to implement it as your suggestiones:

1.  Redirect misleading msg to /dev/null
2.  Add an output for online->offline test

Thanks!


> 
> --
> Thanks,
> 
> David / dhildenb


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

* Re: [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline
  2022-09-27 11:56 zhaogongyi
@ 2022-09-28 12:45 ` David Hildenbrand
  0 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2022-09-28 12:45 UTC (permalink / raw)
  To: zhaogongyi, linux-doc, linux-kernel, linux-mm, linux-kselftest
  Cc: akinobu.mita, corbet, osalvador, shuah


>> Reviewed-by: David Hildenbrand <david@redhat.com>
>>
>>
>> I am questioning the stability of the offlining test, though.
>> Offlining a random memory block can fail easily, because "->removable" is not
>> expressive:
>>
>> # tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
>> Test scope: 2% hotplug memory
>>            online all hot-pluggable memory in offline state:
>>                    SKIPPED - no hot-pluggable memory in offline state
>>            offline 2% hot-pluggable memory in online state
>>            trying to offline 2 out of 96 memory block(s):
>> online->offline memory0
>> tools/testing/selftests/memory-hotplug/mem-on-off-test.sh: line 78: echo:
>> write error: Invalid argument offline_memory_expect_success 0: unexpected
>> fail
>> online->offline memory10
>> online->offline memory11
>>
>>
>> I guess this test will almost always fail nowadays.
> 
> Offline some memory node maybe failed as expected, but the error message is a bit annoying.

Ah, I see it now. We try offlining two and fail offlining the first one. 
Can we silence that warning in that case somehow?

-- 
Thanks,

David / dhildenb


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

* Re: [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline
@ 2022-09-27 11:56 zhaogongyi
  2022-09-28 12:45 ` David Hildenbrand
  0 siblings, 1 reply; 7+ messages in thread
From: zhaogongyi @ 2022-09-27 11:56 UTC (permalink / raw)
  To: David Hildenbrand, linux-doc, linux-kernel, linux-mm, linux-kselftest
  Cc: akinobu.mita, corbet, osalvador, shuah

Hi!

> 
> On 27.09.22 05:28, Zhao Gongyi wrote:
> > Add checking for online_memory_expect_success()/
> > offline_memory_expect_success()/offline_memory_expect_fail(), or the
> > test would exit 0 although the functions return 1.
> >
> > Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> > ---
> >   .../selftests/memory-hotplug/mem-on-off-test.sh      | 12
> +++++++++---
> >   1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
> > b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
> > index 46a97f318f58..1d87611a7d52 100755
> > --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
> > +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
> > @@ -266,7 +266,9 @@ done
> >   #
> >   echo $error >
> $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error
> >   for memory in `hotpluggable_offline_memory`; do
> > -	online_memory_expect_fail $memory
> > +	if ! online_memory_expect_fail $memory; then
> > +		retval=1
> > +	fi
> >   done
> >
> >   #
> > @@ -274,7 +276,9 @@ done
> >   #
> >   echo 0 >
> $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error
> >   for memory in `hotpluggable_offline_memory`; do
> > -	online_memory_expect_success $memory
> > +	if ! online_memory_expect_success $memory; then
> > +		retval=1
> > +	fi
> >   done
> >
> >   #
> > @@ -283,7 +287,9 @@ done
> >   echo $error >
> $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error
> >   for memory in `hotpluggable_online_memory`; do
> >   	if [ $((RANDOM % 100)) -lt $ratio ]; then
> > -		offline_memory_expect_fail $memory
> > +		if ! offline_memory_expect_fail $memory; then
> > +			retval=1
> > +		fi
> >   	fi
> 
> 
> LGTM
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>
> 
> 
> I am questioning the stability of the offlining test, though.
> Offlining a random memory block can fail easily, because "->removable" is not
> expressive:
> 
> # tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
> Test scope: 2% hotplug memory
>           online all hot-pluggable memory in offline state:
>                   SKIPPED - no hot-pluggable memory in offline state
>           offline 2% hot-pluggable memory in online state
>           trying to offline 2 out of 96 memory block(s):
> online->offline memory0
> tools/testing/selftests/memory-hotplug/mem-on-off-test.sh: line 78: echo:
> write error: Invalid argument offline_memory_expect_success 0: unexpected
> fail
> online->offline memory10
> online->offline memory11
> 
> 
> I guess this test will almost always fail nowadays.

Offline some memory node maybe failed as expected, but the error message is a bit annoying.


> 
> --
> Thanks,
> 
> David / dhildenb


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

* Re: [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline
  2022-09-27  3:28 ` [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline Zhao Gongyi
@ 2022-09-27  7:26   ` David Hildenbrand
  0 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2022-09-27  7:26 UTC (permalink / raw)
  To: Zhao Gongyi, linux-doc, linux-kernel, linux-mm, linux-kselftest
  Cc: akinobu.mita, corbet, osalvador, shuah

On 27.09.22 05:28, Zhao Gongyi wrote:
> Add checking for online_memory_expect_success()/
> offline_memory_expect_success()/offline_memory_expect_fail(), or
> the test would exit 0 although the functions return 1.
> 
> Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> ---
>   .../selftests/memory-hotplug/mem-on-off-test.sh      | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
> index 46a97f318f58..1d87611a7d52 100755
> --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
> +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
> @@ -266,7 +266,9 @@ done
>   #
>   echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error
>   for memory in `hotpluggable_offline_memory`; do
> -	online_memory_expect_fail $memory
> +	if ! online_memory_expect_fail $memory; then
> +		retval=1
> +	fi
>   done
> 
>   #
> @@ -274,7 +276,9 @@ done
>   #
>   echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error
>   for memory in `hotpluggable_offline_memory`; do
> -	online_memory_expect_success $memory
> +	if ! online_memory_expect_success $memory; then
> +		retval=1
> +	fi
>   done
> 
>   #
> @@ -283,7 +287,9 @@ done
>   echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error
>   for memory in `hotpluggable_online_memory`; do
>   	if [ $((RANDOM % 100)) -lt $ratio ]; then
> -		offline_memory_expect_fail $memory
> +		if ! offline_memory_expect_fail $memory; then
> +			retval=1
> +		fi
>   	fi


LGTM

Reviewed-by: David Hildenbrand <david@redhat.com>


I am questioning the stability of the offlining test, though.
Offlining a random memory block can fail easily, because "->removable" is not
expressive:

# tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
Test scope: 2% hotplug memory
          online all hot-pluggable memory in offline state:
                  SKIPPED - no hot-pluggable memory in offline state
          offline 2% hot-pluggable memory in online state
          trying to offline 2 out of 96 memory block(s):
online->offline memory0
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh: line 78: echo: write error: Invalid argument
offline_memory_expect_success 0: unexpected fail
online->offline memory10
online->offline memory11


I guess this test will almost always fail nowadays.

-- 
Thanks,

David / dhildenb


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

* [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline
  2022-09-27  3:28 [PATCH -next v4 0/3] Optimize and bugfix for memory-hotplug Zhao Gongyi
@ 2022-09-27  3:28 ` Zhao Gongyi
  2022-09-27  7:26   ` David Hildenbrand
  0 siblings, 1 reply; 7+ messages in thread
From: Zhao Gongyi @ 2022-09-27  3:28 UTC (permalink / raw)
  To: linux-doc, linux-kernel, linux-mm, linux-kselftest
  Cc: akinobu.mita, corbet, david, osalvador, shuah, zhaogongyi

Add checking for online_memory_expect_success()/
offline_memory_expect_success()/offline_memory_expect_fail(), or
the test would exit 0 although the functions return 1.

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 .../selftests/memory-hotplug/mem-on-off-test.sh      | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
index 46a97f318f58..1d87611a7d52 100755
--- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
+++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
@@ -266,7 +266,9 @@ done
 #
 echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error
 for memory in `hotpluggable_offline_memory`; do
-	online_memory_expect_fail $memory
+	if ! online_memory_expect_fail $memory; then
+		retval=1
+	fi
 done

 #
@@ -274,7 +276,9 @@ done
 #
 echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error
 for memory in `hotpluggable_offline_memory`; do
-	online_memory_expect_success $memory
+	if ! online_memory_expect_success $memory; then
+		retval=1
+	fi
 done

 #
@@ -283,7 +287,9 @@ done
 echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error
 for memory in `hotpluggable_online_memory`; do
 	if [ $((RANDOM % 100)) -lt $ratio ]; then
-		offline_memory_expect_fail $memory
+		if ! offline_memory_expect_fail $memory; then
+			retval=1
+		fi
 	fi
 done

--
2.17.1


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

end of thread, other threads:[~2022-09-29 12:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29  7:39 [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline zhaogongyi
2022-09-29  9:04 ` David Hildenbrand
  -- strict thread matches above, loose matches on Subject: below --
2022-09-29 12:08 zhaogongyi
2022-09-27 11:56 zhaogongyi
2022-09-28 12:45 ` David Hildenbrand
2022-09-27  3:28 [PATCH -next v4 0/3] Optimize and bugfix for memory-hotplug Zhao Gongyi
2022-09-27  3:28 ` [PATCH -next v4 1/3] selftests/memory-hotplug: Add checking after online or offline Zhao Gongyi
2022-09-27  7:26   ` David Hildenbrand

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).