• Ionela Voinescu's avatar
    arm64: use activity monitors for frequency invariance · cd0ed03a
    Ionela Voinescu authored
    The Frequency Invariance Engine (FIE) is providing a frequency
    scaling correction factor that helps achieve more accurate
    load-tracking.
    
    So far, for arm and arm64 platforms, this scale factor has been
    obtained based on the ratio between the current frequency and the
    maximum supported frequency recorded by the cpufreq policy. The
    setting of this scale factor is triggered from cpufreq drivers by
    calling arch_set_freq_scale. The current frequency used in computation
    is the frequency requested by a governor, but it may not be the
    frequency that was implemented by the platform.
    
    This correction factor can also be obtained using a core counter and a
    constant counter to get information on the performance (frequency based
    only) obtained in a period of time. This will more accurately reflect
    the actual current frequency of the CPU, compared with the alternative
    implementation that reflects the request of a performance level from
    the OS.
    
    Therefore, implement arch_scale_freq_tick to use activity monitors, if
    present, for the computation of the frequency scale factor.
    
    The use of AMU counters depends on:
     - CONFIG_ARM64_AMU_EXTN - depents on the AMU extension being present
     - CONFIG_CPU_FREQ - the current frequency obtained using counter
       information is divided by the maximum frequency obtained from the
       cpufreq policy.
    
    While it is possible to have a combination of CPUs in the system with
    and without support for activity monitors, the use of counters for
    frequency invariance is only enabled for a CPU if all related CPUs
    (CPUs in the same frequency domain) support and have enabled the core
    and constant activity monitor counters. In this way, there is a clear
    separation between the policies for which arch_set_freq_scale (cpufreq
    based FIE) is used, and the policies for which arch_scale_freq_tick
    (counter based FIE) is used to set the frequency scale factor. For
    this purpose, a late_initcall_sync is registered to trigger validation
    work for policies that will enable or disable the use of AMU counters
    for frequency invariance. If CONFIG_CPU_FREQ is not defined, the use
    of counters is enabled on all CPUs only if all possible CPUs correctly
    support the necessary counters.
    Signed-off-by: default avatarIonela Voinescu <ionela.voinescu@arm.com>
    Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
    Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
    Cc: Sudeep Holla <sudeep.holla@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    cd0ed03a
topology.h 1.04 KB