Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <jtanenba@redhat.com>
Signed-off-by: Thomas Renninger <trenn@suse.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Jacob Tanenbaum and committed by
Rafael J. Wysocki
e98f033f 562e5f1a

+2 -2
+2 -2
tools/power/cpupower/utils/cpufreq-info.c
··· 434 434 unsigned long latency = cpufreq_get_transition_latency(cpu); 435 435 436 436 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")); 439 439 return -EINVAL; 440 440 } 441 441