(merged) cpuhotplug fixes
v2 cover (merged) cpuhotplug fixes
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(-)
Signature · 13 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v2 1/4 cpuhotplug: use cpu states in cleanup
From: Stanislav Kholmanskikh <[email protected]>
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.
--- .../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(-)
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +4 -7
@@ -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
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh +5 -7
@@ -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
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh +5 -13
@@ -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
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh +10 -6
@@ -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
Signature · 13 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v2 2/4 cpu_hotplug: add get_hotplug_cpus, get_present_cpus
In reply to Jan StancekFrom: Stanislav Kholmanskikh <[email protected]>
--- .../cpu_hotplug/include/cpuhotplug_hotplug.sh | 73 +++++++++++++++++++++- 1 file changed, 70 insertions(+), 3 deletions(-)
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh +70 -3
@@ -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() #
Signature · 13 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 2/4] cpu_hotplug: add get_hotplug_cpus, get_present_cpus
Quoted 27 lines · Jan Stancek
From: Stanislav Kholmanskikh <[email protected]>
Signed-off-by Stanislav Kholmanskikh <[email protected]>Signed-off-by Jan Stancek <[email protected]>--- .../cpu_hotplug/include/cpuhotplug_hotplug.sh | 73 +++++++++++++++++++++- 1 file changed, 70 insertions(+), 3 deletions(-)testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh +6
-3@@ -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.
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh get_cpus_num() · line 146
Quoted 10 lines
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh +10
-0+# +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]' ?
Quoted 48 lines
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh +47
-0+ 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()
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh get_cpus_num() · line 203
Quoted 10 lines
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh +7
-0+# +# 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v2 3/4 cpu_hotplug: use hotplug/present cpus functions
In reply to Jan Stancek--- 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(-)
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +3 -3
@@ -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
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh +1 -1
@@ -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
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh +2 -2
@@ -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
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh +2 -2
@@ -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)"
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh +1 -1
@@ -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
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh +1 -1
@@ -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
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh +1 -1
@@ -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
Signature · 13 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions
Quoted 34 lines · Jan Stancek
Signed-off-by Jan Stancek <[email protected]>--- 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(-)testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +2
-2@@ -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
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh do · line 169
Quoted 8 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +1
-1@@ -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.
Quoted 27 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh +1
-1@@ -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" fitestcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh +1
-1@@ -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
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh until [ $LOOP_COUNT -gt $HOTPLUG03_LOOPS ]; do · line 92
Quoted 8 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh +1
-1@@ -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.
Quoted 54 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh +2
-2@@ -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)"testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh +1
-1@@ -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" fitestcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh +1
-1@@ -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" fitestcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh +0
-0
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh done · line 61
Quoted 8 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh +1
-1@@ -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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions
----- Original Message -----
Quoted 45 lines
From: "Stanislav Kholmanskikh" <[email protected]>
To: "Jan Stancek" <[email protected]>, [email protected]
Sent: Wednesday, 29 April, 2015 3:09:06 PM
Subject: Re: [PATCH 3/4]cpu_hotplug: use hotplug/present cpus functionsQuoted 39 lines · Jan Stancek
Signed-off-by Jan Stancek <[email protected]>--- 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.shb/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.shindex 52598a9..8ae1379 100755testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +2
-2@@ -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
Quoted 9 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh do · line 169
Quoted 6 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +1
-1# Attempt to online all CPUs - for cpu in $( get_all_cpus ); do + for cpu in $( get_hotplug_cpus ); do if [ "$cpu" = "cpu0" ]; then continue fiGiven 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.
Quoted 63 lines
Patch 4 in this series has a fix for
cpuhotplug04.sh, but other occurrences are unfixed.Quoted 31 lines
diff --git
a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.shb/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.shindex 3b33720..c42cc1b 100755testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug02.sh +1
-1@@ -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" fidiff --git
a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.shb/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.shindex 817f066..5da4854 100755testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh +1
-1@@ -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" fitestcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh until [ $LOOP_COUNT -gt $HOTPLUG03_LOOPS ]; do · line 92
Quoted 8 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug03.sh +1
-1@@ -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 fiIn general,
get_hotplug_cpusshould produce only a subset fromget_all_cpus, sonumber_of_cpusbelow 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/null2>&1 & echo $! >>/var/run/hotplug4_$$.pidnumber_of_cpus=$((number_of_cpus-1))
done
Quoted 2 lines
It seems that now we need to fork $(( $(get_present_cpus_num) * 2 )) processes.
Good catch, I'll fix that.
Regards,
Jan
Quoted 64 lines
Quoted 64 lines
diff --git
a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.shb/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.shindex ea2723b..3e025da 100755testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh +2
-2@@ -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.shb/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.shindex bb0e896..79f7e90 100755testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh +1
-1@@ -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" fidiff --git
a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.shb/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.shindex 2e48242..6710fad 100755testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh +1
-1@@ -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" fidiff --git
a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.shb/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.shindex 723f3de..7edb3a9 100755testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh +0
-0@@ -55,7 +55,7 @@ done
Quoted 9 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh done · line 61
Quoted 8 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug07.sh +1
-1LOOP_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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 3/4] cpu_hotplug: use hotplug/present cpus functions
Quoted 64 lines · Jan Stancek
----- Original Message -----
Quoted 45 lines
From: "Stanislav Kholmanskikh" <[email protected]>
To: "Jan Stancek" <[email protected]>, [email protected]
Sent: Wednesday, 29 April, 2015 3:09:06 PM
Subject: Re: [PATCH 3/4]cpu_hotplug: use hotplug/present cpus functionsQuoted 39 lines · Jan Stancek
Signed-off-by Jan Stancek <[email protected]>--- 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.shb/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.shindex 52598a9..8ae1379 100755testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +2
-2@@ -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 doneQuoted 9 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh do · line 169
Quoted 6 lines
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh +1
-1# Attempt to online all CPUs - for cpu in $( get_all_cpus ); do + for cpu in $( get_hotplug_cpus ); do if [ "$cpu" = "cpu0" ]; then continue fiGiven 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.
Quoted 5 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v2 4/4 cpuhotplug04.sh: operate only with hotpluggable CPUs
In reply to Jan StancekFrom: Stanislav Kholmanskikh <[email protected]>
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
--- .../hotplug/cpu_hotplug/functional/cpuhotplug04.sh | 52 +++++++++++++--------- 1 file changed, 30 insertions(+), 22 deletions(-)
testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug04.sh +30 -22
@@ -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
Signature · 13 lines
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 [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 20 lines · Jan Stancek
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/22678It 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: addedget_hotplug_cpus,get_hotplug_cpus_numThis patch has been merged with my 'get_present_cpus' patch,get_hotplug_cpushas 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
Quoted 2 lines
@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 ;)
Quoted 13 lines
Regards,
JanJan Stancek (1):
cpu_hotplug: use hotplug/present cpus functionsStanislav Kholmanskikh (3):
cpuhotplug: use cpu states in cleanup
cpu_hotplug: addget_hotplug_cpus,get_present_cpuscpuhotplug04.sh: operate only with hotpluggable CPUs
Quoted 10 lines
.../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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list