From 454561bf89fce4c656aaa7d0e05668f14a996370 Mon Sep 17 00:00:00 2001 From: Richael Zhuang Date: Mon, 6 Sep 2021 10:33:42 +0800 Subject: [PATCH] test/scheduler: add test of cppc_cpufreq current test only include intel acpi-cpufreq and pstate. Add test of cppc_cpufreq which works on most arm platforms. Change-Id: I5b34c15be7992e5a521d6acf7b5c30a0c4baaf9a Signed-off-by: Richael Zhuang Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9404 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki --- test/scheduler/common.sh | 35 +++++++++++++++++++++++++++++++++++ test/scheduler/governor.sh | 11 +++++++++++ 2 files changed, 46 insertions(+) diff --git a/test/scheduler/common.sh b/test/scheduler/common.sh index be807211e..d6230b5cf 100644 --- a/test/scheduler/common.sh +++ b/test/scheduler/common.sh @@ -291,6 +291,41 @@ map_cpufreq() { fi done ;; + cppc_cpufreq) + cpufreq_setspeed[cpu_idx]=$(< "$cpu/cpufreq/scaling_setspeed") + scaling_min_freqs[cpu_idx]=$(< "$cpu/cpufreq/scaling_min_freq") + scaling_max_freqs[cpu_idx]=$(< "$cpu/cpufreq/scaling_max_freq") + cpuinfo_max_freqs[cpu_idx]=$(< "$cpu/cpufreq/cpuinfo_max_freq") + nominal_perf[cpu_idx]=$(< "$cpu/acpi_cppc/nominal_perf") + highest_perf[cpu_idx]=$(< "$cpu/acpi_cppc/highest_perf") + + #the unit of highest_perf and nominal_perf differs on different arm platforms. + #For highest_perf, it maybe 300 or 3000000, both means 3.0GHz. + if ((highest_perf[cpu_idx] > nominal_perf[cpu_idx] && (\ + highest_perf[cpu_idx] == cpuinfo_max_freqs[cpu_idx] || \ + highest_perf[cpu_idx] * 10000 == cpuinfo_max_freqs[cpu_idx]))); then + cpufreq_is_turbo[cpu_idx]=1 + else + cpufreq_is_turbo[cpu_idx]=0 + fi + + if ((nominal_perf[cpu_idx] < 10000)); then + nominal_perf[cpu_idx]=$((nominal_perf[cpu_idx] * 10000)) + fi + + num_freqs=$(((nominal_perf[cpu_idx] - scaling_min_freqs[cpu_idx]) / 100000 + 1 + \ + cpufreq_is_turbo[cpu_idx])) + + available_freqs=() + for ((freq = 0; freq < num_freqs; freq++)); do + if ((freq == 0 && cpufreq_is_turbo[cpu_idx] == 1)); then + available_freqs[freq]=$((scaling_max_freqs[cpu_idx])) + else + available_freqs[freq]=$((nominal_perf[cpu_idx] - (\ + freq - cpufreq_is_turbo[cpu_idx]) * 100000)) + fi + done + ;; esac done if [[ -e $sysfs_cpu/cpufreq/boost ]]; then diff --git a/test/scheduler/governor.sh b/test/scheduler/governor.sh index fea69dcfd..2dfd798d6 100755 --- a/test/scheduler/governor.sh +++ b/test/scheduler/governor.sh @@ -38,6 +38,7 @@ update_main_core_cpufreq() { case "$main_core_driver" in acpi-cpufreq) main_core_setspeed=${cpufreq_setspeed[spdk_main_core]} ;; intel_pstate | intel_cpufreq) main_core_setspeed=$main_core_set_max_freq ;; + cppc_cpufreq) main_core_setspeed=${cpufreq_setspeed[spdk_main_core]} ;; esac } @@ -56,6 +57,10 @@ verify_dpdk_governor() { # - governor set to performance # - lowering max_freq and min_freq for the main core # - having max_freq and min_freq at lowest supported frequency + # - cppc_cpufreq: + # - governor set to userspace + # - lowering setspeed for the main core + # - having setspeed at lowest supported frequency local -g cpus @@ -105,6 +110,12 @@ verify_dpdk_governor() { && ((main_core_set_max_freq == main_core_set_min_freq)) \ && ((dir == 0)) ;; + cppc_cpufreq) + [[ $main_core_governor == userspace ]] \ + && [[ -n ${main_core_freqs_map[main_core_setspeed]} ]] \ + && ((main_core_setspeed == main_core_freqs[-1])) \ + && ((dir == 0)) + ;; esac && all_set=1 # Print stats after first sane sample was taken