Re: [PATCH 1/2] Modify cpupower to schedule itself on cores it is reading MSRs from
From: Natarajan, Janakarajan
Date: Wed Oct 02 2019 - 10:45:08 EST
On 9/27/19 4:48 PM, Thomas Renninger wrote:
> On Friday, September 27, 2019 6:07:56 PM CEST Natarajan, Janakarajan wrote:
>> On 9/18/2019 11:34 AM, Natarajan, Janakarajan wrote:
>>> This is advantageous because an IPI is not generated when a read_msr() is
>>> executed on the local logical CPU thereby reducing the chance of having
>>> APERF and MPERF being out of sync.
>>> + if (sched_setaffinity(getpid(), sizeof(set), &set) == -1) {
>>> + dprint("Could not migrate to cpu: %d\n", cpu);
>>> + return 1;
> On a 80 core cpu the process would be pushed around through the
> system quite a lot.
> This might affect what you are measuring or the other measure values?
> Otherwise it's the kernel's MSR read only, not the whole cpupower process,
> right? No idea about the exact overhead, though. Others in CC list should
> know.
On a 256 logical-cpu Rome system we see C0 value from cpupower output go
from 0.01 to ~(0.1 to 1.00)
for all cpus with the 1st patch.
However, this goes down to ~0.01 when we use the RDPRU instruction
(which can be used to get
APERF/MPERF from CPL > 0) and avoid using the msr module (patch 2).
> Afaik msr reads through msr module should be avoided anyway?
> Those which are worth it are abstracted through sysfs nowadays?
>
> For aperf/mperf it might make sense to define a sysfs file where you
> can read both, as this is what you always need?
>
> It would take a while, but could be a longterm solution which is also
> usable in secure boot or without msr module case.
Yes. That is a good long term idea. An interface which could be used to
query APERF, MPERF
for a logical cpu in one go.
However, for systems that provide an instruction to get register values
from userspace, would a
command-line parameter be acceptable?
i.e. p: precise measurement.
When this is set, the cpupower process can migrate to each cpu and ,if
an instruction is available
which can get the APERF/MPERF from CPL > 0, use it. That would cut out
the msr module and the
overhead can be reduced.
Thanks.
> Thomas
>
>
>