Skip to content

Commit e98f033

Browse files
JacobTanenbaumrafaeljw
authored andcommitted
cpupower: fix how "cpupower frequency-info" interprets latency
the intel-pstate driver does not support the ondemand governor and does not have a valid value in /sys/devices/system/cpu/cpu[x]/cpufreq/cpuinfo_transition_latency. The intel-pstate driver sets cpuinfo_transition_latency to CPUFREQ_ETERNAL (-1), the value written into cpuinfo_transition_latency is defind as an unsigned int so checking the read value against max unsigned int will determine if the value is valid. Signed-off-by: Jacob Tanenbaum <[email protected]> Signed-off-by: Thomas Renninger <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 562e5f1 commit e98f033

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/power/cpupower/utils/cpufreq-info.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ static int get_latency(unsigned int cpu, unsigned int human)
434434
unsigned long latency = cpufreq_get_transition_latency(cpu);
435435

436436
printf(_(" maximum transition latency: "));
437-
if (!latency) {
438-
printf(_(" Cannot determine latency.\n"));
437+
if (!latency || latency == UINT_MAX) {
438+
printf(_(" Cannot determine or is not supported.\n"));
439439
return -EINVAL;
440440
}
441441

0 commit comments

Comments
 (0)