]> git.baikalelectronics.ru Git - kernel.git/commit
tools/power turbostat: fix impossibly large CPU%c1 value
authorLen Brown <len.brown@intel.com>
Wed, 12 Apr 2017 23:44:51 +0000 (19:44 -0400)
committerLen Brown <len.brown@intel.com>
Thu, 13 Apr 2017 00:03:50 +0000 (20:03 -0400)
commit4f32d9557c174d0c807e657122241f455121dba0
tree8d220525609dcb1589167c8446731b316a84b67e
parent65e3615fc65fce3038f96a3c3c99f4a822565f12
tools/power turbostat: fix impossibly large CPU%c1 value

Most CPUs do not have a hardware c1 counter,
and so turbostat derives c1 residency:

c1 = TSC - MPERF - other_core_cstate_counters

As it is not possible to atomically read these coutners,
measurement jitter can case this calcuation to "go negative"
when very close to 0.  Turbostat detect that case and
simply prints c1 = 0.00%

But that check neglected to account for systems where the TSC
crystal clock domain and the MPERF BCLK domain are differ by
a small amount.  That allowed very small negative c1 numbers
to escape this check and be printed as huge positve numbers.

This code begs for a bit of cleanup, but this patch
is the minimal change to fix the issue.

Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c