Re: [PATCH 0/3] perf/x86/rapl: Enable RAPL for AMD Fam17h

From: Alexander Monakov
Date: Sat May 16 2020 - 12:56:30 EST


On Fri, 15 May 2020, Stephane Eranian wrote:

> The series first moves the rapl.c file to common perf_events x86 and then
> adds the support.
> From the user's point of view, the interface is identical with
> /sys/devices/power. The energy-pkg event is the only one supported.

AMD also has per-core energy metering via MSR 0xc001029a, and I wonder
if you have plans to expose it to perf as well. I see it does not fit
so nicely with the existing code (as it's per-core instead of per-die).

The turbostat tool already exposes these per-core readings:

Core CPU Avg_MHz Busy% Bzy_MHz TSC_MHz CorWatt PkgWatt
- - 3951 100.00 3951 2373 54.92 30.04
0 0 3945 100.00 3945 2370 8.97 29.98
1 1 3945 100.00 3945 2370 9.11
2 2 3945 100.00 3945 2370 8.96
4 3 3946 100.00 3946 2370 9.32
5 4 3946 100.00 3946 2370 9.11
6 5 3946 100.00 3946 2370 9.39

turbostat sums the per-core energy figures to show the per-socket 54.92W
value. Though as you can see on this example, the figure is not in agreement
with the per-socket MSR you're using in your patch. Maybe the per-core
values are less reliable, but I believe I have a test that shows per-package
figure to be inaccurate as well. It would be nice if AMD clarified how the
counters work.

And, for what (little) it's worth, the series is:

Tested-by: Alexander Monakov <amonakov@xxxxxxxxx>

Thank you.
Alexander