* [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes
@ 2015-04-30 8:13 Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 1/4 v3] cpuhotplug: use cpu states in cleanup Jan Stancek
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Jan Stancek @ 2015-04-30 8:13 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
Changes in v3:
+ use present_mask variable in get_present_cpus
+ no special treatment for cpu0 in cpuhotplug03
+ fix cpuhotplug03 to spawn (number of present cpus)*2 processes
+ this time whole series has correct version in subject
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 | 32 +++-----
.../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, 140 insertions(+), 80 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] 7+ messages in thread
* [LTP] [PATCH 1/4 v3] cpuhotplug: use cpu states in cleanup
2015-04-30 8:13 [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Jan Stancek
@ 2015-04-30 8:13 ` Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 2/4 v3] cpu_hotplug: add get_hotplug_cpus, get_present_cpus Jan Stancek
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jan Stancek @ 2015-04-30 8:13 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] 7+ messages in thread
* [LTP] [PATCH 2/4 v3] cpu_hotplug: add get_hotplug_cpus, get_present_cpus
2015-04-30 8:13 [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 1/4 v3] cpuhotplug: use cpu states in cleanup Jan Stancek
@ 2015-04-30 8:13 ` Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 3/4 v3] cpu_hotplug: use hotplug/present cpus functions Jan Stancek
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jan Stancek @ 2015-04-30 8:13 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..6920393 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()
+{
+ local present_mask="/sys/devices/system/cpu/present"
+ local present_cpus=""
+
+ # if sysfs present mask is missing, assume all cpu are present
+ if [ ! -e "$present_mask" ]; then
+ get_all_cpus
+ return
+ fi
+
+ 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] 7+ messages in thread
* [LTP] [PATCH 3/4 v3] cpu_hotplug: use hotplug/present cpus functions
2015-04-30 8:13 [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 1/4 v3] cpuhotplug: use cpu states in cleanup Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 2/4 v3] cpu_hotplug: add get_hotplug_cpus, get_present_cpus Jan Stancek
@ 2015-04-30 8:13 ` Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 4/4 v3] cpuhotplug04.sh: operate only with hotpluggable CPUs Jan Stancek
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jan Stancek @ 2015-04-30 8:13 UTC (permalink / raw)
To: ltp-list
Also, make no special treatment for cpu0.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../hotplug/cpu_hotplug/functional/cpuhotplug01.sh | 6 +++---
.../hotplug/cpu_hotplug/functional/cpuhotplug02.sh | 2 +-
.../hotplug/cpu_hotplug/functional/cpuhotplug03.sh | 20 +++++++-------------
.../hotplug/cpu_hotplug/functional/cpuhotplug04.sh | 4 ++--
.../hotplug/cpu_hotplug/functional/cpuhotplug05.sh | 2 +-
.../hotplug/cpu_hotplug/functional/cpuhotplug06.sh | 2 +-
.../hotplug/cpu_hotplug/functional/cpuhotplug07.sh | 2 +-
7 files changed, 16 insertions(+), 22 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..3469b10 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh
@@ -63,8 +63,9 @@ 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
@@ -82,21 +83,14 @@ 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
- for i in $( get_all_cpus ); do
- if [ "$i" = "cpu0" ]; then
- continue
- fi
+ for i in $( get_hotplug_cpus ); do
if ! cpu_is_online $i; then
if ! online_cpu $i; then
tst_brkm TBROK "Could not online cpu $i"
fi
- cpu=$((cpu+1))
fi
- number_of_cpus=$((number_of_cpus+1))
done
if ! offline_cpu ${CPU_TO_TEST} ; then
@@ -107,11 +101,11 @@ until [ $LOOP_COUNT -gt $HOTPLUG03_LOOPS ]; do
# 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
+ number_of_procs=$((cpus_num*2))
+ until [ $number_of_procs -eq 0 ]; do
cpuhotplug_do_spin_loop > /dev/null 2>&1 &
echo $! >> /var/run/hotplug4_$$.pid
- number_of_cpus=$((number_of_cpus-1))
+ number_of_procs=$((number_of_procs-1))
done
ps aux | head -n 1
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] 7+ messages in thread
* [LTP] [PATCH 4/4 v3] cpuhotplug04.sh: operate only with hotpluggable CPUs
2015-04-30 8:13 [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Jan Stancek
` (2 preceding siblings ...)
2015-04-30 8:13 ` [LTP] [PATCH 3/4 v3] cpu_hotplug: use hotplug/present cpus functions Jan Stancek
@ 2015-04-30 8:13 ` Jan Stancek
2015-04-30 14:33 ` [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Stanislav Kholmanskikh
2015-05-12 8:24 ` Cyril Hrubis
5 siblings, 0 replies; 7+ messages in thread
From: Jan Stancek @ 2015-04-30 8:13 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] 7+ messages in thread
* Re: [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes
2015-04-30 8:13 [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Jan Stancek
` (3 preceding siblings ...)
2015-04-30 8:13 ` [LTP] [PATCH 4/4 v3] cpuhotplug04.sh: operate only with hotpluggable CPUs Jan Stancek
@ 2015-04-30 14:33 ` Stanislav Kholmanskikh
2015-05-12 8:24 ` Cyril Hrubis
5 siblings, 0 replies; 7+ messages in thread
From: Stanislav Kholmanskikh @ 2015-04-30 14:33 UTC (permalink / raw)
To: Jan Stancek, ltp-list
On 04/30/2015 11:13 AM, 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
>
> Changes in v3:
> + use present_mask variable in get_present_cpus
> + no special treatment for cpu0 in cpuhotplug03
> + fix cpuhotplug03 to spawn (number of present cpus)*2 processes
> + this time whole series has correct version in subject
Reviewed-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Plus tested the series in a 4 vCPU VirtualBox VM both with and without
the 'cpu0_hotplug' kernel cmdline.
Thanks.
------------------------------------------------------------------------------
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] 7+ messages in thread
* Re: [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes
2015-04-30 8:13 [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Jan Stancek
` (4 preceding siblings ...)
2015-04-30 14:33 ` [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Stanislav Kholmanskikh
@ 2015-05-12 8:24 ` Cyril Hrubis
5 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2015-05-12 8:24 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
Looks good to me as well.
(you should have pushed it already)
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
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] 7+ messages in thread
end of thread, other threads:[~2015-05-12 8:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-30 8:13 [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 1/4 v3] cpuhotplug: use cpu states in cleanup Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 2/4 v3] cpu_hotplug: add get_hotplug_cpus, get_present_cpus Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 3/4 v3] cpu_hotplug: use hotplug/present cpus functions Jan Stancek
2015-04-30 8:13 ` [LTP] [PATCH 4/4 v3] cpuhotplug04.sh: operate only with hotpluggable CPUs Jan Stancek
2015-04-30 14:33 ` [LTP] [PATCH 0/4 v3] (merged) cpuhotplug fixes Stanislav Kholmanskikh
2015-05-12 8:24 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox