linux/drivers/powercap
Zhang Rui 575024a8aa powercap: intel_rapl: Introduce APIs for PMU support
Introduce two new APIs rapl_package_add_pmu()/rapl_package_remove_pmu().

RAPL driver can invoke these APIs to expose its supported energy
counters via perf PMU. The new RAPL PMU is fully compatible with current
MSR RAPL PMU, including using the same PMU name and events
name/id/unit/scale, etc.

For example, use below command
 perf stat -e power/energy-pkg/ -e power/energy-ram/ FOO
to get the energy consumption if power/energy-pkg/ and power/energy-ram/
events are available in the "perf list" output.

This does not introduce any conflict because TPMI RAPL is the only user
of these APIs currently, and it never co-exists with MSR RAPL.

Note that RAPL Packages can be probed/removed dynamically, and the
events supported by each TPMI RAPL device can be different. Thus the
RAPL PMU support is done on demand, which means
1. PMU is registered only if it is needed by a RAPL Package. PMU events
   for unsupported counters are not exposed.
2. PMU is unregistered and registered when a new RAPL Package is probed
   and supports new counters that are not supported by current PMU.
   For example, on a dual-package system using TPMI RAPL, it is possible
   that Package 1 behaves as TPMI domain root and supports Psys domain.
   In this case, register PMU without Psys event when probing Package 0,
   and re-register the PMU with Psys event when probing Package 1.
3. PMU is unregistered when all registered RAPL Packages don't need PMU.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-04-30 21:10:37 +02:00
..
arm_scmi_powercap.c powercap: arm_scmi: Remove recursion while parsing zones 2023-07-20 20:27:10 +02:00
dtpm_cpu.c powercap: DTPM: Avoid explicit cpumask allocation on stack 2024-04-16 13:33:03 +02:00
dtpm_devfreq.c powercap/dtpm_devfreq: Use new Energy Model interface to get table 2024-02-08 15:00:31 +01:00
dtpm_subsys.h powercap/drivers/dtpm: Add dtpm devfreq with energy model support 2022-02-04 17:38:09 +01:00
dtpm.c powercap: dtpm: Fix kernel-doc for dtpm_create_hierarchy() function 2024-03-01 21:39:10 +01:00
idle_inject.c Thermal control updates for 6.3-rc1 2023-02-21 12:32:05 -08:00
intel_rapl_common.c powercap: intel_rapl: Introduce APIs for PMU support 2024-04-30 21:10:37 +02:00
intel_rapl_msr.c powercap: intel_rapl: Convert to platform remove callback returning void 2024-03-13 20:45:54 +01:00
intel_rapl_tpmi.c powercap: intel_rapl_tpmi: Fix System Domain probing 2024-02-13 17:31:48 +01:00
Kconfig powercap: RAPL: Fix CONFIG_IOSF_MBI dependency 2023-06-12 19:48:40 +02:00
Makefile powercap: intel_rapl: Introduce RAPL TPMI interface driver 2023-05-24 18:46:20 +02:00
powercap_sys.c powercap: remove MODULE_LICENSE in non-modules 2023-02-28 21:32:05 +01:00