x86/perf/intel/uncore: Make Intel uncore modular
Subsystems (2)
PATCH v2 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 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
@@ -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 v2 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 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
@@ -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
Re: [PATCH V2 2/2] x86/perf/intel/uncore: Make Intel rapl modular
Quoted 1 line · On Fri, 18 Mar 2016, [email protected] wrote:
+static struct
intel_rapl_init_funknl_rapl_init= {
Same const __initconst issue as in the other patch
Quoted 1 line
static const struct
x86_cpu_idrapl_cpu_match[]__initconst= {
Yep, that one is correct.
Other than the above:
Quoted 6 lines · On Fri, 18 Mar 2016, [email protected] wrote:
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 ofcpu_initandpci_init.
Nice work!
arch/x86/events/intel/uncore.c static int __init uncore_cpumask_init(bool msr) · line 1367
Quoted 5 lines
arch/x86/events/intel/uncore.c +5
-0+static struct intel_uncore_init_fun skl_uncore_init = { + .pci_init = skl_uncore_pci_init, +}; + +static const struct x86_cpu_id intel_uncore_match[] = {
Shouldn't all of these structs be const __initconst?
Other than that:
Quoted 13 lines · On Fri, 18 Mar 2016, [email protected] wrote:
Quoted 7 lines
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 ofcpu_initandpci_init.Nice work!
Quoted 8 lines
arch/x86/events/intel/uncore.c static int __init uncore_cpumask_init(bool msr) · line 1367
Quoted 5 lines
arch/x86/events/intel/uncore.c +5
-0+static struct intel_uncore_init_fun skl_uncore_init = { + .pci_init = skl_uncore_pci_init, +}; + +static const struct x86_cpu_id intel_uncore_match[] = {Shouldn't all of these structs be const
__initconst?
Thanks for the review. I will fix it in next version.
Thanks,
Kan
Quoted 3 lines
Other than that:
Reviewed-by Thomas Gleixner <[email protected]>