x86/perf/intel/uncore: Make Intel uncore modular
Subsystems (2)
PATCH 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 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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 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 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
@@ -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
@@ -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
Peter Zijlstra
maintainerarch/x86/events/intel/uncore.c err: · line 1442
Quoted 3 lines · On Thu, Mar 17, 2016 at 05:34:14AM -0700, [email protected] wrote:
arch/x86/events/intel/uncore.c +3
-0+static void __exit intel_uncore_exit(void) +{ +cpu_notifier_register_done ();
Did you even test this? That should be _begin();
Quoted 9 lines
arch/x86/events/intel/uncore.c +6
-0+__unregister_cpu_notifier (&uncore_cpu_nb); +uncore_types_exit (uncore_msr_uncores); +uncore_pci_exit (); +cpu_notifier_register_done (); +} +module_exit (intel_uncore_exit);Signature · 1 line
2.5.0
Quoted 6 lines · Peter Zijlstra
arch/x86/events/intel/uncore.c err: · line 1442
Quoted 3 lines · On Thu, Mar 17, 2016 at 05:34:14AM -0700, [email protected] wrote:
arch/x86/events/intel/uncore.c +3
-0+static void __exit intel_uncore_exit(void) +{ +cpu_notifier_register_done ();Did you even test this? That should be
_begin();
That's my fault. I had this in my proof of concept patch and it actually works for some reason. By some definition of works: i.e. it does not explode in your face right away....