cpupower: mperf_monitor: Introduce per_cpu_schedule flag
authorJanakarajan Natarajan <Janakarajan.Natarajan@amd.com>
Tue, 5 Nov 2019 17:16:54 +0000 (17:16 +0000)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 6 Nov 2019 00:22:46 +0000 (17:22 -0700)
commit7adafe541fe5e015261a92d39db8b163db477337
tree57ebf767ed21b79514a515eec992f21111736193
parentd3f5d2a192a299f56579ae6e6283f9011b00208f
cpupower: mperf_monitor: Introduce per_cpu_schedule flag

The per_cpu_schedule flag is used to move the cpupower process to the cpu
on which we are looking to read the APERF/MPERF registers.

This prevents IPIs from being generated by read_msr()s as we are already
on the cpu of interest.

Ex: If cpupower is running on CPU 0 and we execute

    read_msr(20, MSR_APERF, val) then,
    read_msr(20, MSR_MPERF, val)

    the msr module will generate an IPI from CPU 0 to CPU 20 to query
    for the MSR_APERF and then the MSR_MPERF in separate IPIs.

This delay, caused by IPI latency, between reading the APERF and MPERF
registers may cause both of them to go out of sync.

The use of the per_cpu_schedule flag reduces the probability of this
from happening. It comes at the cost of a negligible increase in cpu
consumption caused by the migration of cpupower across each of the
cpus of the system.

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/idle_monitor/cpupower-monitor.h
tools/power/cpupower/utils/idle_monitor/mperf_monitor.c