[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20221208130805.66660-2-zhaogongyi@huawei.com>
Date: Thu, 8 Dec 2022 21:08:04 +0800
From: Zhao Gongyi <zhaogongyi@...wei.com>
To: <linux-kselftest@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<shuah@...nel.org>
CC: <zhaogongyi@...wei.com>
Subject: [PATCH -next 1/2] selftests/intel_pstate: Add saving and restore of scaling_governor
Add saving and restore of scaling_governor for cpus, otherwise the
cpus will run in the policy of powersave, and it would reduce the
performance as unexpected.
Signed-off-by: Zhao Gongyi <zhaogongyi@...wei.com>
---
tools/testing/selftests/intel_pstate/run.sh | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh
index e7008f614ad7..ee78c61cccb9 100755
--- a/tools/testing/selftests/intel_pstate/run.sh
+++ b/tools/testing/selftests/intel_pstate/run.sh
@@ -46,6 +46,12 @@ fi
max_cpus=$(($(nproc)-1))
+# Save the scaling_governor
+for i in `seq 0 $max_cpus`
+do
+ cat /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor >> /tmp/governor
+done
+
function run_test () {
file_ext=$1
@@ -125,4 +131,14 @@ done
# print the table
pr -aTt -5 < /tmp/result.tab
+# restore the scaling_governor
+i=0
+while read line
+do
+ echo $line > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor
+ let i=$i+1
+done < /tmp/governor
+
+rm -f /tmp/governor
+
exit 0
--
2.17.1
Powered by blists - more mailing lists