Skip to contentSkip to conversation

fix cpuhotplug04 check last cpu error

PATCH New Gou Hao 2 participants 2 messages Jun 28, 2021

lore
Share & tools
lore

Gou Hao

author
#0 lore raw

PATCH 1/1 fix cpuhotplug04 check last cpu error

From: gouhao <[email protected]>

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.

---
 .../kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh +3 -2
index 72bd98037..64a2b8dc5 100755
@@ -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
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 fix cpuhotplug04 check last cpu error

Hi Hao,

Quoted 11 lines · Gou Hao

From: gouhao <[email protected]>

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?

Quoted 3 lines

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?

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