From: Petr Vorel <pvorel@suse.cz>
To: Zhao Gongyi <zhaogongyi@huawei.com>
Cc: Richard Palethorpe <rpalethorpe@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] cpuhotplug*.sh: Check return value of online_cpu/offline_cpu
Date: Tue, 9 Aug 2022 07:29:38 +0200 [thread overview]
Message-ID: <YvHwwsjr52lZXtVA@pevik> (raw)
In-Reply-To: <20220804073805.196537-1-zhaogongyi@huawei.com>
Hi Zhao,
> We need to check the return value of online_cpu() and offline_cpu()
> although it is always success.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Looks reasonable.
Kind regards,
Petr
> Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> ---
> .../hotplug/cpu_hotplug/functional/cpuhotplug02.sh | 10 ++++++++--
> .../hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 9 +++++++--
> .../hotplug/cpu_hotplug/functional/cpuhotplug06.sh | 5 ++++-
> .../hotplug/cpu_hotplug/functional/cpuhotplug07.sh | 12 ++++++------
> 4 files changed, 25 insertions(+), 11 deletions(-)
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> index f12aabc72..ba274db01 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> @@ -90,7 +90,10 @@ until [ $LOOP_COUNT -gt $HOTPLUG02_LOOPS ]; do
> set_affinity ${SPIN_LOOP_PID} ${CPU_TO_TEST}
> # Verify the process migrated to the CPU we intended it to go to
> - offline_cpu ${CPU_TO_TEST}
> + if ! offline_cpu ${CPU_TO_TEST}; then
> + tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be offlined"
> + fi
> +
> NEW_CPU=`ps --pid=${SPIN_LOOP_PID} -o psr --no-headers`
> if [ -z "${NEW_CPU}" ]; then
> tst_brkm TBROK "PID ${SPIN_LOOP_PID} no longer running"
> @@ -101,7 +104,10 @@ until [ $LOOP_COUNT -gt $HOTPLUG02_LOOPS ]; do
> fi
> # Turn the CPU back online just to see what happens.
> - online_cpu ${CPU_TO_TEST}
> + if ! online_cpu ${CPU_TO_TEST}; then
> + tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be onlined"
> + fi
> +
> LOOP_COUNT=$((LOOP_COUNT+1))
> done
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> index 2feb8d9ff..1eb204f4e 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> @@ -36,7 +36,9 @@ EOF
> do_clean()
> {
> pid_is_valid ${SAR_PID} && kill_pid ${SAR_PID}
> - online_cpu "$CPU_TO_TEST"
> + if ! online_cpu ${CPU_TO_TEST}; then
> + tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be onlined"
> + fi
> }
> get_field()
> @@ -149,7 +151,10 @@ until [ $LOOP_COUNT -gt $HOTPLUG05_LOOPS ]; do
> tst_exit
> fi
> - offline_cpu ${CPU_TO_TEST}
> + if ! offline_cpu ${CPU_TO_TEST}; then
> + tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be offlined"
> + fi
> +
> kill_pid ${SAR_PID}
> LOOP_COUNT=$((LOOP_COUNT+1))
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> index 319c66537..b9c1889d3 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> @@ -99,7 +99,10 @@ until [ $LOOP_COUNT -gt $HOTPLUG06_LOOPS ]; do
> tst_exit
> fi
> - online_cpu ${CPU_TO_TEST}
> + if ! online_cpu ${CPU_TO_TEST}; then
> + tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be onlined"
> + fi
> +
> kill_pid ${TOP_PID}
> LOOP_COUNT=$((LOOP_COUNT+1))
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> index 0d2dec7fe..af170f1cc 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> @@ -100,9 +100,9 @@ until [ $LOOP_COUNT -gt $HOTPLUG07_LOOPS ]; do
> # Move spin_loop.sh to the CPU to offline.
> set_affinity ${KCOMPILE_LOOP_PID} ${CPU_TO_TEST}
> - offline_cpu ${CPU_TO_TEST}
> - RC=$?
> - echo "Offlining cpu${CPU_TO_TEST}: Return Code = ${RC}"
> + if ! offline_cpu ${CPU_TO_TEST}; then
> + tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be offlined"
> + fi
> NEW_CPU=`ps --pid=${KCOMPILE_LOOP_PID} -o psr --no-headers`
> if [ -z "${NEW_CPU}" ]; then
> @@ -113,9 +113,9 @@ until [ $LOOP_COUNT -gt $HOTPLUG07_LOOPS ]; do
> tst_exit
> fi
> - online_cpu ${CPU_TO_TEST}
> - RC=$?
> - echo "Onlining cpu${CPU_TO_TEST}: Return Code = ${RC}"
> + if ! online_cpu ${CPU_TO_TEST}; then
> + tst_brkm TBROK "CPU${CPU_TO_TEST} cannot be onlined"
> + fi
> LOOP_COUNT=$((LOOP_COUNT+1))
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-08-09 5:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-04 7:38 [LTP] [PATCH] cpuhotplug*.sh: Check return value of online_cpu/offline_cpu Zhao Gongyi via ltp
2022-08-09 5:29 ` Petr Vorel [this message]
2022-08-10 11:52 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YvHwwsjr52lZXtVA@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=rpalethorpe@suse.com \
--cc=zhaogongyi@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox