Skip to contentSkip to conversation

x86/perf/intel/uncore: Make Intel uncore modular

PATCH Superseded [email protected] 3 participants 4 messages Mar 19, 2016 – Mar 31, 2016

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 x86/perf/intel/uncore: Make Intel uncore modular

From: Kan Liang <[email protected]>

This patch makes Intel uncore pmu driver modular.
By default, the uncore driver will be built in the kernel. If it is configured as module, the supported cpu model can be auto loaded. This patch also cleans up the code of cpu_init and pci_init.

---

Changes since V2:
- Add const __initconst for all struct intel_uncore_init_fun

Changes since V1:
- should use _begin _done, not _done _done.

Changes since Thomas Gleixner's version
- Move codes to new location
- The module can be autoprobe/load.
- Clean up the code of cpu_init and pci_init.

 arch/x86/Kconfig               |   6 +-
 arch/x86/Kconfig.perf          |  11 +++
 arch/x86/events/Makefile       |   8 +-
 arch/x86/events/intel/Makefile |   6 ++
 arch/x86/events/intel/uncore.c | 216 ++++++++++++++++++++++++-----------------
 5 files changed, 147 insertions(+), 100 deletions(-)
 create mode 100644 arch/x86/Kconfig.perf
 create mode 100644 arch/x86/events/intel/Makefile
arch/x86/Kconfig +2 -4
index 3e61672..eb60e12 100644
@@ -164,10 +164,6 @@ config INSTRUCTION_DECODER
 	def_bool y
 	depends on KPROBES || PERF_EVENTS || UPROBES
 
-config PERF_EVENTS_INTEL_UNCORE
-	def_bool y
-	depends on PERF_EVENTS && CPU_SUP_INTEL && PCI
-
 config OUTPUT_FORMAT
 	string
 	default "elf32-i386" if X86_32
@@ -1046,6 +1042,8 @@ config X86_THERMAL_VECTOR
 	def_bool y
 	depends on X86_MCE_INTEL
 
+source "arch/x86/Kconfig.perf"
+
 config X86_LEGACY_VM86
 	bool "Legacy VM86 support"
 	default n
arch/x86/Kconfig.perf new file +11 -0
new file mode 100644
index 0000000..90b7f58
@@ -0,0 +1,11 @@
+menu "Performance monitoring"
+
+config PERF_EVENTS_INTEL_UNCORE
+	tristate "Intel uncore performance events"
+	depends on PERF_EVENTS && CPU_SUP_INTEL && PCI
+	default y
+	---help---
+	Include support for Intel uncore performance events. These are
+	available on NehalemEX and more modern processors.
+
+endmenu
arch/x86/events/Makefile +2 -6
index fdfea15..57a98b7 100644
@@ -5,9 +5,5 @@ obj-$(CONFIG_X86_LOCAL_APIC)            += amd/ibs.o msr.o
 ifdef CONFIG_AMD_IOMMU
 obj-$(CONFIG_CPU_SUP_AMD)               += amd/iommu.o
 endif
-obj-$(CONFIG_CPU_SUP_INTEL)		+= intel/core.o intel/bts.o intel/cqm.o
-obj-$(CONFIG_CPU_SUP_INTEL)		+= intel/cstate.o intel/ds.o intel/knc.o 
-obj-$(CONFIG_CPU_SUP_INTEL)		+= intel/lbr.o intel/p4.o intel/p6.o intel/pt.o
-obj-$(CONFIG_CPU_SUP_INTEL)		+= intel/rapl.o msr.o
-obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE)	+= intel/uncore.o intel/uncore_nhmex.o
-obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE)	+= intel/uncore_snb.o intel/uncore_snbep.o
+obj-$(CONFIG_CPU_SUP_INTEL)		+= msr.o
+obj-$(CONFIG_CPU_SUP_INTEL)		+= intel/
arch/x86/events/intel/Makefile new file +6 -0
new file mode 100644
index 0000000..a6c7448
@@ -0,0 +1,6 @@
+obj-$(CONFIG_CPU_SUP_INTEL)		+= core.o bts.o cqm.o
+obj-$(CONFIG_CPU_SUP_INTEL)		+= cstate.o ds.o knc.o
+obj-$(CONFIG_CPU_SUP_INTEL)		+= lbr.o p4.o p6.o pt.o
+obj-$(CONFIG_CPU_SUP_INTEL)		+= 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
arch/x86/events/intel/uncore.c +126 -90

285 lines not on this page · raw message

Signature · 1 line
2.5.0
#1 lore raw

PATCH v3 2/2 x86/perf/intel/uncore: Make Intel rapl modular

From: Kan Liang <[email protected]>

This patch makes Intel rapl pmu driver modular.
By default, the rapl driver will be built in the kernel. If it is configured as module, the supported cpu model can be auto loaded. This patch also cleans up the code of rapl_pmu_init.

---

Changes since V2:
- Add const __initconst for all struct intel_rapl_init_fun

Changes since V1:
- should use _begin _done, not _done _done.

Changes since Thomas Gleixner's version
- Move codes to new location
- The module can be autoprobe/load.
- Clean up the code of rapl_pmu_init.

 arch/x86/Kconfig.perf          |   8 +++
 arch/x86/events/intel/Makefile |   3 +-
 arch/x86/events/intel/rapl.c   | 116 ++++++++++++++++++++++++++++-------------
 3 files changed, 89 insertions(+), 38 deletions(-)
arch/x86/Kconfig.perf +8 -0
index 90b7f58..b239ad5 100644
@@ -8,4 +8,12 @@ config PERF_EVENTS_INTEL_UNCORE
 	Include support for Intel uncore performance events. These are
 	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
+	default y
+	---help---
+	Include support for Intel rapl performance events for power
+	monitoring on modern processors.
+
 endmenu
arch/x86/events/intel/Makefile +2 -1
index a6c7448..27adbba 100644
@@ -1,6 +1,7 @@
 obj-$(CONFIG_CPU_SUP_INTEL)		+= core.o bts.o cqm.o
 obj-$(CONFIG_CPU_SUP_INTEL)		+= cstate.o ds.o knc.o
 obj-$(CONFIG_CPU_SUP_INTEL)		+= lbr.o p4.o p6.o pt.o
-obj-$(CONFIG_CPU_SUP_INTEL)		+= rapl.o
+obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL)	+= intel-rapl.o
+intel-rapl-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
arch/x86/events/intel/rapl.c +79 -37

158 lines not on this page · raw message

Signature · 1 line
2.5.0
#2 lore raw

Re: [PATCH V3 2/2] x86/perf/intel/uncore: Make Intel rapl modular

arch/x86/events/intel/rapl.c static int rapl_cpu_notifier(struct notifier_block *self, · line 598

Quoted 3 lines · On Sat, 19 Mar 2016, [email protected] wrote:
arch/x86/events/intel/rapl.c +2 -0
+static struct notifier_block rapl_cpu_nb = {
+	.notifier_call	= rapl_cpu_notifier,

Hmm. Missed that in the first round. That lacks

.priority = CPU_PRI_PERF + 1,

because the driver needs to migrate its stuff away before the core code gets notified about the cpu going down.

Thanks,

tglx

#3 lore raw

[tip:perf/core] x86/perf/intel/rapl: Make the Intel RAPL PMU driver modular

In reply to [email protected]
x86/perf/intel/rapl: Make the Intel RAPL PMU driver modular
Commit-ID:  4b6e2571bf00019e016255ad62b56feb9f498db7
Gitweb:     http://git.kernel.org/tip/4b6e2571bf00019e016255ad62b56feb9f498db7
Author:     Kan Liang <[email protected]>
AuthorDate: Sat, 19 Mar 2016 00:20:50 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 31 Mar 2016 10:30:35 +0200

x86/perf/intel/rapl: Make the Intel RAPL PMU driver modular

By default, the RAPL driver will be built into the kernel. If it is configured as a module, the supported CPU model can be auto loaded.

Also clean up the code of rapl_pmu_init().

---
 arch/x86/Kconfig.perf          |   8 +++
 arch/x86/events/intel/Makefile |   3 +-
 arch/x86/events/intel/rapl.c   | 121 ++++++++++++++++++++++++++++-------------
 3 files changed, 92 insertions(+), 40 deletions(-)
arch/x86/Kconfig.perf +8 -0
index 90b7f58..b239ad5 100644
@@ -8,4 +8,12 @@ config PERF_EVENTS_INTEL_UNCORE
 	Include support for Intel uncore performance events. These are
 	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
+	default y
+	---help---
+	Include support for Intel rapl performance events for power
+	monitoring on modern processors.
+
 endmenu
arch/x86/events/intel/Makefile +2 -1
index a6c7448..27adbba 100644
@@ -1,6 +1,7 @@
 obj-$(CONFIG_CPU_SUP_INTEL)		+= core.o bts.o cqm.o
 obj-$(CONFIG_CPU_SUP_INTEL)		+= cstate.o ds.o knc.o
 obj-$(CONFIG_CPU_SUP_INTEL)		+= lbr.o p4.o p6.o pt.o
-obj-$(CONFIG_CPU_SUP_INTEL)		+= rapl.o
+obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL)	+= intel-rapl.o
+intel-rapl-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
arch/x86/events/intel/rapl.c +82 -39

163 lines not on this page · raw message