Skip to contentSkip to conversation

Patch "tools/power turbostat: bugfix: GFXMHz column not changing" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Oct 5, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

tools/power turbostat: bugfix: GFXMHz column not changing

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
tools-power-turbostat-bugfix-gfxmhz-column-not-changing.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Oct 5 10:28:31 CEST 2017

From: Len Brown <[email protected]>
Date: Sat, 4 Mar 2017 15:42:48 -0500
Subject: tools/power turbostat: bugfix: GFXMHz column not changing

From: Len Brown <[email protected]>

[ Upstream commit 22048c5485503749754b3b5daf9d99ef89fcacdc ]

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.

---
 tools/power/x86/turbostat/turbostat.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/power/x86/turbostat/turbostat.c +3 -1
@@ -2003,8 +2003,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)

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/tools-power-turbostat-bugfix-gfxmhz-column-not-changing.patch