Skip to content

Commit

Permalink
cpupower: fix how "cpupower frequency-info" interprets latency
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
JacobTanenbaum authored and rafaeljw committed Dec 3, 2015
1 parent 562e5f1 commit e98f033
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/power/cpupower/utils/cpufreq-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ static int get_latency(unsigned int cpu, unsigned int human)
unsigned long latency = cpufreq_get_transition_latency(cpu);

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

Expand Down

0 comments on commit e98f033

Please sign in to comment.