• Janakarajan Natarajan's avatar
    cpupower: mperf_monitor: Introduce per_cpu_schedule flag · 7adafe54
    Janakarajan Natarajan authored
    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: default avatarJanakarajan Natarajan <Janakarajan.Natarajan@amd.com>
    Acked-by: default avatarThomas Renninger <trenn@suse.de>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    7adafe54
cpupower-monitor.h 2.34 KB