* [RFC PATCH] tools/power turbostat: Fix caller parameter of get_tdp_amd()
@ 2019-08-30 9:22 Pu Wen
2019-08-30 15:01 ` Calvin Walton
0 siblings, 1 reply; 2+ messages in thread
From: Pu Wen @ 2019-08-30 9:22 UTC (permalink / raw)
To: lenb, calvin.walton; +Cc: linux-pm, linux-kernel, stable, Pu Wen
Commit 9392bd98bba760be96ee ("tools/power turbostat: Add support for AMD
Fam 17h (Zen) RAPL") add a function get_tdp_amd(), the parameter is CPU
family. But the rapl_probe_amd() function use wrong model parameter.
Fix the wrong caller parameter of get_tdp_amd() to use family.
Cc: <stable@vger.kernel.org> # v5.1+
Signed-off-by: Pu Wen <puwen@hygon.cn>
---
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 75fc4fb..1cd28eb 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -4002,7 +4002,7 @@ void rapl_probe_amd(unsigned int family, unsigned int model)
rapl_energy_units = ldexp(1.0, -(msr >> 8 & 0x1f));
rapl_power_units = ldexp(1.0, -(msr & 0xf));
- tdp = get_tdp_amd(model);
+ tdp = get_tdp_amd(family);
rapl_joule_counter_range = 0xFFFFFFFF * rapl_energy_units / tdp;
if (!quiet)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC PATCH] tools/power turbostat: Fix caller parameter of get_tdp_amd()
2019-08-30 9:22 [RFC PATCH] tools/power turbostat: Fix caller parameter of get_tdp_amd() Pu Wen
@ 2019-08-30 15:01 ` Calvin Walton
0 siblings, 0 replies; 2+ messages in thread
From: Calvin Walton @ 2019-08-30 15:01 UTC (permalink / raw)
To: Pu Wen, lenb; +Cc: linux-pm, linux-kernel, stable
On Fri, 2019-08-30 at 17:22 +0800, Pu Wen wrote:
> Commit 9392bd98bba760be96ee ("tools/power turbostat: Add support for
> AMD
> Fam 17h (Zen) RAPL") add a function get_tdp_amd(), the parameter is
> CPU
> family. But the rapl_probe_amd() function use wrong model parameter.
> Fix the wrong caller parameter of get_tdp_amd() to use family.
Whoops, good catch. Before, this code was only working because the
switch statement in get_tdp_amd() has a default case.
That said, this patch is effectively a no-op, since the get_tdp_amd()
function returns the value "250" no matter what argument is passed. The
only reason the function exists in the first place is that I thought
there might be a way to read the configured TDP from the CPU, but I
couldn't find any documentation on how to do that at the time.
Reviewed-by: Calvin Walton <calvin.walton@kepstin.ca>
--
Calvin Walton <calvin.walton@kepstin.ca>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-30 15:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30 9:22 [RFC PATCH] tools/power turbostat: Fix caller parameter of get_tdp_amd() Pu Wen
2019-08-30 15:01 ` Calvin Walton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).