All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] fix cpuhotplug04 check last cpu error
@ 2021-06-28  1:15 Gou Hao
  2021-06-28  2:42 ` Li Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Gou Hao @ 2021-06-28  1:15 UTC (permalink / raw
  To: ltp

From: gouhao <gouhao@uniontech.com>

Cpuhotplug04 uses get_hotplug_cpus when traversing, 
get_hotplug_cpus will filter out cpu without online files, 
and $cpus_num will be used to determine the last cpu num??? 
If some cpu do not have an online file, 
it will lead to an error in the judgment of the last cpu.

Signed-off-by: gouhao <gouhao@uniontech.com>
---
 .../kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
index 72bd98037..64a2b8dc5 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
@@ -57,7 +57,8 @@ if [ $cpus_num -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
 fi
 
-if [ $(get_hotplug_cpus_num) -lt 1 ]; then
+hotplug_cpus_num=$(get_hotplug_cpus_num)
+if [ $hotplug_cpus_num -lt 1 ]; then
 	tst_brkm TCONF "system doesn't have at least one hotpluggable CPU"
 fi
 
@@ -85,7 +86,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
 		# that the kernel will refuse to offline the last CPU.
 		# If only some of the CPUs are hotpluggable,
 		# they all can be offlined.
-		if [ $cpu -eq $cpus_num ]; then
+		if [ $cpu -eq $hotplug_cpus_num ]; then
 			if offline_cpu $i 2> /dev/null; then
 				tst_brkm TFAIL "Have we just offlined the last CPU?"
 			else
-- 
2.20.1




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

* [LTP] [PATCH] fix cpuhotplug04 check last cpu error
  2021-06-28  1:15 Gou Hao
@ 2021-06-28  2:42 ` Li Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Li Wang @ 2021-06-28  2:42 UTC (permalink / raw
  To: ltp

Hi Hao,

On Mon, Jun 28, 2021 at 9:16 AM Gou Hao <gouhao@uniontech.com> wrote:

> From: gouhao <gouhao@uniontech.com>
>
>

> Cpuhotplug04 uses get_hotplug_cpus when traversing,
> get_hotplug_cpus will filter out cpu without online files,
> and $cpus_num will be used to determine the last cpu num?



>
> If some cpu do not have an online file,
> it will lead to an error in the judgment of the last cpu.
>

I'm wondering what kind of CPU does not have the online file, and which
kernel version is being used? Is that test machine an x86 or MIPS?

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210628/fd406b00/attachment.htm>

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

* [LTP] 回复:Re:  [PATCH] fix cpuhotplug04 check last cpu error
@ 2021-06-28  3:03 gouhao
  2021-06-28  3:26 ` [LTP] " Li Wang
  0 siblings, 1 reply; 5+ messages in thread
From: gouhao @ 2021-06-28  3:03 UTC (permalink / raw
  To: ltp

An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210628/27d84c37/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hygon_cpu_online.png
Type: image/png
Size: 30536 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210628/27d84c37/attachment-0001.png>

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

* [LTP] [PATCH] fix cpuhotplug04 check last cpu error
  2021-06-28  3:03 [LTP] 回复:Re: [PATCH] fix cpuhotplug04 check last cpu error gouhao
@ 2021-06-28  3:26 ` Li Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Li Wang @ 2021-06-28  3:26 UTC (permalink / raw
  To: ltp

On Mon, Jun 28, 2021 at 11:03 AM <gouhao@uniontech.com> wrote:

> hi, LiWang,
>
> My cpu is Hygon C86 7185 32-core Processor, x86_64 architecture? kernel is
> 4.19.90
> Only cpu0 has no files?It doesn't seem to have anything to do with the
> kernel. I tried other kernels, too
>

Thanks for the info.

I checked my laptop (5.12.11-300.fc34.x86_64), it has no 'online' file in
the first cpu0 as well.
It seems common to consider cpu0 is always online, so it won?t have
?cpu0/online?.
(I got this view from google search ^)


But go back to your patch, does it really make sense to correct
the judgment of the last CPU?

If I understand correctly, the original judgment is purposely to
guarantee all CPUs can be safely offline, so if there is already
a cpu0 without an 'online' file, it will be filtered out, right? This
means all of the remaining hotplugged CPUs can be offline safely.
In this case, the judgment of the last CPU is losing effect as
expected. Why should we correct it?

Or, do you get any failures/abnormal in testing?



>
> Attached is a screenshot.
> ------------------------------
>
> *??????????*
>
> *UnionTech Software Technology Co., Ltd. *
>
> ???www.uniontech.com
>
>
>
> ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
>
>
>
> This email message is intended only for the use of the individual or
> entity who/which is the intended recipient and may contain information that
> is privileged or confidential. If you are not the intended recipient, you
> are hereby notified that any use, dissemination, distribution or copying
> of, or taking any action in reliance on, this e-mail is strictly
> prohibited. If you have received this email in error, please notify
> UnionTech Software Technology  immediately by replying to this e-mail and
> immediately delete and discard all copies of the e-mail and the attachment
> thereto (if any). Thank you.
> ------------------------------------------------------------------
>
> Hi Hao,
>
> On Mon, Jun 28, 2021 at 9:16 AM Gou Hao <gouhao@uniontech.com> wrote:
>
>> From: gouhao <gouhao@uniontech.com>
>>
>>
>
>> Cpuhotplug04 uses get_hotplug_cpus when traversing,
>> get_hotplug_cpus will filter out cpu without online files,
>> and $cpus_num will be used to determine the last cpu num?
>
>
>
>>
>> If some cpu do not have an online file,
>> it will lead to an error in the judgment of the last cpu.
>>
>
> I'm wondering what kind of CPU does not have the online file, and which
> kernel version is being used? Is that test machine an x86 or MIPS?
>
> --
> Regards,
> Li Wang
>


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210628/64c58e22/attachment.htm>

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

* [LTP] [PATCH] fix cpuhotplug04 check last cpu error
  2021-06-28  3:57 [LTP] 回复:Re: " gouhao
@ 2021-06-28  4:27 ` Li Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Li Wang @ 2021-06-28  4:27 UTC (permalink / raw
  To: ltp

On Mon, Jun 28, 2021 at 11:58 AM <gouhao@uniontech.com> wrote:

> This change makes sense.
>
> On my computer, the last CPU can't be offline, which causes the execution
> of this testcase to fail.
>

But the CPU0 on your system will always online, so the last one should be
offline safely.
If it not, that might a kernel issue I guess.

>
> However, the testcase makes special treatment to the last CPU. If the last
> CPU cannot be offline, the execution result of the testcase should not be
> affected.
>

Yes, but from cpuhotplug04.sh comment line#84:

# If all the CPUs are hotpluggable, we expect
# that the kernel will refuse to offline the last CPU.
# If only some of the CPUs are hotpluggable,
# they all can be offlined.

How do you think of this description? In your system, it obviously belongs
to
the second scenario that the cpu0 is online and you should be able to
offline
all the remaining hotplugged one, isn't it?

>
> Therefore, if cpu0 does not have an online file, it will lead to an error
> in the judgment of the last CPU.
>

If cpu0 does not have an online file, that means the last CPU (hotplugged)
can be offline as well.
To verify this assumption, you can try manually offline CPU one by one,
this time I suggest you
try the last one first.

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210628/2b93ddcf/attachment.htm>

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

end of thread, other threads:[~2021-06-28  4:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-28  3:03 [LTP] 回复:Re: [PATCH] fix cpuhotplug04 check last cpu error gouhao
2021-06-28  3:26 ` [LTP] " Li Wang
  -- strict thread matches above, loose matches on Subject: below --
2021-06-28  3:57 [LTP] 回复:Re: " gouhao
2021-06-28  4:27 ` [LTP] " Li Wang
2021-06-28  1:15 Gou Hao
2021-06-28  2:42 ` Li Wang

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.