Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the set_scaling_governor() bug #414

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions BM/pstate/intel_pstate_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CPU_CPUFREQ_ATTR="affected_cpus cpuinfo_max_freq cpuinfo_min_freq
cpuinfo_transition_latency related_cpus scaling_available_governors
scaling_cur_freq scaling_driver scaling_governor scaling_max_freq
scaling_min_freq scaling_setspeed"
DEFAULT_SCALING_GOV=$(cat $CPU_SYSFS_PATH/cpu0/cpufreq/scaling_governor)

# rdmsr tool is required to run pstate cases
if which rdmsr 1>/dev/null 2>&1; then
Expand Down Expand Up @@ -151,9 +152,11 @@ set_scaling_governor() {
local mode=$1
local cpus=""

test_print_trc "The default scaling governor is: $DEFAULT_SCALING_GOV"

# Validate mode parameter
if [[ $mode != "performance" && $mode != "powersave" ]]; then
die "Invalid scaling governor mode. Mode must be 'performance' or 'powersave'."
if [[ $mode != "performance" && $mode != "powersave" && $mode != "schedutil" ]]; then
die "Invalid scaling govencrnor mode. Mode must be 'performance' or 'powersave' or 'schedutil'."
fi

# Get the number of CPUs
Expand Down Expand Up @@ -346,10 +349,12 @@ check_max_cores_freq() {
fi

[[ -n "$max_freq" ]] || {
set_scaling_governor $DEFAULT_SCALING_GOV
echo "$cpu_stat"
die "Cannot get the max freq"
}
[[ -n "$current_freq" ]] || {
set_scaling_governor $DEFAULT_SCALING_GOV
echo "$cpu_stat"
die "Cannot get current freq"
}
Expand All @@ -358,14 +363,17 @@ check_max_cores_freq() {

if [[ $(echo "$delta > 100" | bc) -eq 1 ]]; then
if power_limit_check; then
set_scaling_governor $DEFAULT_SCALING_GOV
test_print_trc "The package and core power limitation is being asserted."
test_print_trc "$current_freq is lower than $max_freq with power limitation asserted"
else
set_scaling_governor $DEFAULT_SCALING_GOV
test_print_trc "The package and core power limitation is NOT being asserted."
check_tuned_service
die "$current_freq is lower than $max_freq without power limitation asserted"
fi
else
set_scaling_governor $DEFAULT_SCALING_GOV
test_print_trc "No thermal limitation, check all CPUs freq: PASS"
fi
}
Expand Down
Loading