All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes
@ 2015-04-29 11:17 Jan Stancek
  2015-04-29 11:17 ` [LTP] [PATCH 1/4] cpuhotplug: use cpu states in cleanup Jan Stancek
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Jan Stancek @ 2015-04-29 11:17 UTC (permalink / raw)
  To: ltp-list

Hi,

This patchset is result of merge of following series:
  http://article.gmane.org/gmane.linux.ltp/22762
  http://article.gmane.org/gmane.linux.ltp/22678

It is based on patchset from Stanislav, with changes
noted below:
1. cpuhotplug: use cpu states in cleanup
   no changes to Stanislav's version
2. cpu_hotplug: added get_hotplug_cpus, get_hotplug_cpus_num
   This patch has been merged with my 'get_present_cpus' patch,
   get_hotplug_cpus has been modified to operate on present cpus
   only.
3. cpu_hotplug: use hotplug/present cpus functions
   This comes from my series, there is no counterpart or conflict
   with Stanislav's patchset.
4. cpuhotplug04.sh: operate only with hotpluggable CPUs
   minor change here to use number of present CPUs, rather than all

@Stanislav: Can you please review this series and check, whether
            it still fixes issue you met on sparc64 kernel?

Regards,
Jan


Jan Stancek (1):
  cpu_hotplug: use hotplug/present cpus functions

Stanislav Kholmanskikh (3):
  cpuhotplug: use cpu states in cleanup
  cpu_hotplug: add get_hotplug_cpus, get_present_cpus
  cpuhotplug04.sh: operate only with hotpluggable CPUs

 .../hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 17 ++---
 .../hotplug/cpu_hotplug/functional/cpuhotplug02.sh |  2 +-
 .../hotplug/cpu_hotplug/functional/cpuhotplug03.sh | 16 ++--
 .../hotplug/cpu_hotplug/functional/cpuhotplug04.sh | 74 +++++++++---------
 .../hotplug/cpu_hotplug/functional/cpuhotplug05.sh |  2 +-
 .../hotplug/cpu_hotplug/functional/cpuhotplug06.sh |  2 +-
 .../hotplug/cpu_hotplug/functional/cpuhotplug07.sh |  2 +-
 .../cpu_hotplug/include/cpuhotplug_hotplug.sh      | 89 +++++++++++++++++++---
 8 files changed, 135 insertions(+), 69 deletions(-)

-- 
1.8.3.1


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH 1/4] cpuhotplug: use cpu states in cleanup
  2015-04-29 11:17 [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes Jan Stancek
@ 2015-04-29 11:17 ` Jan Stancek
  2015-04-29 11:17 ` [LTP] [PATCH 2/4] cpu_hotplug: add get_hotplug_cpus, get_present_cpus Jan Stancek
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Jan Stancek @ 2015-04-29 11:17 UTC (permalink / raw)
  To: ltp-list

From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>

There is a couple of good functions:
 * get_all_cpu_states
 * set_all_cpu_states
which can help to avoid unnecessary cleanup logic in test cases.

So let's use them.

Also modified offline_cpu and online_cpu, so now they do nothing if
the cpu is already in the desired state.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
---
 .../hotplug/cpu_hotplug/functional/cpuhotplug01.sh     | 11 ++++-------
 .../hotplug/cpu_hotplug/functional/cpuhotplug03.sh     | 12 +++++-------
 .../hotplug/cpu_hotplug/functional/cpuhotplug04.sh     | 18 +++++-------------
 .../hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh  | 16 ++++++++++------
 4 files changed, 24 insertions(+), 33 deletions(-)

diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
index f91cf88..52598a9 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
@@ -45,13 +45,8 @@ do_clean()
 {
 	kill_pid ${WRL_ID}
 
-	# Turns off the cpus that were off before the test start
-	until [ $CPU_COUNT -eq 0 ]; do
-		offline_cpu=$(eval "echo \$OFFLINE_CPU_${CPU_COUNT}")
-		tst_resm TINFO "CPU = $CPU_COUNT @on = $offline_cpu"
-		offline_cpu $offline_cpu
-		CPU_COUNT=$((CPU_COUNT-1))
-	done
+	# Restore CPU states
+	set_all_cpu_states "$cpu_states"
 }
 
 
@@ -138,6 +133,8 @@ fi
 
 TST_CLEANUP=do_clean
 
+cpu_states=$(get_all_cpu_states)
+
 CPU_COUNT=0
 
 # Start up a process that writes to disk; keep track of its PID
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
index 8176fb3..817f066 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
@@ -46,11 +46,8 @@ do_clean()
 		rm /var/run/hotplug4_$$.pid
 	fi
 
-	# Turn off the CPUs that were off before the test start
-	until [ $cpu -eq 0 ];do
-		offline_cpu $(eval "echo \$on_${cpu}")
-		cpu=$((cpu-1))
-	done
+	# Restore CPU states
+	set_all_cpu_states "$cpu_states"
 }
 
 while getopts c:l: OPTION; do
@@ -82,11 +79,13 @@ fi
 
 TST_CLEANUP=do_clean
 
+cpu_states=$(get_all_cpu_states)
+
 until [ $LOOP_COUNT -gt $HOTPLUG03_LOOPS ]; do
 	cpu=0
 	number_of_cpus=0
 
-	# Turns on all CPUs and saves their states
+	# Turns on all CPUs
 	for i in $( get_all_cpus ); do
             if [ "$i" = "cpu0" ]; then
                 continue
@@ -96,7 +95,6 @@ until [ $LOOP_COUNT -gt $HOTPLUG03_LOOPS ]; do
                     tst_brkm TBROK "Could not online cpu $i"
                 fi
 				cpu=$((cpu+1))
-                eval "on_${cpu}=$i"
             fi
 		number_of_cpus=$((number_of_cpus+1))
 	done
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
index 72fbc6e..ea2723b 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
@@ -33,17 +33,8 @@ EOF
 do_clean()
 {
 	# Online the ones that were on initially
-	until [ $cpu -eq 0 ]; do
-		online_cpu $(eval "echo \$on_${cpu}")
-		cpu=$((cpu-1))
-	done
-
-	# Return CPU 0 to its initial state
-	if [ $cpustate = 1 ]; then
-		online_cpu 0
-	else
-		offline_cpu 0
-	fi
+	# Restore CPU states
+	set_all_cpu_states "$cpu_states"
 }
 
 while getopts l: OPTION; do
@@ -64,11 +55,13 @@ fi
 
 TST_CLEANUP=do_clean
 
+cpu_states=$(get_all_cpu_states)
+
 until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
 	cpu=0
 	cpustate=1
 
-	# Online all the CPUs' keep track of which were already on
+	# Online all the CPUs
 	for i in $(get_all_cpus); do
 		if [ "$i" != "cpu0" ]; then
 			if ! cpu_is_online $i; then
@@ -77,7 +70,6 @@ until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
 				fi
 			fi
 			cpu=$((cpu+1))
-			eval "on_${cpu}=$i"
 			echo $i
 		else
 			if online_cpu $i; then
diff --git a/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh b/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh
index dd8472f..f553d0c 100644
--- a/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh
@@ -73,6 +73,9 @@ online_cpu()
     if [ ! -w /sys/devices/system/cpu/cpu${CPU}/online ]; then
         return 1
     fi
+
+    cpu_is_online ${CPU} && return 0
+
     $TIME echo 1 > /sys/devices/system/cpu/cpu${CPU}/online
     RC=$?
     report_timing "Online cpu ${CPU}"
@@ -91,6 +94,9 @@ offline_cpu()
     if [ ! -w /sys/devices/system/cpu/cpu${CPU}/online ]; then
         return 1
     fi
+
+    ! cpu_is_online ${CPU} && return 0
+
     $TIME echo 0 > /sys/devices/system/cpu/cpu${CPU}/online
     RC=$?
     report_timing "Offline cpu ${CPU}"
@@ -141,20 +147,18 @@ get_all_cpu_states()
 
 # set_all_cpu_states(STATES)
 #
-#  Sets all of the CPU states according to $STATE, which must be
+#  Sets all of the CPU states according to STATES, which must be
 #  of the form "cpuX:Y", where X is the CPU number and Y its state.
 #  Each must be on a separate line.
 #
 set_all_cpu_states()
 {
-    for cpu_state in $STATE; do
-        cpu=`echo $c | cut -d: -f 1`
-        state=`echo $c | cut -d: -f 1`
+    for cpu_state in $1; do
+        cpu=`echo $cpu_state | cut -d: -f 1`
+        state=`echo $cpu_state | cut -d: -f 2`
         if [ $state = 1 ]; then
-            echo "# Re-onlining $cpu"
             online_cpu $cpu
         else
-            echo "# Re-offlining $cpu"
             offline_cpu $cpu
         fi
     done
-- 
1.8.3.1


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH 2/4] cpu_hotplug: add get_hotplug_cpus, get_present_cpus
  2015-04-29 11:17 [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes Jan Stancek
  2015-04-29 11:17 ` [LTP] [PATCH 1/4] cpuhotplug: use cpu states in cleanup Jan Stancek
@ 2015-04-29 11:17 ` Jan Stancek
  2015-04-29 12:56   ` Stanislav Kholmanskikh
  2015-04-29 11:18 ` [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions Jan Stancek
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Jan Stancek @ 2015-04-29 11:17 UTC (permalink / raw)
  To: ltp-list

From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 .../cpu_hotplug/include/cpuhotplug_hotplug.sh      | 73 +++++++++++++++++++++-
 1 file changed, 70 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh b/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh
index f553d0c..a1c6ef6 100644
--- a/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh
@@ -126,11 +126,78 @@ get_cpus_num()
 #
 get_all_cpus()
 {
-    [ -d /sys/devices/system/cpu/cpu0 ] || return 1
-    ls -dr /sys/devices/system/cpu/cpu[0-9]* | \
-        sed "s/\/sys\/devices\/system\/cpu\///g" || return 2
+    [ -d /sys/devices/system/cpu ] || return 1
+    (cd /sys/devices/system/cpu; ls -d cpu[0-9]*)
 }
 
+# get_present_cpus()
+#
+#  Prints a list of present CPUs, regardless of whether they're
+#  currently online or offline.
+#
+get_present_cpus()
+{
+    # if sysfs present mask is missing, assume all cpu are present
+    if [ ! -e /sys/devices/system/cpu/present ]; then
+        get_all_cpus
+        return
+    fi
+
+    local present_mask="/sys/devices/system/cpu/present"
+    local present_cpus=""
+
+    for part in $(cat $present_mask | tr "," " "); do
+        if echo $part | grep -q "-"; then
+            range_low=$(echo $part | cut -d - -f 1)
+            range_high=$(echo $part | cut -d - -f 2)
+        else
+            range_low=$(part)
+            range_high=$(part)
+        fi
+        for cpu in $(seq $range_low $range_high); do
+            if [ -e /sys/devices/system/cpu/cpu$cpu ]; then
+                present_cpus="$present_cpus cpu$cpu"
+            fi
+        done
+    done
+    echo $present_cpus
+}
+
+# get_present_cpus_num()
+#
+#  Prints the number of present CPUs
+#
+get_present_cpus_num()
+{
+    return $(get_present_cpus | wc -w)
+}
+
+# get_hotplug_cpus()
+#
+#  Prints a list of present hotpluggable CPUs, regardless of whether they're
+#  currently online or offline.
+#
+get_hotplug_cpus()
+{
+    local present_cpus=$(get_present_cpus)
+    local hotplug_cpus=""
+
+    for cpu in $present_cpus; do
+        if [ -e /sys/devices/system/cpu/$cpu/online ]; then
+            hotplug_cpus="$hotplug_cpus $cpu"
+	fi
+    done
+    echo $hotplug_cpus
+}
+
+# get_hotplug_cpus_num()
+#
+#  Prints the number of hotpluggable CPUs
+#
+get_hotplug_cpus_num()
+{
+    return $(get_hotplug_cpus | wc -w)
+}
 
 # get_all_cpu_states()
 #
-- 
1.8.3.1


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions
  2015-04-29 11:17 [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes Jan Stancek
  2015-04-29 11:17 ` [LTP] [PATCH 1/4] cpuhotplug: use cpu states in cleanup Jan Stancek
  2015-04-29 11:17 ` [LTP] [PATCH 2/4] cpu_hotplug: add get_hotplug_cpus, get_present_cpus Jan Stancek
@ 2015-04-29 11:18 ` Jan Stancek
  2015-04-29 13:09   ` Stanislav Kholmanskikh
  2015-04-29 11:18 ` [LTP] [PATCH 4/4] cpuhotplug04.sh: operate only with hotpluggable CPUs Jan Stancek
  2015-04-29 13:11 ` [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes Stanislav Kholmanskikh
  4 siblings, 1 reply; 10+ messages in thread
From: Jan Stancek @ 2015-04-29 11:18 UTC (permalink / raw)
  To: ltp-list

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 6 +++---
 testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh | 2 +-
 testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh | 4 ++--
 testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh | 4 ++--
 testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 2 +-
 testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh | 2 +-
 testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
index 52598a9..8ae1379 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
@@ -111,7 +111,7 @@ LOOP_COUNT=1
 
 tst_check_cmds perl
 
-get_cpus_num
+get_present_cpus_num
 if [ $? -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
 fi
@@ -148,7 +148,7 @@ do
 	IRQ_START=$(cat /proc/interrupts)
 
 	# Attempt to offline all CPUs
-	for cpu in $( get_all_cpus ); do
+	for cpu in $( get_hotplug_cpus ); do
 		if [ "$cpu" = "cpu0" ]; then
 			continue
 		fi
@@ -163,7 +163,7 @@ do
 	done
 
 	# Attempt to online all CPUs
-	for cpu in $( get_all_cpus ); do
+	for cpu in $( get_hotplug_cpus ); do
 		if [ "$cpu" = "cpu0" ]; then
 			continue
 		fi
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
index 3b33720..c42cc1b 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
@@ -54,7 +54,7 @@ done
 
 LOOP_COUNT=1
 
-get_cpus_num
+get_present_cpus_num
 if [ $? -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
 fi
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
index 817f066..5da4854 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
@@ -63,7 +63,7 @@ done
 
 LOOP_COUNT=1
 
-get_cpus_num
+get_present_cpus_num
 if [ $? -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
 fi
@@ -86,7 +86,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG03_LOOPS ]; do
 	number_of_cpus=0
 
 	# Turns on all CPUs
-	for i in $( get_all_cpus ); do
+	for i in $( get_hotplug_cpus ); do
             if [ "$i" = "cpu0" ]; then
                 continue
             fi
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
index ea2723b..3e025da 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
@@ -62,7 +62,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
 	cpustate=1
 
 	# Online all the CPUs
-	for i in $(get_all_cpus); do
+	for i in $(get_hotplug_cpus); do
 		if [ "$i" != "cpu0" ]; then
 			if ! cpu_is_online $i; then
 				if ! online_cpu $i; then
@@ -79,7 +79,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
 	done
 
 	# Now offline all the CPUs
-	for i in $(get_all_cpus); do
+	for i in $(get_hotplug_cpus); do
 		if ! offline_cpu $i; then
 			if [ "x$i" != "xcpu0" ]; then
 				tst_resm TFAIL "Did not offline first CPU (offlined $i instead)"
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
index bb0e896..79f7e90 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
@@ -54,7 +54,7 @@ LOOP_COUNT=1
 
 tst_check_cmds sar
 
-get_cpus_num
+get_present_cpus_num
 if [ $? -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
 fi
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
index 2e48242..6710fad 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
@@ -49,7 +49,7 @@ done
 
 LOOP_COUNT=1
 
-get_cpus_num
+get_present_cpus_num
 if [ $? -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
 fi
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
index 723f3de..7edb3a9 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
@@ -55,7 +55,7 @@ done
 
 LOOP_COUNT=1
 
-get_cpus_num
+get_present_cpus_num
 if [ $? -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
 fi
-- 
1.8.3.1


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH 4/4] cpuhotplug04.sh: operate only with hotpluggable CPUs
  2015-04-29 11:17 [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes Jan Stancek
                   ` (2 preceding siblings ...)
  2015-04-29 11:18 ` [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions Jan Stancek
@ 2015-04-29 11:18 ` Jan Stancek
  2015-04-29 13:11 ` [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes Stanislav Kholmanskikh
  4 siblings, 0 replies; 10+ messages in thread
From: Jan Stancek @ 2015-04-29 11:18 UTC (permalink / raw)
  To: ltp-list

From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>

If cpu0 is hotpluggable, then the last CPU may not be cpu0, and
there is no reason to treat cpu0 as a special case.

To make the test be more generic I'm proposing these changes:
 * Operate (offline/online) only with hotpluggable CPUs, because
   how can we enable/disable a CPU if there is no 'online' file?

 * If all CPUs in the system are hotpluggable, then we expect that
   the kernel will only refuse to offline the last CPU. And this
   last CPU may not be cpu0.

 * If only a part of CPUs in the system is hotpluggable, then we
   should be able to offline all of them

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 .../hotplug/cpu_hotplug/functional/cpuhotplug04.sh | 52 +++++++++++++---------
 1 file changed, 30 insertions(+), 22 deletions(-)

diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
index 3e025da..58a822e 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
@@ -48,42 +48,50 @@ done
 
 LOOP_COUNT=1
 
-get_cpus_num
-if [ $? -lt 2 ]; then
+get_present_cpus_num
+cpus_num=$?
+if [ $cpus_num -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
 fi
 
+get_hotplug_cpus_num
+if [ $? -lt 1 ]; then
+	tst_brkm TCONF "system doesn't have at least one hotpluggable CPU"
+fi
+
 TST_CLEANUP=do_clean
 
 cpu_states=$(get_all_cpu_states)
 
 until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
-	cpu=0
-	cpustate=1
 
-	# Online all the CPUs
+	# Online all the hotpluggable CPUs
 	for i in $(get_hotplug_cpus); do
-		if [ "$i" != "cpu0" ]; then
-			if ! cpu_is_online $i; then
-				if ! online_cpu $i; then
-					tst_brkm TBROK "$i cannot be onlined"
-				fi
-			fi
-			cpu=$((cpu+1))
-			echo $i
-		else
-			if online_cpu $i; then
-				cpustate=0
+		if ! cpu_is_online $i; then
+			if ! online_cpu $i; then
+				tst_brkm TBROK "$i can not be onlined"
 			fi
 		fi
 	done
 
-	# Now offline all the CPUs
+	# Now offline them
+	cpu=0
 	for i in $(get_hotplug_cpus); do
-		if ! offline_cpu $i; then
-			if [ "x$i" != "xcpu0" ]; then
-				tst_resm TFAIL "Did not offline first CPU (offlined $i instead)"
-				tst_exit
+		cpu=$((cpu + 1))
+
+		# 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.
+		if [ $cpu -eq $cpus_num ]; then
+			if offline_cpu $i 2> /dev/null; then
+				tst_brkm TFAIL "Have we just offlined the last CPU?"
+			else
+				tst_resm TPASS "System prevented us from offlining the last CPU - $i"
+			fi
+		else
+			if ! offline_cpu $i; then
+				tst_brkm TFAIL "Could not offline $i"
 			fi
 		fi
 	done
@@ -92,6 +100,6 @@ until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
 
 done
 
-tst_resm TPASS "Successfully offlined first CPU, $i"
+tst_resm TPASS "Success"
 
 tst_exit
-- 
1.8.3.1


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH 2/4] cpu_hotplug: add get_hotplug_cpus, get_present_cpus
  2015-04-29 11:17 ` [LTP] [PATCH 2/4] cpu_hotplug: add get_hotplug_cpus, get_present_cpus Jan Stancek
@ 2015-04-29 12:56   ` Stanislav Kholmanskikh
  0 siblings, 0 replies; 10+ messages in thread
From: Stanislav Kholmanskikh @ 2015-04-29 12:56 UTC (permalink / raw)
  To: Jan Stancek, ltp-list



On 04/29/2015 02:17 PM, Jan Stancek wrote:
> From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
>
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>   .../cpu_hotplug/include/cpuhotplug_hotplug.sh      | 73 +++++++++++++++++++++-
>   1 file changed, 70 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh b/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh
> index f553d0c..a1c6ef6 100644
> --- a/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh
> @@ -126,11 +126,78 @@ get_cpus_num()
>   #
>   get_all_cpus()
>   {
> -    [ -d /sys/devices/system/cpu/cpu0 ] || return 1
> -    ls -dr /sys/devices/system/cpu/cpu[0-9]* | \
> -        sed "s/\/sys\/devices\/system\/cpu\///g" || return 2
> +    [ -d /sys/devices/system/cpu ] || return 1
> +    (cd /sys/devices/system/cpu; ls -d cpu[0-9]*)
>   }
>
> +# get_present_cpus()
> +#
> +#  Prints a list of present CPUs, regardless of whether they're
> +#  currently online or offline.
> +#
> +get_present_cpus()
> +{
> +    # if sysfs present mask is missing, assume all cpu are present
> +    if [ ! -e /sys/devices/system/cpu/present ]; then
> +        get_all_cpus
> +        return
> +    fi
> +
> +    local present_mask="/sys/devices/system/cpu/present"
Maybe use this variable in the above 'if [ ! -e 
/sys/devices/system/cpu/present]' ?


> +    local present_cpus=""
> +
> +    for part in $(cat $present_mask | tr "," " "); do
> +        if echo $part | grep -q "-"; then
> +            range_low=$(echo $part | cut -d - -f 1)
> +            range_high=$(echo $part | cut -d - -f 2)
> +        else
> +            range_low=$(part)
> +            range_high=$(part)
> +        fi
> +        for cpu in $(seq $range_low $range_high); do
> +            if [ -e /sys/devices/system/cpu/cpu$cpu ]; then
> +                present_cpus="$present_cpus cpu$cpu"
> +            fi
> +        done
> +    done
> +    echo $present_cpus
> +}
> +
> +# get_present_cpus_num()
> +#
> +#  Prints the number of present CPUs
> +#
> +get_present_cpus_num()
> +{
> +    return $(get_present_cpus | wc -w)
> +}
> +
> +# get_hotplug_cpus()
> +#
> +#  Prints a list of present hotpluggable CPUs, regardless of whether they're
> +#  currently online or offline.
> +#
> +get_hotplug_cpus()
> +{
> +    local present_cpus=$(get_present_cpus)
> +    local hotplug_cpus=""
> +
> +    for cpu in $present_cpus; do
> +        if [ -e /sys/devices/system/cpu/$cpu/online ]; then
> +            hotplug_cpus="$hotplug_cpus $cpu"
> +	fi
> +    done
> +    echo $hotplug_cpus
> +}
> +
> +# get_hotplug_cpus_num()
> +#
> +#  Prints the number of hotpluggable CPUs
> +#
> +get_hotplug_cpus_num()
> +{
> +    return $(get_hotplug_cpus | wc -w)
> +}
>
>   # get_all_cpu_states()
>   #
>

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions
  2015-04-29 11:18 ` [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions Jan Stancek
@ 2015-04-29 13:09   ` Stanislav Kholmanskikh
  2015-04-29 14:41     ` Jan Stancek
  0 siblings, 1 reply; 10+ messages in thread
From: Stanislav Kholmanskikh @ 2015-04-29 13:09 UTC (permalink / raw)
  To: Jan Stancek, ltp-list

On 04/29/2015 02:18 PM, Jan Stancek wrote:
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 6 +++---
>   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh | 2 +-
>   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh | 4 ++--
>   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh | 4 ++--
>   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 2 +-
>   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh | 2 +-
>   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh | 2 +-
>   7 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
> index 52598a9..8ae1379 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
> @@ -111,7 +111,7 @@ LOOP_COUNT=1
>
>   tst_check_cmds perl
>
> -get_cpus_num
> +get_present_cpus_num
>   if [ $? -lt 2 ]; then
>   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
>   fi
> @@ -148,7 +148,7 @@ do
>   	IRQ_START=$(cat /proc/interrupts)
>
>   	# Attempt to offline all CPUs
> -	for cpu in $( get_all_cpus ); do
> +	for cpu in $( get_hotplug_cpus ); do
>   		if [ "$cpu" = "cpu0" ]; then
>   			continue
>   		fi
> @@ -163,7 +163,7 @@ do
>   	done
>
>   	# Attempt to online all CPUs
> -	for cpu in $( get_all_cpus ); do
> +	for cpu in $( get_hotplug_cpus ); do
>   		if [ "$cpu" = "cpu0" ]; then
>   			continue
>   		fi

Given that now this loop runs over hotpluggable cpus, it seems there is 
no reason to treat cpu0 specially in cpuhotplug0{1, 3, 4}.sh.

Patch 4 in this series has a fix for cpuhotplug04.sh, but other 
occurrences are unfixed.



> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> index 3b33720..c42cc1b 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> @@ -54,7 +54,7 @@ done
>
>   LOOP_COUNT=1
>
> -get_cpus_num
> +get_present_cpus_num
>   if [ $? -lt 2 ]; then
>   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
>   fi
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
> index 817f066..5da4854 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
> @@ -63,7 +63,7 @@ done
>
>   LOOP_COUNT=1
>
> -get_cpus_num
> +get_present_cpus_num
>   if [ $? -lt 2 ]; then
>   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
>   fi
> @@ -86,7 +86,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG03_LOOPS ]; do
>   	number_of_cpus=0
>
>   	# Turns on all CPUs
> -	for i in $( get_all_cpus ); do
> +	for i in $( get_hotplug_cpus ); do
>               if [ "$i" = "cpu0" ]; then
>                   continue
>               fi

In general, get_hotplug_cpus should produce only a subset from 
get_all_cpus, so number_of_cpus below may be less that the total number 
of CPUs in the system.

But below in the code we have:

         # Start up a number of processes equal to twice the number of
         # CPUs we have.  This is to help ensure we've got enough processes
         # that at least one will migrate to the new CPU.  Store the PIDs
         # so we can kill them later.
         number_of_cpus=$((number_of_cpus*2))
         until [ $number_of_cpus -eq 0 ]; do
                 cpuhotplug_do_spin_loop > /dev/null 2>&1 &
                 echo $! >> /var/run/hotplug4_$$.pid
                 number_of_cpus=$((number_of_cpus-1))
         done

It seems that now we need to fork $(( $(get_present_cpus_num) * 2 )) 
processes.


> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
> index ea2723b..3e025da 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
> @@ -62,7 +62,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
>   	cpustate=1
>
>   	# Online all the CPUs
> -	for i in $(get_all_cpus); do
> +	for i in $(get_hotplug_cpus); do
>   		if [ "$i" != "cpu0" ]; then
>   			if ! cpu_is_online $i; then
>   				if ! online_cpu $i; then
> @@ -79,7 +79,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
>   	done
>
>   	# Now offline all the CPUs
> -	for i in $(get_all_cpus); do
> +	for i in $(get_hotplug_cpus); do
>   		if ! offline_cpu $i; then
>   			if [ "x$i" != "xcpu0" ]; then
>   				tst_resm TFAIL "Did not offline first CPU (offlined $i instead)"
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> index bb0e896..79f7e90 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> @@ -54,7 +54,7 @@ LOOP_COUNT=1
>
>   tst_check_cmds sar
>
> -get_cpus_num
> +get_present_cpus_num
>   if [ $? -lt 2 ]; then
>   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
>   fi
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> index 2e48242..6710fad 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> @@ -49,7 +49,7 @@ done
>
>   LOOP_COUNT=1
>
> -get_cpus_num
> +get_present_cpus_num
>   if [ $? -lt 2 ]; then
>   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
>   fi
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> index 723f3de..7edb3a9 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> @@ -55,7 +55,7 @@ done
>
>   LOOP_COUNT=1
>
> -get_cpus_num
> +get_present_cpus_num
>   if [ $? -lt 2 ]; then
>   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
>   fi
>

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes
  2015-04-29 11:17 [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes Jan Stancek
                   ` (3 preceding siblings ...)
  2015-04-29 11:18 ` [LTP] [PATCH 4/4] cpuhotplug04.sh: operate only with hotpluggable CPUs Jan Stancek
@ 2015-04-29 13:11 ` Stanislav Kholmanskikh
  4 siblings, 0 replies; 10+ messages in thread
From: Stanislav Kholmanskikh @ 2015-04-29 13:11 UTC (permalink / raw)
  To: Jan Stancek, ltp-list



On 04/29/2015 02:17 PM, Jan Stancek wrote:
> Hi,
>
> This patchset is result of merge of following series:
>    http://article.gmane.org/gmane.linux.ltp/22762
>    http://article.gmane.org/gmane.linux.ltp/22678
>
> It is based on patchset from Stanislav, with changes
> noted below:
> 1. cpuhotplug: use cpu states in cleanup
>     no changes to Stanislav's version
> 2. cpu_hotplug: added get_hotplug_cpus, get_hotplug_cpus_num
>     This patch has been merged with my 'get_present_cpus' patch,
>     get_hotplug_cpus has been modified to operate on present cpus
>     only.
> 3. cpu_hotplug: use hotplug/present cpus functions
>     This comes from my series, there is no counterpart or conflict
>     with Stanislav's patchset.
> 4. cpuhotplug04.sh: operate only with hotpluggable CPUs
>     minor change here to use number of present CPUs, rather than all
>
> @Stanislav: Can you please review this series and check, whether
>              it still fixes issue you met on sparc64 kernel?

Big thanks for this work. I have few comments for patches 2 and 3.

Yes, this series fixes the issue I met on our sparc64 kernel. To be 
honest, there is no cpu hotplug (yet), so all this test cases return 
TCONF ;)


>
> Regards,
> Jan
>
>
> Jan Stancek (1):
>    cpu_hotplug: use hotplug/present cpus functions
>
> Stanislav Kholmanskikh (3):
>    cpuhotplug: use cpu states in cleanup
>    cpu_hotplug: add get_hotplug_cpus, get_present_cpus
>    cpuhotplug04.sh: operate only with hotpluggable CPUs
>
>   .../hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 17 ++---
>   .../hotplug/cpu_hotplug/functional/cpuhotplug02.sh |  2 +-
>   .../hotplug/cpu_hotplug/functional/cpuhotplug03.sh | 16 ++--
>   .../hotplug/cpu_hotplug/functional/cpuhotplug04.sh | 74 +++++++++---------
>   .../hotplug/cpu_hotplug/functional/cpuhotplug05.sh |  2 +-
>   .../hotplug/cpu_hotplug/functional/cpuhotplug06.sh |  2 +-
>   .../hotplug/cpu_hotplug/functional/cpuhotplug07.sh |  2 +-
>   .../cpu_hotplug/include/cpuhotplug_hotplug.sh      | 89 +++++++++++++++++++---
>   8 files changed, 135 insertions(+), 69 deletions(-)
>

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions
  2015-04-29 13:09   ` Stanislav Kholmanskikh
@ 2015-04-29 14:41     ` Jan Stancek
  2015-04-29 15:03       ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Stancek @ 2015-04-29 14:41 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: ltp-list





----- Original Message -----
> From: "Stanislav Kholmanskikh" <stanislav.kholmanskikh@oracle.com>
> To: "Jan Stancek" <jstancek@redhat.com>, ltp-list@lists.sourceforge.net
> Sent: Wednesday, 29 April, 2015 3:09:06 PM
> Subject: Re: [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions
> 
> On 04/29/2015 02:18 PM, Jan Stancek wrote:
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> >   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 6
> >   +++---
> >   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh | 2 +-
> >   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh | 4 ++--
> >   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh | 4 ++--
> >   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 2 +-
> >   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh | 2 +-
> >   testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh | 2 +-
> >   7 files changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git
> > a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
> > b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
> > index 52598a9..8ae1379 100755
> > --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
> > +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
> > @@ -111,7 +111,7 @@ LOOP_COUNT=1
> >
> >   tst_check_cmds perl
> >
> > -get_cpus_num
> > +get_present_cpus_num
> >   if [ $? -lt 2 ]; then
> >   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
> >   fi
> > @@ -148,7 +148,7 @@ do
> >   	IRQ_START=$(cat /proc/interrupts)
> >
> >   	# Attempt to offline all CPUs
> > -	for cpu in $( get_all_cpus ); do
> > +	for cpu in $( get_hotplug_cpus ); do
> >   		if [ "$cpu" = "cpu0" ]; then
> >   			continue
> >   		fi
> > @@ -163,7 +163,7 @@ do
> >   	done
> >
> >   	# Attempt to online all CPUs
> > -	for cpu in $( get_all_cpus ); do
> > +	for cpu in $( get_hotplug_cpus ); do
> >   		if [ "$cpu" = "cpu0" ]; then
> >   			continue
> >   		fi
> 
> Given that now this loop runs over hotpluggable cpus, it seems there is
> no reason to treat cpu0 specially in cpuhotplug0{1, 3, 4}.sh.

I'm not sure we can remove it in 01, because then it would try to bring
all offline and if all are hotpluggable it's going to fail.
I'd ignore 01 for now, it's broken anyway and disabled in runtest file.

03 looks like it can be removed, 04 is fixed by your patch.

Also, I'd prefer if those testcases would find suitable cpu to test
as part of test, instead of relying on passed parameters - but
I don't want to inflate this patchset even more now.

> 
> Patch 4 in this series has a fix for cpuhotplug04.sh, but other
> occurrences are unfixed.
> 
> 
> 
> > diff --git
> > a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> > b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> > index 3b33720..c42cc1b 100755
> > --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> > +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh
> > @@ -54,7 +54,7 @@ done
> >
> >   LOOP_COUNT=1
> >
> > -get_cpus_num
> > +get_present_cpus_num
> >   if [ $? -lt 2 ]; then
> >   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
> >   fi
> > diff --git
> > a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
> > b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
> > index 817f066..5da4854 100755
> > --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
> > +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
> > @@ -63,7 +63,7 @@ done
> >
> >   LOOP_COUNT=1
> >
> > -get_cpus_num
> > +get_present_cpus_num
> >   if [ $? -lt 2 ]; then
> >   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
> >   fi
> > @@ -86,7 +86,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG03_LOOPS ]; do
> >   	number_of_cpus=0
> >
> >   	# Turns on all CPUs
> > -	for i in $( get_all_cpus ); do
> > +	for i in $( get_hotplug_cpus ); do
> >               if [ "$i" = "cpu0" ]; then
> >                   continue
> >               fi
> 
> In general, get_hotplug_cpus should produce only a subset from
> get_all_cpus, so number_of_cpus below may be less that the total number
> of CPUs in the system.
> 
> But below in the code we have:
> 
>          # Start up a number of processes equal to twice the number of
>          # CPUs we have.  This is to help ensure we've got enough processes
>          # that at least one will migrate to the new CPU.  Store the PIDs
>          # so we can kill them later.
>          number_of_cpus=$((number_of_cpus*2))
>          until [ $number_of_cpus -eq 0 ]; do
>                  cpuhotplug_do_spin_loop > /dev/null 2>&1 &
>                  echo $! >> /var/run/hotplug4_$$.pid
>                  number_of_cpus=$((number_of_cpus-1))
>          done
> 
> It seems that now we need to fork $(( $(get_present_cpus_num) * 2 ))
> processes.

Good catch, I'll fix that.

Regards,
Jan

> 
> 
> > diff --git
> > a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
> > b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
> > index ea2723b..3e025da 100755
> > --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
> > +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh
> > @@ -62,7 +62,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
> >   	cpustate=1
> >
> >   	# Online all the CPUs
> > -	for i in $(get_all_cpus); do
> > +	for i in $(get_hotplug_cpus); do
> >   		if [ "$i" != "cpu0" ]; then
> >   			if ! cpu_is_online $i; then
> >   				if ! online_cpu $i; then
> > @@ -79,7 +79,7 @@ until [ $LOOP_COUNT -gt $HOTPLUG04_LOOPS ]; do
> >   	done
> >
> >   	# Now offline all the CPUs
> > -	for i in $(get_all_cpus); do
> > +	for i in $(get_hotplug_cpus); do
> >   		if ! offline_cpu $i; then
> >   			if [ "x$i" != "xcpu0" ]; then
> >   				tst_resm TFAIL "Did not offline first CPU (offlined $i instead)"
> > diff --git
> > a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> > b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> > index bb0e896..79f7e90 100755
> > --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> > +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
> > @@ -54,7 +54,7 @@ LOOP_COUNT=1
> >
> >   tst_check_cmds sar
> >
> > -get_cpus_num
> > +get_present_cpus_num
> >   if [ $? -lt 2 ]; then
> >   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
> >   fi
> > diff --git
> > a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> > b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> > index 2e48242..6710fad 100755
> > --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> > +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
> > @@ -49,7 +49,7 @@ done
> >
> >   LOOP_COUNT=1
> >
> > -get_cpus_num
> > +get_present_cpus_num
> >   if [ $? -lt 2 ]; then
> >   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
> >   fi
> > diff --git
> > a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> > b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> > index 723f3de..7edb3a9 100755
> > --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> > +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh
> > @@ -55,7 +55,7 @@ done
> >
> >   LOOP_COUNT=1
> >
> > -get_cpus_num
> > +get_present_cpus_num
> >   if [ $? -lt 2 ]; then
> >   	tst_brkm TCONF "system doesn't have required CPU hotplug support"
> >   fi
> >
> 

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions
  2015-04-29 14:41     ` Jan Stancek
@ 2015-04-29 15:03       ` Stanislav Kholmanskikh
  0 siblings, 0 replies; 10+ messages in thread
From: Stanislav Kholmanskikh @ 2015-04-29 15:03 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list



On 04/29/2015 05:41 PM, Jan Stancek wrote:
>
>
>
>
> ----- Original Message -----
>> From: "Stanislav Kholmanskikh" <stanislav.kholmanskikh@oracle.com>
>> To: "Jan Stancek" <jstancek@redhat.com>, ltp-list@lists.sourceforge.net
>> Sent: Wednesday, 29 April, 2015 3:09:06 PM
>> Subject: Re: [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions
>>
>> On 04/29/2015 02:18 PM, Jan Stancek wrote:
>>> Signed-off-by: Jan Stancek <jstancek@redhat.com>
>>> ---
>>>    testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 6
>>>    +++---
>>>    testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh | 2 +-
>>>    testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh | 4 ++--
>>>    testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh | 4 ++--
>>>    testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 2 +-
>>>    testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh | 2 +-
>>>    testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh | 2 +-
>>>    7 files changed, 11 insertions(+), 11 deletions(-)
>>>
>>> diff --git
>>> a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
>>> b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
>>> index 52598a9..8ae1379 100755
>>> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
>>> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
>>> @@ -111,7 +111,7 @@ LOOP_COUNT=1
>>>
>>>    tst_check_cmds perl
>>>
>>> -get_cpus_num
>>> +get_present_cpus_num
>>>    if [ $? -lt 2 ]; then
>>>    	tst_brkm TCONF "system doesn't have required CPU hotplug support"
>>>    fi
>>> @@ -148,7 +148,7 @@ do
>>>    	IRQ_START=$(cat /proc/interrupts)
>>>
>>>    	# Attempt to offline all CPUs
>>> -	for cpu in $( get_all_cpus ); do
>>> +	for cpu in $( get_hotplug_cpus ); do
>>>    		if [ "$cpu" = "cpu0" ]; then
>>>    			continue
>>>    		fi
>>> @@ -163,7 +163,7 @@ do
>>>    	done
>>>
>>>    	# Attempt to online all CPUs
>>> -	for cpu in $( get_all_cpus ); do
>>> +	for cpu in $( get_hotplug_cpus ); do
>>>    		if [ "$cpu" = "cpu0" ]; then
>>>    			continue
>>>    		fi
>>
>> Given that now this loop runs over hotpluggable cpus, it seems there is
>> no reason to treat cpu0 specially in cpuhotplug0{1, 3, 4}.sh.
>
> I'm not sure we can remove it in 01, because then it would try to bring
> all offline and if all are hotpluggable it's going to fail.
> I'd ignore 01 for now, it's broken anyway and disabled in runtest file.
>
> 03 looks like it can be removed, 04 is fixed by your patch.
>
> Also, I'd prefer if those testcases would find suitable cpu to test
> as part of test, instead of relying on passed parameters - but
> I don't want to inflate this patchset even more now.

ok.


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2015-04-29 15:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29 11:17 [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes Jan Stancek
2015-04-29 11:17 ` [LTP] [PATCH 1/4] cpuhotplug: use cpu states in cleanup Jan Stancek
2015-04-29 11:17 ` [LTP] [PATCH 2/4] cpu_hotplug: add get_hotplug_cpus, get_present_cpus Jan Stancek
2015-04-29 12:56   ` Stanislav Kholmanskikh
2015-04-29 11:18 ` [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions Jan Stancek
2015-04-29 13:09   ` Stanislav Kholmanskikh
2015-04-29 14:41     ` Jan Stancek
2015-04-29 15:03       ` Stanislav Kholmanskikh
2015-04-29 11:18 ` [LTP] [PATCH 4/4] cpuhotplug04.sh: operate only with hotpluggable CPUs Jan Stancek
2015-04-29 13:11 ` [LTP] [PATCH 0/4 v2] (merged) cpuhotplug fixes Stanislav Kholmanskikh

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.