diff options
author | santosh shukla <santosh.shukla@linaro.org> | 2014-07-14 15:20:55 +0530 |
---|---|---|
committer | Fathi Boudra <fabo@debian.org> | 2014-07-14 13:44:41 +0300 |
commit | 02f82936089d5aa48381bdba70d067eba84c4c1b (patch) | |
tree | 24d104ee463235048ef754fdcdde233aa5d54648 | |
parent | 80851a4762f27599fa9ef0512c9039967aa78d92 (diff) |
is-cpu-isolated: Fix incorrect list of non-isol-cpus
update_non_isol_cpus() was incorrectly expecting ISOL_CPUS to contain only one
CPU and would fail badly if a comma separated list of CPUs is passed to it.
For example:
run ./is_isol_cpus 1,2 [out of 4 physical cpu, cpu 1 & 2 to isolate]
would result in: Isolate: CPU 1,2 and leave others: 0,1,2,3
Fix it by adding another routine to find if a cpu is isolated one or not.
Change-Id: I64e853dc55efd8fb668e2a3f628e5497aa6d009f
Signed-off-by: santosh shukla <santosh.shukla@linaro.org>
-rwxr-xr-x | common/scripts/is-cpu-isolated.sh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/scripts/is-cpu-isolated.sh b/common/scripts/is-cpu-isolated.sh index 99c2ced..d7dfb15 100755 --- a/common/scripts/is-cpu-isolated.sh +++ b/common/scripts/is-cpu-isolated.sh @@ -64,6 +64,18 @@ dump_interrupts() { printf "\n\n" } +# Check $1 is isol cpu or not +is_isol_cpu() { + for i in `echo $ISOL_CPUS | sed 's/,/ /g'`; do + if [ $i = $1 ] + then + echo 1 # isol cpu found + fi + done + + echo 0 # non-isol cpu +} + # update list of all non-ISOL CPUs update_non_isol_cpus() { total_cpus=`nproc --all --ignore=1` #ignore CPU 0 as we already have that @@ -71,7 +83,7 @@ update_non_isol_cpus() { while [ $cpu -le $total_cpus ] do - [ $cpu != $ISOL_CPUS ] && NON_ISOL_CPUS="$NON_ISOL_CPUS,$cpu" + [ "$(is_isol_cpu $cpu)" == 0 ] && NON_ISOL_CPUS="$NON_ISOL_CPUS,$cpu" let cpu=cpu+1 done |