perf, x86, uncore: Fix section mismatch in split uncore driver
Subsystems (2)
PATCH 1/5 perf, x86, uncore: Fix section mismatch in split uncore driver
From: Andi Kleen <[email protected]>
The new split Intel uncore driver code that recently went into tip added a section mismatch, which the build process complains about.
uncore_pmu_register can be called from uncore_pci_probe, which is not __init and can be called from pci driver ->probe. I'm not fully sure if it's actually possible to call the probe function later, but it seems safer to mark uncore_pmu_register not __init.
This also fixes the warning.
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +1 -1
@@ -661,7 +661,7 @@ static struct attribute_group uncore_pmu_attr_group = { .attrs = uncore_pmu_attrs, }; -static int __init uncore_pmu_register (struct intel_uncore_pmu *pmu) +static int uncore_pmu_register (struct intel_uncore_pmu *pmu) {int ret;
Signature · 1 line
1.9.3
PATCH 2/5 perf, x86, uncore: Add Haswell-EP uncore support
From: "Yan, Zheng" <[email protected]>
The uncore subsystem in Haswell-EP is similar to Sandy/Ivy Bridge-EP. There are some differences in config register encoding and pci device IDs. The Haswell-EP uncore also supports a few new events. Add the Haswell-EP driver to the snbep split driver.
v2: (AK): Add missing break. Add imc events. Add cbox nc/isoc/c6.
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 7 +- arch/x86/kernel/cpu/perf_event_intel_uncore.h | 2 + .../x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 608 ++++++++++++++++++++- 3 files changed, 615 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +6 -1
@@ -883,6 +883,9 @@ static int __init uncore_pci_init(void)case 62 :/* Ivy Bridge-EP */ ret =ivbep_uncore_pci_init ();break ; +case 63 :/* Haswell-EP */ + ret =hswep_uncore_pci_init (); +break ;case 42 :/* Sandy Bridge */ ret =snb_uncore_pci_init ();break ;
@@ -1190,7 +1193,9 @@ static int __init uncore_cpu_init(void)case 62 :/* Ivy Bridge-EP */ ivbep_uncore_cpu_init ();break ; - +case 63 :/* Haswell-EP */ +hswep_uncore_cpu_init (); +break ;default :return 0 ; }
arch/x86/kernel/cpu/perf_event_intel_uncore.h +2 -0
@@ -332,6 +332,8 @@ int snbep_uncore_pci_init(void);void snbep_uncore_cpu_init (void );int ivbep_uncore_pci_init (void );void ivbep_uncore_cpu_init (void ); +int hswep_uncore_pci_init (void ); +void hswep_uncore_cpu_init (void );/* perf_event_intel_uncore_nhmex.c */ void nhmex_uncore_cpu_init (void );
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +607 -1
636 lines not on this page · raw message
Signature · 1 line
1.9.3
tip-bot for Yan, Zheng
merge bot[tip:perf/core] perf/x86/intel/uncore: Add Haswell-EP uncore support
perf/x86/intel/uncore: Add Haswell-EP uncore support
Commit-ID: e735b9db12d76d45f74aee78bd63bbd2f8f480e1 Gitweb: http://git.kernel.org/tip/e735b9db12d76d45f74aee78bd63bbd2f8f480e1 Author: Yan, Zheng <[email protected]> AuthorDate: Thu, 4 Sep 2014 16:08:26 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 24 Sep 2014 14:48:21 +0200
perf/x86/intel/uncore: Add Haswell-EP uncore support
The uncore subsystem in Haswell-EP is similar to Sandy/Ivy Bridge-EP. There are some differences in config register encoding and pci device IDs. The Haswell-EP uncore also supports a few new events. Add the Haswell-EP driver to the snbep split driver.
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 7 +- arch/x86/kernel/cpu/perf_event_intel_uncore.h | 2 + .../x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 608 ++++++++++++++++++++- 3 files changed, 615 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +6 -1
@@ -883,6 +883,9 @@ static int __init uncore_pci_init(void)case 62 :/* Ivy Bridge-EP */ ret =ivbep_uncore_pci_init ();break ; +case 63 :/* Haswell-EP */ + ret =hswep_uncore_pci_init (); +break ;case 42 :/* Sandy Bridge */ ret =snb_uncore_pci_init ();break ;
@@ -1190,7 +1193,9 @@ static int __init uncore_cpu_init(void)case 62 :/* Ivy Bridge-EP */ ivbep_uncore_cpu_init ();break ; - +case 63 :/* Haswell-EP */ +hswep_uncore_cpu_init (); +break ;default :return 0 ; }
arch/x86/kernel/cpu/perf_event_intel_uncore.h +2 -0
@@ -332,6 +332,8 @@ int snbep_uncore_pci_init(void);void snbep_uncore_cpu_init (void );int ivbep_uncore_pci_init (void );void ivbep_uncore_cpu_init (void ); +int hswep_uncore_pci_init (void ); +void hswep_uncore_cpu_init (void );/* perf_event_intel_uncore_nhmex.c */ void nhmex_uncore_cpu_init (void );
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +607 -1
636 lines not on this page · raw message
Re: [PATCH 2/5] perf, x86, uncore: Add Haswell-EP uncore support
In reply to Andi KleenQuoted 22 lines · Andi Kleen
From: "Yan, Zheng" <[email protected]>
The uncore subsystem in Haswell-EP is similar to Sandy/Ivy Bridge-EP. There are some differences in config register encoding and pci device IDs. The Haswell-EP uncore also supports a few new events. Add the Haswell-EP driver to the snbep split driver.
v2: (AK): Add missing break. Add imc events. Add cbox nc/isoc/c6.
Signed-off-by Yan, Zheng <[email protected]>Signed-off-by Andi Kleen <[email protected]>--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 7 +- arch/x86/kernel/cpu/perf_event_intel_uncore.h | 2 + .../x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 608 ++++++++++++++++++++- 3 files changed, 615 insertions(+), 2 deletions(-)arch/x86/kernel/cpu/perf_event_intel_uncore.c +0
-0
arch/x86/kernel/cpu/perf_event_intel_uncore.c static int __init uncore_pci_init(void) · line 888
Quoted 6 lines
arch/x86/kernel/cpu/perf_event_intel_uncore.c +3
-0@@ -883,6 +883,9 @@ static int __init uncore_pci_init(void)case 62 :/* Ivy Bridge-EP */ ret =ivbep_uncore_pci_init ();break ; +case 63 :/* Haswell-EP */ + ret =hswep_uncore_pci_init (); +break ;
my E5-1630 v3 crashes hard during boot in snbep_uncore_msr_init_box()+0x3c
I don't have a setup to capture the screen so early in the boot. So this is just heads up.
I replaced the call above with 'return -ENODEV' as a workaround. btw, E5-16xx v3 became available just a month ago.
Re: [PATCH 2/5] perf, x86, uncore: Add Haswell-EP uncore support
Quoted 5 lines · Alexei Starovoitov
my E5-1630 v3 crashes hard during boot in
snbep_uncore_msr_init_box()+0x3cI don't have a setup to capture the screen so early in the boot. So this is just heads up.
Is it a general general protection fault or a page fault?
If it's a page fault please post the disassembled code:
gdb vmlinux
disassemble snbep_uncore_msr_init_box
Quoted 2 lines
I replaced the call above with 'return
-ENODEV' as a workaround. btw, E5-16xx v3 became available just a month ago.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only
PATCH 3/5 perf, x86, uncore: Register the PMU only if the uncore pci device exists
In reply to Andi KleenFrom: "Yan, Zheng" <[email protected]>
Current code registers PMUs for all possible uncore pci devices. This is not good because, on some machines, one or more uncore pci devices can be missing. The missing pci device make corresponding PMU unusable. Register the PMU only if the uncore device exists.
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +11 -8
@@ -793,6 +793,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *idstruct intel_uncore_box *box;struct intel_uncore_type *type;int phys_id; +bool first_box = false; phys_id = uncore_pcibus_to_physid[pdev->bus->number];if (phys_id <0 )
@@ -827,9 +828,13 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *idpci_set_drvdata (pdev, box);raw_spin_lock (&uncore_box_lock); +if (list_empty (&pmu->box_list)) + first_box = true;list_add_tail (&box->list, &pmu->box_list);raw_spin_unlock (&uncore_box_lock); +if (first_box) +uncore_pmu_register (pmu);return 0 ; }
@@ -838,6 +843,7 @@ static void uncore_pci_remove(struct pci_dev *pdev)struct intel_uncore_box *box =pci_get_drvdata (pdev);struct intel_uncore_pmu *pmu;int i, cpu, phys_id = uncore_pcibus_to_physid[pdev->bus->number]; +bool last_box = false; box =pci_get_drvdata (pdev);if (!box) {
@@ -859,6 +865,8 @@ static void uncore_pci_remove(struct pci_dev *pdev)raw_spin_lock (&uncore_box_lock);list_del (&box->list); +if (list_empty (&pmu->box_list)) + last_box = true;raw_spin_unlock (&uncore_box_lock);for_each_possible_cpu (cpu) {
@@ -870,6 +878,9 @@ static void uncore_pci_remove(struct pci_dev *pdev)WARN_ON_ONCE (atomic_read (&box->refcnt) !=1 );kfree (box); + +if (last_box) +perf_pmu_unregister (&pmu->pmu); }static int __init uncore_pci_init (void )
@@ -1221,14 +1232,6 @@ static int __init uncore_pmus_register(void) } } -for (i =0 ; uncore_pci_uncores[i]; i++) { - type = uncore_pci_uncores[i]; -for (j =0 ; j < type->num_boxes; j++) { - pmu = &type->pmus[j]; -uncore_pmu_register (pmu); - } - } -return 0 ; }
Signature · 1 line
1.9.3
tip-bot for Yan, Zheng
merge bot[tip:perf/core] perf/x86/intel/uncore: Register the PMU only if the uncore pci device exists
perf/x86/intel/uncore: Register the PMU only if the uncore pci device exists
Commit-ID: 513d793e5fe138d779ad6c532cd20c289a6897fc Gitweb: http://git.kernel.org/tip/513d793e5fe138d779ad6c532cd20c289a6897fc Author: Yan, Zheng <[email protected]> AuthorDate: Thu, 4 Sep 2014 16:08:27 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 24 Sep 2014 14:48:22 +0200
perf/x86/intel/uncore: Register the PMU only if the uncore pci device exists
Current code registers PMUs for all possible uncore pci devices. This is not good because, on some machines, one or more uncore pci devices can be missing. The missing pci device make corresponding PMU unusable. Register the PMU only if the uncore device exists.
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +11 -8
@@ -793,6 +793,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *idstruct intel_uncore_box *box;struct intel_uncore_type *type;int phys_id; +bool first_box = false; phys_id = uncore_pcibus_to_physid[pdev->bus->number];if (phys_id <0 )
@@ -827,9 +828,13 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *idpci_set_drvdata (pdev, box);raw_spin_lock (&uncore_box_lock); +if (list_empty (&pmu->box_list)) + first_box = true;list_add_tail (&box->list, &pmu->box_list);raw_spin_unlock (&uncore_box_lock); +if (first_box) +uncore_pmu_register (pmu);return 0 ; }
@@ -838,6 +843,7 @@ static void uncore_pci_remove(struct pci_dev *pdev)struct intel_uncore_box *box =pci_get_drvdata (pdev);struct intel_uncore_pmu *pmu;int i, cpu, phys_id = uncore_pcibus_to_physid[pdev->bus->number]; +bool last_box = false; box =pci_get_drvdata (pdev);if (!box) {
@@ -859,6 +865,8 @@ static void uncore_pci_remove(struct pci_dev *pdev)raw_spin_lock (&uncore_box_lock);list_del (&box->list); +if (list_empty (&pmu->box_list)) + last_box = true;raw_spin_unlock (&uncore_box_lock);for_each_possible_cpu (cpu) {
@@ -870,6 +878,9 @@ static void uncore_pci_remove(struct pci_dev *pdev)WARN_ON_ONCE (atomic_read (&box->refcnt) !=1 );kfree (box); + +if (last_box) +perf_pmu_unregister (&pmu->pmu); }static int __init uncore_pci_init (void )
@@ -1221,14 +1232,6 @@ static int __init uncore_pmus_register(void) } } -for (i =0 ; uncore_pci_uncores[i]; i++) { - type = uncore_pci_uncores[i]; -for (j =0 ; j < type->num_boxes; j++) { - pmu = &type->pmus[j]; -uncore_pmu_register (pmu); - } - } -return 0 ; }
PATCH 4/5 perf, x86, uncore: Add missing cbox filter flags on IvyBridge-EP uncore driver
In reply to Andi KleenFrom: Andi Kleen <[email protected]>
The IvyBridge-EP uncore driver was missing three filter flags:
NC, ISOC, C6 which are useful in some cases. Support them in the same way as the Haswell EP driver, by allowing to set them and exposing them in the sysfs formats.
Also fix a typo in a define.
Relies on the Haswell EP driver to be applied earlier.
--- arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +9 -2
@@ -139,7 +139,7 @@#define IVBEP_CB0_MSR_PMON_BOX_FILTER_OPC (0x1ffULL << 52)#define IVBEP_CB0_MSR_PMON_BOX_FILTER_C6 (0x1ULL << 61)#define IVBEP_CB0_MSR_PMON_BOX_FILTER_NC (0x1ULL << 62) -#define IVBEP_CB0_MSR_PMON_BOX_FILTER_IOSC (0x1ULL << 63) +#define IVBEP_CB0_MSR_PMON_BOX_FILTER_ISOC (0x1ULL << 63)/* IVBEP home agent */ #define IVBEP_HA_PCI_PMON_CTL_Q_OCC_RST (1 << 16)
@@ -1214,6 +1214,9 @@ static struct attribute *ivbep_uncore_cbox_formats_attr[] = { &format_attr_filter_state2.attr, &format_attr_filter_nid2.attr, &format_attr_filter_opc2.attr, + &format_attr_filter_nc.attr, + &format_attr_filter_c6.attr, + &format_attr_filter_isoc.attr, NULL, };
@@ -1350,8 +1353,12 @@ static u64 ivbep_cbox_filter_mask(int fields) mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_STATE ;if (fields &0x8 ) mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_NID ; -if (fields &0x10 ) +if (fields &0x10 ) { mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_OPC ; + mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_NC ; + mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_C6 ; + mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_ISOC ; + }return mask; }
Signature · 1 line
1.9.3
tip-bot for Andi Kleen
merge bot[tip:perf/core] perf/x86/intel/uncore: Add missing cbox filter flags on IvyBridge-EP uncore driver
perf/x86/intel/uncore: Add missing cbox filter flags on IvyBridge-EP uncore driver
Commit-ID: 7e96ae1a8915e7064091ab75857f8c63334ea28d Gitweb: http://git.kernel.org/tip/7e96ae1a8915e7064091ab75857f8c63334ea28d Author: Andi Kleen <[email protected]> AuthorDate: Thu, 4 Sep 2014 16:08:28 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 24 Sep 2014 14:48:23 +0200
perf/x86/intel/uncore: Add missing cbox filter flags on IvyBridge-EP uncore driver
The IvyBridge-EP uncore driver was missing three filter flags:
NC, ISOC, C6 which are useful in some cases. Support them in the same way as the Haswell EP driver, by allowing to set them and exposing them in the sysfs formats.
Also fix a typo in a define.
Relies on the Haswell EP driver to be applied earlier.
--- arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +9 -2
@@ -139,7 +139,7 @@#define IVBEP_CB0_MSR_PMON_BOX_FILTER_OPC (0x1ffULL << 52)#define IVBEP_CB0_MSR_PMON_BOX_FILTER_C6 (0x1ULL << 61)#define IVBEP_CB0_MSR_PMON_BOX_FILTER_NC (0x1ULL << 62) -#define IVBEP_CB0_MSR_PMON_BOX_FILTER_IOSC (0x1ULL << 63) +#define IVBEP_CB0_MSR_PMON_BOX_FILTER_ISOC (0x1ULL << 63)/* IVBEP home agent */ #define IVBEP_HA_PCI_PMON_CTL_Q_OCC_RST (1 << 16)
@@ -1214,6 +1214,9 @@ static struct attribute *ivbep_uncore_cbox_formats_attr[] = { &format_attr_filter_state2.attr, &format_attr_filter_nid2.attr, &format_attr_filter_opc2.attr, + &format_attr_filter_nc.attr, + &format_attr_filter_c6.attr, + &format_attr_filter_isoc.attr, NULL, };
@@ -1350,8 +1353,12 @@ static u64 ivbep_cbox_filter_mask(int fields) mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_STATE ;if (fields &0x8 ) mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_NID ; -if (fields &0x10 ) +if (fields &0x10 ) { mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_OPC ; + mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_NC ; + mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_C6 ; + mask |=IVBEP_CB0_MSR_PMON_BOX_FILTER_ISOC ; + }return mask; }
PATCH 5/5 perf, x86, uncore: Fix PCU filter setup for Sandy/Ivy/Haswell EP
In reply to Andi KleenFrom: Andi Kleen <[email protected]>
The PCU frequency band filters use 8 bit each in a register. When setting up the value the shift value was not correctly scaled, which resulted in all filters except for band 0 to be zero. Fix the scaling.
This allows to correctly monitor multiple uncore frequency bands.
--- arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +1 -1
@@ -841,7 +841,7 @@ static int snbep_pcu_hw_config(struct intel_uncore_box *box, struct perf_event *if (ev_sel >=0xb && ev_sel <=0xe ) { reg1->reg =SNBEP_PCU_MSR_PMON_BOX_FILTER ; reg1->idx = ev_sel -0xb ; - reg1->config = event->attr.config1 & (0xff << reg1->idx); + reg1->config = event->attr.config1 & (0xff << (reg1->idx *8 )); }return 0 ; }
Signature · 1 line
1.9.3
tip-bot for Andi Kleen
merge bot[tip:perf/core] perf/x86/intel/uncore: Fix PCU filter setup for Sandy/Ivy/Haswell EP
perf/x86/intel/uncore: Fix PCU filter setup for Sandy/Ivy/Haswell EP
Commit-ID: b10fc1c3e30c44033d1cb1d2900cc2ab06dff342 Gitweb: http://git.kernel.org/tip/b10fc1c3e30c44033d1cb1d2900cc2ab06dff342 Author: Andi Kleen <[email protected]> AuthorDate: Thu, 4 Sep 2014 16:08:29 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 24 Sep 2014 14:48:24 +0200
perf/x86/intel/uncore: Fix PCU filter setup for Sandy/Ivy/Haswell EP
The PCU frequency band filters use 8 bit each in a register. When setting up the value the shift value was not correctly scaled, which resulted in all filters except for band 0 to be zero. Fix the scaling.
This allows to correctly monitor multiple uncore frequency bands.
--- arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +1 -1
@@ -841,7 +841,7 @@ static int snbep_pcu_hw_config(struct intel_uncore_box *box, struct perf_event *if (ev_sel >=0xb && ev_sel <=0xe ) { reg1->reg =SNBEP_PCU_MSR_PMON_BOX_FILTER ; reg1->idx = ev_sel -0xb ; - reg1->config = event->attr.config1 & (0xff << reg1->idx); + reg1->config = event->attr.config1 & (0xff << (reg1->idx *8 )); }return 0 ; }
Peter Zijlstra
maintainerThanks Andi