Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1622625
| From | Len Brown <lenb@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 6/7] tools/power turbostat: fix impossibly large CPU%c1 value |
| Date | 2017-04-13 02:20 +0200 |
| Message-ID | <tvAEp-3qZ-5@gated-at.bofh.it> (permalink) |
| References | <tvAuJ-3mx-3@gated-at.bofh.it> |
| Organization | Intel Open Source Technology Center |
From: Len Brown <len.brown@intel.com>
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index b0591d0da801..0ad966114e58 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -1142,7 +1142,7 @@ delta_thread(struct thread_data *new, struct thread_data *old,
* it is possible for mperf's non-halted cycles + idle states
* to exceed TSC's all cycles: show c1 = 0% in that case.
*/
- if ((old->mperf + core_delta->c3 + core_delta->c6 + core_delta->c7) > old->tsc)
+ if ((old->mperf + core_delta->c3 + core_delta->c6 + core_delta->c7) > (old->tsc * tsc_tweak))
old->c1 = 0;
else {
/* normal case, derive c1 */
--
2.11.0.161.g6610af872
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL PATCH 0/7] turbostat fixes Len Brown <lenb@kernel.org> - 2017-04-13 02:10 +0200 [PATCH 6/7] tools/power turbostat: fix impossibly large CPU%c1 value Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 [PATCH 4/7] tools/power turbostat: update HWP dump to decimal from hex Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 [PATCH 7/7] tools/power turbostat: update version number Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 [PATCH 5/7] tools/power turbostat: turbostat.8 add missing column definitions Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 [PATCH 1/7] tools/power turbostat: bugfix: GFXMHz column not changing Len Brown <lenb@kernel.org> - 2017-04-13 02:20 +0200 Re: [GIT PULL PATCH 0/7] turbostat fixes "Rafael J. Wysocki" <rafael@kernel.org> - 2017-04-13 03:30 +0200
csiph-web