Commit 454561bf authored by Richael Zhuang's avatar Richael Zhuang Committed by Tomasz Zawadzki
Browse files

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: default avatarRichael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9404


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 5e1e850b
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -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
+11 −0
Original line number Diff line number Diff line
@@ -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