Hi, This series of patches introduces the perf implementation of accumulated power reporting algorithm. It will calculate the average power consumption for the processor. The CPU feature flag is CPUID.8000_0007H:EDX[12].
The V7 is rebased on bp/tip-perf. And need two dependent patches at tip because of modular perf driver: http://git.kernel.org/tip/675965b00d734c985e4285f5bec7e524d15fc4e1 http://git.kernel.org/tip/3712bba1a260ad851f3aa8ddea9cb7326f6aa0b3 Changes from v1 -> v2: - Add a patch to fix the build issue which is reported by kbuild test robot. Changes from v2 -> v3: - Use raw_spinlock_t instead of spinlock_t, because it need meet the -rt mode use case. - Use topology_sibling_cpumask to make the cpumask operation easier. Changes from v3 -> v4: - Remove active_list, because it is not iterated. - Capitalize sentences consistently and fix some typos. - Fix some code style issues. - Initialize structures in a vertically aligned manner. - Remove unnecessary comment. - Fix the runtime bug, and do some testing on CPU-hotplug scenario. Changes from v4 -> v5: - Remove "struct pmu" and lock from power_pmu, and rename it to power_pmu_masks - As Peter's suggestion, add a new struct to hw_perf_event, and track these values from per-event. Changes from v5 -> v6: - Remove MAX_CUS check - Remove DEFINE_PER_CPU(struct power_pmu_masks *, amd_power_pmu) - Remove power_cpu_prepare power_cpu_free and refine power_cpu_init and power_cpu_exit - Use smp_num_siblings instead of cores_per_cu variable. - Make this driver as a module. - Add a patch to export events_sysfs_show. Changes from v6 -> v7: - Remove unnecessary cu_num. - Remove unnecessary initialization for target as nr_cpumask_bits. - Refine power_cpu_init interface. - Handle CPU_DOWN_FAILED case. - Remove unnecessary tmp variable. - Re-write the initialization of for_each_online_cpu(cpu) loop. - Move __register_cpu_notifier after perf_pmu_register. Thanks, Rui Huang Rui (2): perf/x86: Export events_sysfs_show() perf/x86/amd/power: Add AMD accumulated power reporting mechanism arch/x86/Kconfig | 9 + arch/x86/kernel/cpu/Makefile | 1 + arch/x86/kernel/cpu/perf_event.c | 1 + arch/x86/kernel/cpu/perf_event_amd_power.c | 353 +++++++++++++++++++++++++++++ include/linux/perf_event.h | 4 + 5 files changed, 368 insertions(+) create mode 100644 arch/x86/kernel/cpu/perf_event_amd_power.c -- 1.9.1