runpwtests_exclusive03.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #! /bin/sh
  2. #
  3. # Copyright (c) International Business Machines Corp., 2001
  4. # Author: Nageswara R Sastry <nasastry@in.ibm.com>
  5. #
  6. # This program is free software; you can redistribute it and#or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  13. # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14. # for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software Foundation,
  18. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. #
  20. export TCID="Power_Management_exclusive03"
  21. export TST_TOTAL=2
  22. . test.sh
  23. . pm_include.sh
  24. # Checking test environment
  25. check_kervel_arch
  26. if tst_kvcmp -gt "2.6.29"; then
  27. max_sched_mc=2
  28. max_sched_smt=2
  29. else
  30. max_sched_mc=1
  31. max_sched_smt=1
  32. fi
  33. tst_require_cmds python3
  34. hyper_threaded=$(is_hyper_threaded)
  35. multi_socket=$(is_multi_socket)
  36. multi_core=$(is_multi_core)
  37. if [ $multi_socket -ne 0 -o $multi_core -ne 0 -o \
  38. $hyper_threaded -ne 0 ]; then
  39. tst_brkm TCONF "System is not a multi socket & multi core" \
  40. "& hyper-threaded"
  41. fi
  42. # Verify threads consolidation stops when sched_mc &(/) sched_smt
  43. # is disabled.
  44. # Vary sched_mc from 1/2 to 0 when workload is running and
  45. # ensure that tasks do not consolidate to single package when
  46. # sched_mc is set to 0.
  47. RC=0
  48. for sched_mc in `seq 1 $max_sched_mc`; do
  49. if pm_cpu_consolidation.py -v -c $sched_mc; then
  50. echo "Test PASS: CPU consolidation test by varying" \
  51. "sched_mc $sched_mc to 0"
  52. else
  53. RC=1
  54. echo "Test FAIL: CPU consolidation test by varying" \
  55. "sched_mc $sched_mc to 0"
  56. fi
  57. done
  58. if [ $RC -eq 0 ]; then
  59. tst_resm TPASS "CPU consolidation test by varying sched_mc"
  60. else
  61. tst_resm TFAIL "CPU consolidation test by varying sched_mc"
  62. fi
  63. # Vary sched_mc & sched_smt from 1 to 0 & 2 to 0 when workload
  64. # is running and ensure that tasks do not consolidate to single
  65. # package when sched_mc is set to 0.
  66. RC=0
  67. for sched_mc in `seq 1 $max_sched_mc`; do
  68. for sched_smt in `seq 1 $max_sched_smt`; do
  69. if [ $sched_smt -eq $sched_mc ]; then
  70. if pm_cpu_consolidation.py -v -c $sched_mc \
  71. -t $sched_smt; then
  72. echo "Test PASS: CPU consolidation test by" \
  73. "varying sched_mc & sched_smt from" \
  74. "$sched_mc to 0"
  75. else
  76. RC=1
  77. echo "Test FAIL: CPU consolidation test by" \
  78. "varying sched_mc & sched_smt from" \
  79. "$sched_mc to 0"
  80. fi
  81. fi
  82. done
  83. done
  84. if [ $RC -eq 0 ]; then
  85. tst_resm TPASS "CPU consolidation test by varying" \
  86. "sched_mc & sched_smt"
  87. else
  88. tst_resm TFAIL "CPU consolidation test by varying" \
  89. "sched_mc & sched_smt"
  90. fi
  91. tst_exit