linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/x86/uncore: update support for client uncore IMC PMU
@ 2014-09-15 14:38 Stephane Eranian
  2014-09-15 15:58 ` Andi Kleen
  2014-09-16  7:00 ` Ingo Molnar
  0 siblings, 2 replies; 5+ messages in thread
From: Stephane Eranian @ 2014-09-15 14:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: peterz, mingo, ak, kan.liang


This patch restructures the memory controller (IMC) uncore
PMU support for client SNB/IVB/HSW processors. The main change
is that it can now cope with more than one PCI device ID per
processor model. There are many flavors of memory controllers
for each processor. They have different PCI device ID, yet
they behave the same w.r.t. the memory controller PMU that
we are interested in.

The patch now supports two distinct memory controllers for IVB
processors: one for mobile, one for desktop.

Signed-off-by: Stephane eranian <eranian@google.com>
---
 arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c |   68 +++++++++++++++------
 include/linux/pci_ids.h                           |    1 +
 2 files changed, 51 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
index e0e934c..70d0887 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
@@ -460,6 +460,10 @@ static const struct pci_device_id ivb_uncore_pci_ids[] = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_IMC),
 		.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
 	},
+	{ /* IMC */
+		PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_E3_IMC),
+		.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
+	},
 	{ /* end: all zeroes */ },
 };
 
@@ -486,34 +490,62 @@ static struct pci_driver hsw_uncore_pci_driver = {
 	.id_table	= hsw_uncore_pci_ids,
 };
 
-int snb_uncore_pci_init(void)
+struct imc_uncore_pci_dev {
+	__u32 pci_id;
+	struct pci_driver *driver;
+};
+#define IMC_DEV(a, d) \
+	{ .pci_id = PCI_DEVICE_ID_INTEL_##a, .driver = (d) }
+
+static const struct imc_uncore_pci_dev desktop_imc_pci_ids[] = {
+	IMC_DEV(SNB_IMC, &snb_uncore_pci_driver),
+	IMC_DEV(IVB_IMC, &ivb_uncore_pci_driver),    /* 3rd Gen Core processor */
+	IMC_DEV(IVB_E3_IMC, &ivb_uncore_pci_driver), /* Xeon E3-1200 v2/3rd Gen Core processor */
+	IMC_DEV(HSW_IMC, &hsw_uncore_pci_driver),    /* 4th Gen Core Processor */
+	{  /* end marker */ }
+};
+
+
+#define for_each_imc_pci_id(x, t) \
+	for (x = (t); (x)->pci_id; x++)
+
+static struct pci_driver *imc_uncore_find_dev(void)
 {
-	int ret = snb_pci2phy_map_init(PCI_DEVICE_ID_INTEL_SNB_IMC);
-	if (ret)
-		return ret;
-	uncore_pci_uncores = snb_pci_uncores;
-	uncore_pci_driver = &snb_uncore_pci_driver;
-	return 0;
+	const struct imc_uncore_pci_dev *p;
+	int ret;
+
+	for_each_imc_pci_id (p, desktop_imc_pci_ids) {
+		ret = snb_pci2phy_map_init(p->pci_id);
+		if (ret == 0)
+			return p->driver;
+	}
+	return NULL;
 }
 
-int ivb_uncore_pci_init(void)
+static int imc_uncore_pci_init(void)
 {
-	int ret = snb_pci2phy_map_init(PCI_DEVICE_ID_INTEL_IVB_IMC);
-	if (ret)
-		return ret;
+	struct pci_driver *imc_drv = imc_uncore_find_dev();
+	if (!imc_drv)
+		return -ENODEV;
+
 	uncore_pci_uncores = snb_pci_uncores;
-	uncore_pci_driver = &ivb_uncore_pci_driver;
+	uncore_pci_driver = imc_drv;
+
 	return 0;
 }
 
+int snb_uncore_pci_init(void)
+{
+	return imc_uncore_pci_init();
+}
+
+int ivb_uncore_pci_init(void)
+{
+	return imc_uncore_pci_init();
+}
 int hsw_uncore_pci_init(void)
 {
-	int ret = snb_pci2phy_map_init(PCI_DEVICE_ID_INTEL_HSW_IMC);
-	if (ret)
-		return ret;
-	uncore_pci_uncores = snb_pci_uncores;
-	uncore_pci_driver = &hsw_uncore_pci_driver;
-	return 0;
+	return imc_uncore_pci_init();
 }
 
 /* end of Sandy Bridge uncore support */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 6ed0bb7..3102b7e 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2536,6 +2536,7 @@
 #define PCI_DEVICE_ID_INTEL_EESSC	0x0008
 #define PCI_DEVICE_ID_INTEL_SNB_IMC	0x0100
 #define PCI_DEVICE_ID_INTEL_IVB_IMC	0x0154
+#define PCI_DEVICE_ID_INTEL_IVB_E3_IMC	0x0150
 #define PCI_DEVICE_ID_INTEL_HSW_IMC	0x0c00
 #define PCI_DEVICE_ID_INTEL_PXHD_0	0x0320
 #define PCI_DEVICE_ID_INTEL_PXHD_1	0x0321
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf/x86/uncore: update support for client uncore IMC PMU
  2014-09-15 14:38 [PATCH] perf/x86/uncore: update support for client uncore IMC PMU Stephane Eranian
@ 2014-09-15 15:58 ` Andi Kleen
  2014-09-15 16:18   ` Stephane Eranian
  2014-09-16  8:51   ` Stephane Eranian
  2014-09-16  7:00 ` Ingo Molnar
  1 sibling, 2 replies; 5+ messages in thread
From: Andi Kleen @ 2014-09-15 15:58 UTC (permalink / raw)
  To: Stephane Eranian; +Cc: linux-kernel, peterz, mingo, kan.liang

On Mon, Sep 15, 2014 at 04:38:32PM +0200, Stephane Eranian wrote:
> 
> This patch restructures the memory controller (IMC) uncore
> PMU support for client SNB/IVB/HSW processors. The main change
> is that it can now cope with more than one PCI device ID per
> processor model. There are many flavors of memory controllers
> for each processor. They have different PCI device ID, yet
> they behave the same w.r.t. the memory controller PMU that
> we are interested in.
> 
> The patch now supports two distinct memory controllers for IVB
> processors: one for mobile, one for desktop.

I haven't investigated yet, but on my Lenovo ULT Haswell laptop
the IMC PCI-ID doesn't exist, so the driver doesn't initialize.

So either it's the BIOS disabling it, or it's a different ID there
too.

BTW any reason you didn't enable the CBOX/ARB PMUs originally for HSW?
At least ARB events are useful for some things.

-Andi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf/x86/uncore: update support for client uncore IMC PMU
  2014-09-15 15:58 ` Andi Kleen
@ 2014-09-15 16:18   ` Stephane Eranian
  2014-09-16  8:51   ` Stephane Eranian
  1 sibling, 0 replies; 5+ messages in thread
From: Stephane Eranian @ 2014-09-15 16:18 UTC (permalink / raw)
  To: Andi Kleen; +Cc: LKML, Peter Zijlstra, mingo, Liang, Kan

On Mon, Sep 15, 2014 at 5:58 PM, Andi Kleen <ak@linux.intel.com> wrote:
>
> On Mon, Sep 15, 2014 at 04:38:32PM +0200, Stephane Eranian wrote:
> >
> > This patch restructures the memory controller (IMC) uncore
> > PMU support for client SNB/IVB/HSW processors. The main change
> > is that it can now cope with more than one PCI device ID per
> > processor model. There are many flavors of memory controllers
> > for each processor. They have different PCI device ID, yet
> > they behave the same w.r.t. the memory controller PMU that
> > we are interested in.
> >
> > The patch now supports two distinct memory controllers for IVB
> > processors: one for mobile, one for desktop.
>
> I haven't investigated yet, but on my Lenovo ULT Haswell laptop
> the IMC PCI-ID doesn't exist, so the driver doesn't initialize.
>
This updates makes it easier to add new PCI-IDs. I don't have all of
them. I don't have all the HW combinations.

>
> So either it's the BIOS disabling it, or it's a different ID there
> too.
>
I bet it is a different ID.
Now, this patch still has a PCI-ID table per-processor and not a global table.
I debated this for a while. But I don't know if a PCI-ID can be used
for something
else on another platform.


>
> BTW any reason you didn't enable the CBOX/ARB PMUs originally for HSW?
> At least ARB events are useful for some things.
>
I have never looked at the ARB events. If they work like on SNB/IVB, then they
should be easy to enable.

>
> -Andi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf/x86/uncore: update support for client uncore IMC PMU
  2014-09-15 14:38 [PATCH] perf/x86/uncore: update support for client uncore IMC PMU Stephane Eranian
  2014-09-15 15:58 ` Andi Kleen
@ 2014-09-16  7:00 ` Ingo Molnar
  1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2014-09-16  7:00 UTC (permalink / raw)
  To: Stephane Eranian; +Cc: linux-kernel, peterz, mingo, ak, kan.liang


* Stephane Eranian <eranian@google.com> wrote:

> 
> This patch restructures the memory controller (IMC) uncore
> PMU support for client SNB/IVB/HSW processors. The main change
> is that it can now cope with more than one PCI device ID per
> processor model. There are many flavors of memory controllers
> for each processor. They have different PCI device ID, yet
> they behave the same w.r.t. the memory controller PMU that
> we are interested in.
> 
> The patch now supports two distinct memory controllers for IVB
> processors: one for mobile, one for desktop.
> 
> Signed-off-by: Stephane eranian <eranian@google.com>
> ---
>  arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c |   68 +++++++++++++++------
>  include/linux/pci_ids.h                           |    1 +
>  2 files changed, 51 insertions(+), 18 deletions(-)

Please run patches through scripts/checkpatch.pl before 
submission, in case it points out legit problems. Checkpatch 
emits 6 warnings for your patch, the first four are bogus, the 
last two are worth addressing:

WARNING: space prohibited between function name and open 
parenthesis '('
#77: FILE: arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c:517:
+       for_each_imc_pci_id (p, desktop_imc_pci_ids) {

WARNING: Missing a blank line after declarations
#92: FILE: arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c:528:
+       struct pci_driver *imc_drv = imc_uncore_find_dev();
+       if (!imc_drv)

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf/x86/uncore: update support for client uncore IMC PMU
  2014-09-15 15:58 ` Andi Kleen
  2014-09-15 16:18   ` Stephane Eranian
@ 2014-09-16  8:51   ` Stephane Eranian
  1 sibling, 0 replies; 5+ messages in thread
From: Stephane Eranian @ 2014-09-16  8:51 UTC (permalink / raw)
  To: Andi Kleen; +Cc: LKML, Peter Zijlstra, mingo, Liang, Kan

On Mon, Sep 15, 2014 at 5:58 PM, Andi Kleen <ak@linux.intel.com> wrote:
>
> On Mon, Sep 15, 2014 at 04:38:32PM +0200, Stephane Eranian wrote:
> >
> > This patch restructures the memory controller (IMC) uncore
> > PMU support for client SNB/IVB/HSW processors. The main change
> > is that it can now cope with more than one PCI device ID per
> > processor model. There are many flavors of memory controllers
> > for each processor. They have different PCI device ID, yet
> > they behave the same w.r.t. the memory controller PMU that
> > we are interested in.
> >
> > The patch now supports two distinct memory controllers for IVB
> > processors: one for mobile, one for desktop.
>
> I haven't investigated yet, but on my Lenovo ULT Haswell laptop
> the IMC PCI-ID doesn't exist, so the driver doesn't initialize.
>
Send me the PCI-ID for this memory controller and I will add it
to V2 of the patch.
Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-16  8:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 14:38 [PATCH] perf/x86/uncore: update support for client uncore IMC PMU Stephane Eranian
2014-09-15 15:58 ` Andi Kleen
2014-09-15 16:18   ` Stephane Eranian
2014-09-16  8:51   ` Stephane Eranian
2014-09-16  7:00 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).