Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1622621 > unrolled thread

[GIT PULL PATCH 0/7] turbostat fixes

Started byLen Brown <lenb@kernel.org>
First post2017-04-13 02:10 +0200
Last post2017-04-13 03:30 +0200
Articles 7 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [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

#1622621 — [GIT PULL PATCH 0/7] turbostat fixes

FromLen Brown <lenb@kernel.org>
Date2017-04-13 02:10 +0200
Subject[GIT PULL PATCH 0/7] turbostat fixes
Message-ID<tvAuJ-3mx-3@gated-at.bofh.it>
Hi Rafael,

Please pull these turbostat patches.

thanks!
Len Brown, Intel Open Source Technology Center

The following changes since commit e3942ed8c66bcff496abee5182422cd542962d9e:

  tools/power turbostat: version 17.02.24 (2017-03-01 00:14:26 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git turbostat

for you to fetch changes up to 5f9bf02a58f0f62d111994805212d0a775499862:

  tools/power turbostat: update version number (2017-04-12 20:03:50 -0400)

----------------------------------------------------------------
Doug Smythies (1):
      tools/power turbostat: turbostat.8 add missing column definitions

Len Brown (6):
      tools/power turbostat: bugfix: GFXMHz column not changing
      tools/power turbostat: show missing Core and GFX power on SKL and KBL
      tools/power turbostat: enable package THERM_INTERRUPT dump
      tools/power turbostat: update HWP dump to decimal from hex
      tools/power turbostat: fix impossibly large CPU%c1 value
      tools/power turbostat: update version number

 tools/power/x86/turbostat/turbostat.8 |  2 ++
 tools/power/x86/turbostat/turbostat.c | 26 +++++++++++++-------------
 2 files changed, 15 insertions(+), 13 deletions(-)

[toc] | [next] | [standalone]


#1622625 — [PATCH 6/7] tools/power turbostat: fix impossibly large CPU%c1 value

FromLen Brown <lenb@kernel.org>
Date2017-04-13 02:20 +0200
Subject[PATCH 6/7] tools/power turbostat: fix impossibly large CPU%c1 value
Message-ID<tvAEp-3qZ-5@gated-at.bofh.it>
In reply to#1622621
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

[toc] | [prev] | [next] | [standalone]


#1622627 — [PATCH 4/7] tools/power turbostat: update HWP dump to decimal from hex

FromLen Brown <lenb@kernel.org>
Date2017-04-13 02:20 +0200
Subject[PATCH 4/7] tools/power turbostat: update HWP dump to decimal from hex
Message-ID<tvAEq-3qZ-21@gated-at.bofh.it>
In reply to#1622621
From: Len Brown <len.brown@intel.com>

Syntax only.

The HWP CAPABILTIES and REQUEST ratios are more easily
viewed in decimal -- just multiply by 100 and you get MHz...

new:
cpu0: MSR_HWP_CAPABILITIES: 0x010c1b23 (high 35 guar 27 eff 12 low 1)
cpu0: MSR_HWP_REQUEST: 0x80002301 (min 1 max 35 des 0 epp 0x80 window 0x0 pkg 0x0)

old:
cpu0: MSR_HWP_CAPABILITIES: 0x010c1b23 (high 0x23 guar 0x1b eff 0xc low 0x1)
cpu0: MSR_HWP_REQUEST: 0x80002301 (min 0x1 max 0x23 des 0x0 epp 0x80 window 0x0 pkg 0x0)

Signed-off-by: Len Brown <len.brown@intel.com>
---
 tools/power/x86/turbostat/turbostat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index e95799966560..b0591d0da801 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -3113,7 +3113,7 @@ int print_hwp(struct thread_data *t, struct core_data *c, struct pkg_data *p)
 		return 0;
 
 	fprintf(outf, "cpu%d: MSR_HWP_CAPABILITIES: 0x%08llx "
-			"(high 0x%x guar 0x%x eff 0x%x low 0x%x)\n",
+			"(high %d guar %d eff %d low %d)\n",
 			cpu, msr,
 			(unsigned int)HWP_HIGHEST_PERF(msr),
 			(unsigned int)HWP_GUARANTEED_PERF(msr),
@@ -3124,7 +3124,7 @@ int print_hwp(struct thread_data *t, struct core_data *c, struct pkg_data *p)
 		return 0;
 
 	fprintf(outf, "cpu%d: MSR_HWP_REQUEST: 0x%08llx "
-			"(min 0x%x max 0x%x des 0x%x epp 0x%x window 0x%x pkg 0x%x)\n",
+			"(min %d max %d des %d epp 0x%x window 0x%x pkg 0x%x)\n",
 			cpu, msr,
 			(unsigned int)(((msr) >> 0) & 0xff),
 			(unsigned int)(((msr) >> 8) & 0xff),
@@ -3138,7 +3138,7 @@ int print_hwp(struct thread_data *t, struct core_data *c, struct pkg_data *p)
 			return 0;
 
 		fprintf(outf, "cpu%d: MSR_HWP_REQUEST_PKG: 0x%08llx "
-			"(min 0x%x max 0x%x des 0x%x epp 0x%x window 0x%x)\n",
+			"(min %d max %d des %d epp 0x%x window 0x%x)\n",
 			cpu, msr,
 			(unsigned int)(((msr) >> 0) & 0xff),
 			(unsigned int)(((msr) >> 8) & 0xff),
-- 
2.11.0.161.g6610af872

[toc] | [prev] | [next] | [standalone]


#1622631 — [PATCH 7/7] tools/power turbostat: update version number

FromLen Brown <lenb@kernel.org>
Date2017-04-13 02:20 +0200
Subject[PATCH 7/7] tools/power turbostat: update version number
Message-ID<tvAEq-3qZ-19@gated-at.bofh.it>
In reply to#1622621
From: Len Brown <len.brown@intel.com>

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 0ad966114e58..b11294730771 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -4578,7 +4578,7 @@ int get_and_dump_counters(void)
 }
 
 void print_version() {
-	fprintf(outf, "turbostat version 17.02.24"
+	fprintf(outf, "turbostat version 17.04.12"
 		" - Len Brown <lenb@kernel.org>\n");
 }
 
-- 
2.11.0.161.g6610af872

[toc] | [prev] | [next] | [standalone]


#1622632 — [PATCH 5/7] tools/power turbostat: turbostat.8 add missing column definitions

FromLen Brown <lenb@kernel.org>
Date2017-04-13 02:20 +0200
Subject[PATCH 5/7] tools/power turbostat: turbostat.8 add missing column definitions
Message-ID<tvAEq-3qZ-23@gated-at.bofh.it>
In reply to#1622621
From: Doug Smythies <doug.smythies@gmail.com>

Add GFX%rc6 and GFXMHz to the column descriptions section
of the turbostat man page.

Signed-off-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 tools/power/x86/turbostat/turbostat.8 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8
index fedca3285326..ccf2a69365cc 100644
--- a/tools/power/x86/turbostat/turbostat.8
+++ b/tools/power/x86/turbostat/turbostat.8
@@ -100,6 +100,8 @@ The system configuration dump (if --quiet is not used) is followed by statistics
 \fBCPU%c1, CPU%c3, CPU%c6, CPU%c7\fP show the percentage residency in hardware core idle states.  These numbers are from hardware residency counters.
 \fBCoreTmp\fP Degrees Celsius reported by the per-core Digital Thermal Sensor.
 \fBPkgTtmp\fP Degrees Celsius reported by the per-package Package Thermal Monitor.
+\fBGFX%rc6\fP The percentage of time the GPU is in the "render C6" state, rc6, during the measurement interval. From /sys/class/drm/card0/power/rc6_residency_ms.
+\fBGFXMHz\fP Instantaneous snapshot of what sysfs presents at the end of the measurement interval. From /sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz.
 \fBPkg%pc2, Pkg%pc3, Pkg%pc6, Pkg%pc7\fP percentage residency in hardware package idle states.  These numbers are from hardware residency counters.
 \fBPkgWatt\fP Watts consumed by the whole package.
 \fBCorWatt\fP Watts consumed by the core part of the package.
-- 
2.11.0.161.g6610af872

[toc] | [prev] | [next] | [standalone]


#1622633 — [PATCH 1/7] tools/power turbostat: bugfix: GFXMHz column not changing

FromLen Brown <lenb@kernel.org>
Date2017-04-13 02:20 +0200
Subject[PATCH 1/7] tools/power turbostat: bugfix: GFXMHz column not changing
Message-ID<tvAEq-3qZ-25@gated-at.bofh.it>
In reply to#1622621
From: Len Brown <len.brown@intel.com>

turbostat displays a GFXMHz column, which comes from reading
/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz

But GFXMHz was not changing, even when a manual
cat /sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz
showed a new value.

It turns out that a rewind() on the open file is not sufficient,
fflush() (or a close/open) is needed to read fresh values.

Reported-by: Yaroslav Isakov <yaroslav.isakov@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 tools/power/x86/turbostat/turbostat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 828dccd3f01e..d7fb6bcb2744 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -2485,8 +2485,10 @@ int snapshot_gfx_mhz(void)
 
 	if (fp == NULL)
 		fp = fopen_or_die("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", "r");
-	else
+	else {
 		rewind(fp);
+		fflush(fp);
+	}
 
 	retval = fscanf(fp, "%d", &gfx_cur_mhz);
 	if (retval != 1)
-- 
2.11.0.161.g6610af872

[toc] | [prev] | [next] | [standalone]


#1622657

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2017-04-13 03:30 +0200
Message-ID<tvBKa-46h-7@gated-at.bofh.it>
In reply to#1622621
On Thu, Apr 13, 2017 at 2:08 AM, Len Brown <lenb@kernel.org> wrote:
> Hi Rafael,
>
> Please pull these turbostat patches.
>
> thanks!
> Len Brown, Intel Open Source Technology Center
>
> The following changes since commit e3942ed8c66bcff496abee5182422cd542962d9e:
>
>   tools/power turbostat: version 17.02.24 (2017-03-01 00:14:26 -0500)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git turbostat
>
> for you to fetch changes up to 5f9bf02a58f0f62d111994805212d0a775499862:
>
>   tools/power turbostat: update version number (2017-04-12 20:03:50 -0400)

Pulled, thanks!

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web