Skip to content

Commit

Permalink
perf/x86/rapl: Move RAPL support to common x86 code
Browse files Browse the repository at this point in the history
To prepare for support of both Intel and AMD RAPL.

As per the AMD PPR, Fam17h support Package RAPL counters to monitor power usage.
The RAPL counter operates as with Intel RAPL, and as such it is beneficial
to share the code.

No change in functionality.

Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200527224659.206129-2-eranian@google.com
  • Loading branch information
Stephane Eranian authored and Ingo Molnar committed May 28, 2020
1 parent 0bffedb commit fd3ae1e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions arch/x86/events/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ config PERF_EVENTS_INTEL_UNCORE
available on NehalemEX and more modern processors.

config PERF_EVENTS_INTEL_RAPL
tristate "Intel rapl performance events"
depends on PERF_EVENTS && CPU_SUP_INTEL && PCI
tristate "Intel/AMD rapl performance events"
depends on PERF_EVENTS && (CPU_SUP_INTEL || CPU_SUP_AMD) && PCI
default y
---help---
Include support for Intel rapl performance events for power
Include support for Intel and AMD rapl performance events for power
monitoring on modern processors.

config PERF_EVENTS_INTEL_CSTATE
Expand Down
1 change: 1 addition & 0 deletions arch/x86/events/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-y += core.o probe.o
obj-$(PERF_EVENTS_INTEL_RAPL) += rapl.o
obj-y += amd/
obj-$(CONFIG_X86_LOCAL_APIC) += msr.o
obj-$(CONFIG_CPU_SUP_INTEL) += intel/
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/events/intel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
obj-$(CONFIG_CPU_SUP_INTEL) += core.o bts.o
obj-$(CONFIG_CPU_SUP_INTEL) += ds.o knc.o
obj-$(CONFIG_CPU_SUP_INTEL) += lbr.o p4.o p6.o pt.o
obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL) += intel-rapl-perf.o
intel-rapl-perf-objs := rapl.o
obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE) += intel-uncore.o
intel-uncore-objs := uncore.o uncore_nhmex.o uncore_snb.o uncore_snbep.o
obj-$(CONFIG_PERF_EVENTS_INTEL_CSTATE) += intel-cstate.o
Expand Down
9 changes: 6 additions & 3 deletions arch/x86/events/intel/rapl.c → arch/x86/events/rapl.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Support Intel RAPL energy consumption counters
* Support Intel/AMD RAPL energy consumption counters
* Copyright (C) 2013 Google, Inc., Stephane Eranian
*
* Intel RAPL interface is specified in the IA-32 Manual Vol3b
* section 14.7.1 (September 2013)
*
* AMD RAPL interface for Fam17h is described in the public PPR:
* https://bugzilla.kernel.org/show_bug.cgi?id=206537
*
* RAPL provides more controls than just reporting energy consumption
* however here we only expose the 3 energy consumption free running
* counters (pp0, pkg, dram).
Expand Down Expand Up @@ -58,8 +61,8 @@
#include <linux/nospec.h>
#include <asm/cpu_device_id.h>
#include <asm/intel-family.h>
#include "../perf_event.h"
#include "../probe.h"
#include "perf_event.h"
#include "probe.h"

MODULE_LICENSE("GPL");

Expand Down

0 comments on commit fd3ae1e

Please sign in to comment.