Re: [PATCH v2 1/5] perf/x86/rapl: move RAPL support to common x86 code

2020-06-04 Thread Stephane Eranian
On Thu, Jun 4, 2020 at 6:11 AM Johannes Hirte
 wrote:
>
> On 2020 Jun 01, Stephane Eranian wrote:
> > On Mon, Jun 1, 2020 at 5:39 AM Johannes Hirte
> >  wrote:
> > >
> > > On 2020 Mai 27, Stephane Eranian wrote:
> > >
> > > ...
> > > > diff --git a/arch/x86/events/Makefile b/arch/x86/events/Makefile
> > > > index 6f1d1fde8b2de..12c42eba77ec3 100644
> > > > --- a/arch/x86/events/Makefile
> > > > +++ b/arch/x86/events/Makefile
> > > > @@ -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/
> > >
> > > With this change, rapl won't be build. Must be:
> > >
> > > obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL)+= rapl.o
> > >
> > Correct. I posted a patch last week to fix that.
> > Thanks.
>
> Yes, it just wasn't in tip when I've tested. Sorry for the noise.
>
It is now. All is good.
Thanks.

>
> --
> Regards,
>   Johannes Hirte
>


Re: [PATCH v2 1/5] perf/x86/rapl: move RAPL support to common x86 code

2020-06-04 Thread Johannes Hirte
On 2020 Jun 01, Stephane Eranian wrote:
> On Mon, Jun 1, 2020 at 5:39 AM Johannes Hirte
>  wrote:
> >
> > On 2020 Mai 27, Stephane Eranian wrote:
> >
> > ...
> > > diff --git a/arch/x86/events/Makefile b/arch/x86/events/Makefile
> > > index 6f1d1fde8b2de..12c42eba77ec3 100644
> > > --- a/arch/x86/events/Makefile
> > > +++ b/arch/x86/events/Makefile
> > > @@ -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/
> >
> > With this change, rapl won't be build. Must be:
> >
> > obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL)+= rapl.o
> >
> Correct. I posted a patch last week to fix that.
> Thanks.

Yes, it just wasn't in tip when I've tested. Sorry for the noise.

-- 
Regards,
  Johannes Hirte



Re: [PATCH v2 1/5] perf/x86/rapl: move RAPL support to common x86 code

2020-06-01 Thread Stephane Eranian
On Mon, Jun 1, 2020 at 5:39 AM Johannes Hirte
 wrote:
>
> On 2020 Mai 27, Stephane Eranian wrote:
>
> ...
> > diff --git a/arch/x86/events/Makefile b/arch/x86/events/Makefile
> > index 6f1d1fde8b2de..12c42eba77ec3 100644
> > --- a/arch/x86/events/Makefile
> > +++ b/arch/x86/events/Makefile
> > @@ -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/
>
> With this change, rapl won't be build. Must be:
>
> obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL)+= rapl.o
>
Correct. I posted a patch last week to fix that.
Thanks.

> --
> Regards,
>   Johannes Hirte
>


Re: [PATCH v2 1/5] perf/x86/rapl: move RAPL support to common x86 code

2020-06-01 Thread Johannes Hirte
On 2020 Mai 27, Stephane Eranian wrote:

...
> diff --git a/arch/x86/events/Makefile b/arch/x86/events/Makefile
> index 6f1d1fde8b2de..12c42eba77ec3 100644
> --- a/arch/x86/events/Makefile
> +++ b/arch/x86/events/Makefile
> @@ -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/

With this change, rapl won't be build. Must be:

obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL)+= rapl.o

-- 
Regards,
  Johannes Hirte



[PATCH v2 1/5] perf/x86/rapl: move RAPL support to common x86 code

2020-05-27 Thread Stephane Eranian
To prepare for support of both Intel and AMD RAPL.

Signed-off-by: Stephane Eranian 
---
 arch/x86/events/Kconfig| 6 +++---
 arch/x86/events/Makefile   | 1 +
 arch/x86/events/intel/Makefile | 2 --
 arch/x86/events/{intel => }/rapl.c | 9 ++---
 4 files changed, 10 insertions(+), 8 deletions(-)
 rename arch/x86/events/{intel => }/rapl.c (98%)

diff --git a/arch/x86/events/Kconfig b/arch/x86/events/Kconfig
index 9a7a1446cb3a0..4a809c6cbd2f5 100644
--- a/arch/x86/events/Kconfig
+++ b/arch/x86/events/Kconfig
@@ -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
diff --git a/arch/x86/events/Makefile b/arch/x86/events/Makefile
index 6f1d1fde8b2de..12c42eba77ec3 100644
--- a/arch/x86/events/Makefile
+++ b/arch/x86/events/Makefile
@@ -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/
diff --git a/arch/x86/events/intel/Makefile b/arch/x86/events/intel/Makefile
index 3468b0c1dc7c9..e67a5886336c1 100644
--- a/arch/x86/events/intel/Makefile
+++ b/arch/x86/events/intel/Makefile
@@ -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
diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/rapl.c
similarity index 98%
rename from arch/x86/events/intel/rapl.c
rename to arch/x86/events/rapl.c
index a5dbd25852cb7..ece043fb7b494 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/rapl.c
@@ -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).
@@ -58,8 +61,8 @@
 #include 
 #include 
 #include 
-#include "../perf_event.h"
-#include "../probe.h"
+#include "perf_event.h"
+#include "probe.h"
 
 MODULE_LICENSE("GPL");
 
-- 
2.27.0.rc0.183.gde8f92d652-goog