25 Jun, 2019

1 commit

  • The 'struct sched_domain *sd' parameter to arch_scale_cpu_capacity() is
    unused since commit:

    765d0af19f5f ("sched/topology: Remove the ::smt_gain field from 'struct sched_domain'")

    Remove it.

    Signed-off-by: Vincent Guittot
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Viresh Kumar
    Reviewed-by: Valentin Schneider
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: gregkh@linuxfoundation.org
    Cc: linux@armlinux.org.uk
    Cc: quentin.perret@arm.com
    Cc: rafael@kernel.org
    Link: https://lkml.kernel.org/r/1560783617-5827-1-git-send-email-vincent.guittot@linaro.org
    Signed-off-by: Ingo Molnar

    Vincent Guittot
     

24 Jan, 2019

1 commit

  • The recently introduced Energy Model (EM) framework manages power cost
    tables of CPUs. These tables are currently only visible from kernel
    space. However, in order to debug the behaviour of subsystems that use
    the EM (EAS for example), it is often required to know what the power
    costs are from userspace.

    For this reason, introduce under /sys/kernel/debug/energy_model a set of
    directories representing the performance domains of the system. Each
    performance domain contains a set of sub-directories representing the
    different capacity states (cs) and their attributes, as well as a file
    exposing the related CPUs.

    The resulting hierarchy is as follows on Arm juno r0 for example:

    /sys/kernel/debug/energy_model
    ├── pd0
    │   ├── cpus
    │   ├── cs:450000
    │   │   ├── cost
    │   │   ├── frequency
    │   │   └── power
    │   ├── cs:575000
    │   │   ├── cost
    │   │   ├── frequency
    │   │   └── power
    │   ├── cs:700000
    │   │   ├── cost
    │   │   ├── frequency
    │   │   └── power
    │   ├── cs:775000
    │   │   ├── cost
    │   │   ├── frequency
    │   │   └── power
    │   └── cs:850000
    │   ├── cost
    │   ├── frequency
    │   └── power
    └── pd1
    ├── cpus
    ├── cs:1100000
    │   ├── cost
    │   ├── frequency
    │   └── power
    ├── cs:450000
    │   ├── cost
    │   ├── frequency
    │   └── power
    ├── cs:625000
    │   ├── cost
    │   ├── frequency
    │   └── power
    ├── cs:800000
    │   ├── cost
    │   ├── frequency
    │   └── power
    └── cs:950000
    ├── cost
    ├── frequency
    └── power

    Signed-off-by: Quentin Perret
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Rafael J. Wysocki

    Quentin Perret
     

11 Dec, 2018

1 commit

  • Several subsystems in the kernel (task scheduler and/or thermal at the
    time of writing) can benefit from knowing about the energy consumed by
    CPUs. Yet, this information can come from different sources (DT or
    firmware for example), in different formats, hence making it hard to
    exploit without a standard API.

    As an attempt to address this, introduce a centralized Energy Model
    (EM) management framework which aggregates the power values provided
    by drivers into a table for each performance domain in the system. The
    power cost tables are made available to interested clients (e.g. task
    scheduler or thermal) via platform-agnostic APIs. The overall design
    is represented by the diagram below (focused on Arm-related drivers as
    an example, but applicable to any architecture):

    +---------------+ +-----------------+ +-------------+
    | Thermal (IPA) | | Scheduler (EAS) | | Other |
    +---------------+ +-----------------+ +-------------+
    | | em_pd_energy() |
    | | em_cpu_get() |
    +-----------+ | +--------+
    | | |
    v v v
    +---------------------+
    | |
    | Energy Model |
    | |
    | Framework |
    | |
    +---------------------+
    ^ ^ ^
    | | | em_register_perf_domain()
    +----------+ | +---------+
    | | |
    +---------------+ +---------------+ +--------------+
    | cpufreq-dt | | arm_scmi | | Other |
    +---------------+ +---------------+ +--------------+
    ^ ^ ^
    | | |
    +--------------+ +---------------+ +--------------+
    | Device Tree | | Firmware | | ? |
    +--------------+ +---------------+ +--------------+

    Drivers (typically, but not limited to, CPUFreq drivers) can register
    data in the EM framework using the em_register_perf_domain() API. The
    calling driver must provide a callback function with a standardized
    signature that will be used by the EM framework to build the power
    cost tables of the performance domain. This design should offer a lot of
    flexibility to calling drivers which are free of reading information
    from any location and to use any technique to compute power costs.
    Moreover, the capacity states registered by drivers in the EM framework
    are not required to match real performance states of the target. This
    is particularly important on targets where the performance states are
    not known by the OS.

    The power cost coefficients managed by the EM framework are specified in
    milli-watts. Although the two potential users of those coefficients (IPA
    and EAS) only need relative correctness, IPA specifically needs to
    compare the power of CPUs with the power of other components (GPUs, for
    example), which are still expressed in absolute terms in their
    respective subsystems. Hence, specifying the power of CPUs in
    milli-watts should help transitioning IPA to using the EM framework
    without introducing new problems by keeping units comparable across
    sub-systems.
    On the longer term, the EM of other devices than CPUs could also be
    managed by the EM framework, which would enable to remove the absolute
    unit. However, this is not absolutely required as a first step, so this
    extension of the EM framework is left for later.

    On the client side, the EM framework offers APIs to access the power
    cost tables of a CPU (em_cpu_get()), and to estimate the energy
    consumed by the CPUs of a performance domain (em_pd_energy()). Clients
    such as the task scheduler can then use these APIs to access the shared
    data structures holding the Energy Model of CPUs.

    Signed-off-by: Quentin Perret
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Rafael J. Wysocki
    Cc: Thomas Gleixner
    Cc: adharmap@codeaurora.org
    Cc: chris.redpath@arm.com
    Cc: currojerez@riseup.net
    Cc: dietmar.eggemann@arm.com
    Cc: edubezval@gmail.com
    Cc: gregkh@linuxfoundation.org
    Cc: javi.merino@kernel.org
    Cc: joel@joelfernandes.org
    Cc: juri.lelli@redhat.com
    Cc: morten.rasmussen@arm.com
    Cc: patrick.bellasi@arm.com
    Cc: pkondeti@codeaurora.org
    Cc: skannan@codeaurora.org
    Cc: smuckle@google.com
    Cc: srinivas.pandruvada@linux.intel.com
    Cc: thara.gopinath@linaro.org
    Cc: tkjos@google.com
    Cc: valentin.schneider@arm.com
    Cc: vincent.guittot@linaro.org
    Cc: viresh.kumar@linaro.org
    Link: https://lkml.kernel.org/r/20181203095628.11858-4-quentin.perret@arm.com
    Signed-off-by: Ingo Molnar

    Quentin Perret