cpupower: mperf_monitor: Update cpupower to use the RDPRU instruction
authorJanakarajan Natarajan <Janakarajan.Natarajan@amd.com>
Tue, 5 Nov 2019 17:16:55 +0000 (17:16 +0000)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 6 Nov 2019 00:22:56 +0000 (17:22 -0700)
commit6af2ed53f0402c09b36d2b38698e18a25ca732a7
treeea83341eecb9c5b048929e9aa75abf140ae48a3c
parent7adafe541fe5e015261a92d39db8b163db477337
cpupower: mperf_monitor: Update cpupower to use the RDPRU instruction

AMD Zen 2 introduces the RDPRU instruction which can be used to access some
processor registers which are typically only accessible in privilege level
0. ECX specifies the register to read and EDX:EAX will contain the value read.

ECX: 0 - Register MPERF
     1 - Register APERF

This has the added advantage of not having to use the msr module, since the
userspace to kernel transitions which occur during each read_msr() might
cause APERF and MPERF to go out of sync.

Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/power/cpupower/utils/helpers/cpuid.c
tools/power/cpupower/utils/helpers/helpers.h
tools/power/cpupower/utils/idle_monitor/mperf_monitor.c