• Pierre Gondois's avatar
    cpufreq: CPPC: Register EM based on efficiency class information · 740fcdc2
    Pierre Gondois authored
    Performance states and energy consumption values are not advertised
    in ACPI. In the GicC structure of the MADT table, the "Processor
    Power Efficiency Class field" (called efficiency class from now)
    allows to describe the relative energy efficiency of CPUs.
    
    To leverage the EM and EAS, the CPPC driver creates a set of
    artificial performance states and registers them in the Energy Model
    (EM), such as:
    - Every 20 capacity unit, a performance state is created.
    - The energy cost of each performance state gradually increases.
    No power value is generated as only the cost is used in the EM.
    
    During task placement, a task can raise the frequency of its whole
    pd. This can make EAS place a task on a pd with CPUs that are
    individually less energy efficient.
    As cost values are artificial, and to place tasks on CPUs with the
    lower efficiency class, a gap in cost values is generated for adjacent
    efficiency classes.
    E.g.:
    - efficiency class = 0, capacity is in [0-1024], so cost values
      are in [0: 51] (one performance state every 20 capacity unit)
    - efficiency class = 1, capacity is in [0-1024], cost values
      are in [1*gap+0: 1*gap+51].
    
    The value of the cost gap is chosen to absorb a the energy of 4 CPUs
    at their maximum capacity. This means that between:
    1- a pd of 4 CPUs, each of them being used at almost their full
       capacity. Their efficiency class is N.
    2- a CPU using almost none of its capacity. Its efficiency class is
       N+1
    EAS will choose the first option.
    
    This patch also populates the (struct cpufreq_driver).register_em
    callback if the valid efficiency_class ACPI values are provided.
    Signed-off-by: default avatarPierre Gondois <Pierre.Gondois@arm.com>
    Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    740fcdc2
cppc_cpufreq.c 25.3 KB