linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
@ 2016-11-30 10:51 Jiri Olsa
  2016-11-30 14:45 ` Liang, Kan
  2016-11-30 15:27 ` Liang, Kan
  0 siblings, 2 replies; 11+ messages in thread
From: Jiri Olsa @ 2016-11-30 10:51 UTC (permalink / raw)
  To: Liang, Kan
  Cc: Andi Kleen, Peter Zijlstra, Jiri Olsa, lkml, Ingo Molnar, Michael Petlan

hi,
I'm trying to find out some documentation background for this part of uncore code:

---
static int uncore_pmu_event_init(struct perf_event *event)
{
        ...
        if (event->attr.config == UNCORE_FIXED_EVENT) {
                /* no fixed counter */
                if (!pmu->type->fixed_ctl)
                        return -EINVAL;
                /*
                 * if there is only one fixed counter, only the first pmu
                 * can access the fixed counter
                 */
                if (pmu->type->single_fixed && pmu->pmu_idx > 0)
                        return -EINVAL;
        ...
---

that for some uncore types (those with pmu->type->single_fixed) only
the first pmu (code_id == 0) will allow to touch the clocktick event

other cores boxes will not allow to open clocktick event, eventhough
it's announced via /sys/../events/.. 

I'm probably missing some HW logic of specific boxes that would explain
that, but I can't find it.

thanks for info,
jirka

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

* RE: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-11-30 10:51 [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question Jiri Olsa
@ 2016-11-30 14:45 ` Liang, Kan
  2016-11-30 17:52   ` Andi Kleen
  2016-11-30 15:27 ` Liang, Kan
  1 sibling, 1 reply; 11+ messages in thread
From: Liang, Kan @ 2016-11-30 14:45 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Andi Kleen, Peter Zijlstra, Jiri Olsa, lkml, Ingo Molnar, Michael Petlan



> hi,
> I'm trying to find out some documentation background for this part of
> uncore code:
> 
> ---
> static int uncore_pmu_event_init(struct perf_event *event) {
>         ...
>         if (event->attr.config == UNCORE_FIXED_EVENT) {
>                 /* no fixed counter */
>                 if (!pmu->type->fixed_ctl)
>                         return -EINVAL;
>                 /*
>                  * if there is only one fixed counter, only the first pmu
>                  * can access the fixed counter
>                  */
>                 if (pmu->type->single_fixed && pmu->pmu_idx > 0)
>                         return -EINVAL;
>         ...
> ---
> 
> that for some uncore types (those with pmu->type->single_fixed) only the
> first pmu (code_id == 0) will allow to touch the clocktick event
> 
> other cores boxes will not allow to open clocktick event, eventhough it's
> announced via /sys/../events/..
> 
> I'm probably missing some HW logic of specific boxes that would explain
> that, but I can't find it.

The client uncore has a standalone clocktick fixed counter. It doesn't belong
to any boxes, which is different from server uncore. 

But client and server uncore share the same uncore_pmu_event_init.
So it forces that only the first box can access the fixed counter.

Maybe we should create a clocktick box for client uncore to fix it. 

You can find the fixed counter information from 18.11.6 in latest
SDM (Order Number: 325384-060US).

There should be a Skylake client uncore document published somewhere.
But I cannot find it from Google. Let me ask around.

Thanks,
Kan

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

* RE: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-11-30 10:51 [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question Jiri Olsa
  2016-11-30 14:45 ` Liang, Kan
@ 2016-11-30 15:27 ` Liang, Kan
  2016-11-30 15:38   ` Jiri Olsa
  1 sibling, 1 reply; 11+ messages in thread
From: Liang, Kan @ 2016-11-30 15:27 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Andi Kleen, Peter Zijlstra, Jiri Olsa, lkml, Ingo Molnar, Michael Petlan


> 
> > hi,
> > I'm trying to find out some documentation background for this part of
> > uncore code:
> >
> > ---
> > static int uncore_pmu_event_init(struct perf_event *event) {
> >         ...
> >         if (event->attr.config == UNCORE_FIXED_EVENT) {
> >                 /* no fixed counter */
> >                 if (!pmu->type->fixed_ctl)
> >                         return -EINVAL;
> >                 /*
> >                  * if there is only one fixed counter, only the first pmu
> >                  * can access the fixed counter
> >                  */
> >                 if (pmu->type->single_fixed && pmu->pmu_idx > 0)
> >                         return -EINVAL;
> >         ...
> > ---
> >
> > that for some uncore types (those with pmu->type->single_fixed) only
> > the first pmu (code_id == 0) will allow to touch the clocktick event
> >
> > other cores boxes will not allow to open clocktick event, eventhough
> > it's announced via /sys/../events/..
> >
> > I'm probably missing some HW logic of specific boxes that would
> > explain that, but I can't find it.
> 
> The client uncore has a standalone clocktick fixed counter. It doesn't belong
> to any boxes, which is different from server uncore.
> 
> But client and server uncore share the same uncore_pmu_event_init.
> So it forces that only the first box can access the fixed counter.
> 
> Maybe we should create a clocktick box for client uncore to fix it.
> 
> You can find the fixed counter information from 18.11.6 in latest SDM
> (Order Number: 325384-060US).
> 
> There should be a Skylake client uncore document published somewhere.
> But I cannot find it from Google. Let me ask around.

Here is the published document.
http://www.intel.com/content/www/us/en/processors/core/6th-gen-core-family-uncore-performance-monitoring-manual.html



> 
> Thanks,
> Kan

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

* Re: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-11-30 15:27 ` Liang, Kan
@ 2016-11-30 15:38   ` Jiri Olsa
  0 siblings, 0 replies; 11+ messages in thread
From: Jiri Olsa @ 2016-11-30 15:38 UTC (permalink / raw)
  To: Liang, Kan
  Cc: Andi Kleen, Peter Zijlstra, Jiri Olsa, lkml, Ingo Molnar, Michael Petlan

On Wed, Nov 30, 2016 at 03:27:52PM +0000, Liang, Kan wrote:
> 
> > 
> > > hi,
> > > I'm trying to find out some documentation background for this part of
> > > uncore code:
> > >
> > > ---
> > > static int uncore_pmu_event_init(struct perf_event *event) {
> > >         ...
> > >         if (event->attr.config == UNCORE_FIXED_EVENT) {
> > >                 /* no fixed counter */
> > >                 if (!pmu->type->fixed_ctl)
> > >                         return -EINVAL;
> > >                 /*
> > >                  * if there is only one fixed counter, only the first pmu
> > >                  * can access the fixed counter
> > >                  */
> > >                 if (pmu->type->single_fixed && pmu->pmu_idx > 0)
> > >                         return -EINVAL;
> > >         ...
> > > ---
> > >
> > > that for some uncore types (those with pmu->type->single_fixed) only
> > > the first pmu (code_id == 0) will allow to touch the clocktick event
> > >
> > > other cores boxes will not allow to open clocktick event, eventhough
> > > it's announced via /sys/../events/..
> > >
> > > I'm probably missing some HW logic of specific boxes that would
> > > explain that, but I can't find it.
> > 
> > The client uncore has a standalone clocktick fixed counter. It doesn't belong
> > to any boxes, which is different from server uncore.
> > 
> > But client and server uncore share the same uncore_pmu_event_init.
> > So it forces that only the first box can access the fixed counter.
> > 
> > Maybe we should create a clocktick box for client uncore to fix it.
> > 
> > You can find the fixed counter information from 18.11.6 in latest SDM
> > (Order Number: 325384-060US).
> > 
> > There should be a Skylake client uncore document published somewhere.
> > But I cannot find it from Google. Let me ask around.
> 
> Here is the published document.
> http://www.intel.com/content/www/us/en/processors/core/6th-gen-core-family-uncore-performance-monitoring-manual.html
> 

will check, thanks a lot!

jirka

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

* Re: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-11-30 14:45 ` Liang, Kan
@ 2016-11-30 17:52   ` Andi Kleen
  2016-12-01 16:34     ` Liang, Kan
  0 siblings, 1 reply; 11+ messages in thread
From: Andi Kleen @ 2016-11-30 17:52 UTC (permalink / raw)
  To: Liang, Kan
  Cc: Jiri Olsa, Peter Zijlstra, Jiri Olsa, lkml, Ingo Molnar, Michael Petlan

"Liang, Kan" <kan.liang@intel.com> writes:
>
> Maybe we should create a clocktick box for client uncore to fix it.

That would break all the user space code that uses the existing format.

-Andi

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

* RE: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-11-30 17:52   ` Andi Kleen
@ 2016-12-01 16:34     ` Liang, Kan
  2016-12-01 16:37       ` Peter Zijlstra
  0 siblings, 1 reply; 11+ messages in thread
From: Liang, Kan @ 2016-12-01 16:34 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Jiri Olsa, Peter Zijlstra, Jiri Olsa, lkml, Ingo Molnar, Michael Petlan


> 
> "Liang, Kan" <kan.liang@intel.com> writes:
> >
> > Maybe we should create a clocktick box for client uncore to fix it.
> 
> That would break all the user space code that uses the existing format.
> 
OK.
If so, I think we should remove the non-exist events for non-first boxes.

What do you think about the patch as below?

Andi? Jirka?

------
>From 844c12b5e6fc1e2c27b2f094c89098ea9405ea41 Mon Sep 17 00:00:00 2001
From: Kan Liang <kan.liang@intel.com>
Date: Thu, 1 Dec 2016 03:29:29 -0500
Subject: [PATCH] perf/x86/intel/uncore: remove non-exist clockticks events

For client cbox, only the first box can access the clockticks event.
Other cboxes will not allow to open clocktick event, eventhough it's
announced via /sys/../events/..

The client uncore has a standalone clocktick fixed counter. It doesn't
belong to any boxes, which is different from server uncore. To make the
code compatible, the client forces that only the first box can access
the fixed counter.

The clocktick event should be removed from other boxes.
Currently, all the pmus of same type share the same attr_groups, which
include all the events.
no_fixed_attr_groups is introduced for other boxes, which remove the
non-exist events.

Signed-off-by: Kan Liang <kan.liang@intel.com>
---
 arch/x86/events/intel/uncore.c | 70 ++++++++++++++++++++++++++++++++----------
 arch/x86/events/intel/uncore.h |  1 +
 2 files changed, 55 insertions(+), 16 deletions(-)

diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index dbaaf7dc..6d3606e 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -739,6 +739,9 @@ static int uncore_pmu_register(struct intel_uncore_pmu *pmu)
 		pmu->pmu.attr_groups = pmu->type->attr_groups;
 	}
 
+	if (pmu->type->single_fixed && pmu->pmu_idx)
+		pmu->pmu.attr_groups = pmu->type->no_fixed_attr_groups;
+
 	if (pmu->type->num_boxes == 1) {
 		if (strlen(pmu->type->name) > 0)
 			sprintf(pmu->name, "uncore_%s", pmu->type->name);
@@ -811,6 +814,8 @@ static void uncore_type_exit(struct intel_uncore_type *type)
 	}
 	kfree(type->events_group);
 	type->events_group = NULL;
+	kfree(type->no_fixed_attr_groups[2]);
+	type->no_fixed_attr_groups[2] = NULL;
 }
 
 static void uncore_types_exit(struct intel_uncore_type **types)
@@ -819,13 +824,45 @@ static void uncore_types_exit(struct intel_uncore_type **types)
 		uncore_type_exit(*types);
 }
 
-static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
+static struct attribute_group *
+uncore_alloc_event_group(struct intel_uncore_type *type,
+			 bool single_fixed)
 {
-	struct intel_uncore_pmu *pmus;
 	struct attribute_group *attr_group;
 	struct attribute **attrs;
+	char fixed_event_name[11];
+	int i, j, index = 0;
+
+	if (single_fixed)
+		snprintf(fixed_event_name, 11, "event=0x%x", UNCORE_FIXED_EVENT);
+
+	for (i = 0; type->event_descs[i].attr.attr.name; i++)
+		;
+
+	attr_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
+				sizeof(*attr_group), GFP_KERNEL);
+	if (!attr_group)
+		return NULL;
+
+	attrs = (struct attribute **)(attr_group + 1);
+	attr_group->name = "events";
+	attr_group->attrs = attrs;
+
+	for (j = 0; j < i; j++) {
+		if (single_fixed && !strncmp(type->event_descs[j].config, fixed_event_name, 10))
+			continue;
+
+		attrs[index++] = &type->event_descs[j].attr.attr;
+	}
+
+	return attr_group;
+}
+
+static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
+{
+	struct intel_uncore_pmu *pmus;
 	size_t size;
-	int i, j;
+	int i;
 
 	pmus = kzalloc(sizeof(*pmus) * type->num_boxes, GFP_KERNEL);
 	if (!pmus)
@@ -848,24 +885,25 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
 				0, type->num_counters, 0, 0);
 
 	if (type->event_descs) {
-		for (i = 0; type->event_descs[i].attr.attr.name; i++);
-
-		attr_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
-					sizeof(*attr_group), GFP_KERNEL);
-		if (!attr_group)
+		type->events_group = uncore_alloc_event_group(type, false);
+		if (!type->events_group)
 			return -ENOMEM;
+		if (type->single_fixed) {
+			type->no_fixed_attr_groups[2] = uncore_alloc_event_group(type, true);
+			if (!type->no_fixed_attr_groups[2]) {
+				kfree(type->events_group);
+				return -ENOMEM;
+			}
+		}
+	}
 
-		attrs = (struct attribute **)(attr_group + 1);
-		attr_group->name = "events";
-		attr_group->attrs = attrs;
-
-		for (j = 0; j < i; j++)
-			attrs[j] = &type->event_descs[j].attr.attr;
+	type->pmu_group = &uncore_pmu_attr_group;
 
-		type->events_group = attr_group;
+	if (type->single_fixed) {
+		type->no_fixed_attr_groups[0] = type->pmu_group;
+		type->no_fixed_attr_groups[1] = type->format_group;
 	}
 
-	type->pmu_group = &uncore_pmu_attr_group;
 	return 0;
 }
 
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
index ad986c1..23bf3ff 100644
--- a/arch/x86/events/intel/uncore.h
+++ b/arch/x86/events/intel/uncore.h
@@ -59,6 +59,7 @@ struct intel_uncore_type {
 	struct intel_uncore_ops *ops;
 	struct uncore_event_desc *event_descs;
 	const struct attribute_group *attr_groups[4];
+	const struct attribute_group *no_fixed_attr_groups[4];
 	struct pmu *pmu; /* for custom pmu ops */
 };
 
-- 
2.5.5

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

* Re: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-12-01 16:34     ` Liang, Kan
@ 2016-12-01 16:37       ` Peter Zijlstra
  2016-12-12 14:49         ` Liang, Kan
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Zijlstra @ 2016-12-01 16:37 UTC (permalink / raw)
  To: Liang, Kan
  Cc: Andi Kleen, Jiri Olsa, Jiri Olsa, lkml, Ingo Molnar, Michael Petlan

On Thu, Dec 01, 2016 at 04:34:43PM +0000, Liang, Kan wrote:
> 
> > 
> > "Liang, Kan" <kan.liang@intel.com> writes:
> > >
> > > Maybe we should create a clocktick box for client uncore to fix it.
> > 
> > That would break all the user space code that uses the existing format.
> > 
> OK.
> If so, I think we should remove the non-exist events for non-first boxes.
> 
> What do you think about the patch as below?
> 
> Andi? Jirka?

Urgh, more lines for ugly :-(

I really would prefer to move the thing to its own PMU.

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

* RE: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-12-01 16:37       ` Peter Zijlstra
@ 2016-12-12 14:49         ` Liang, Kan
  2016-12-14 11:33           ` Jiri Olsa
  0 siblings, 1 reply; 11+ messages in thread
From: Liang, Kan @ 2016-12-12 14:49 UTC (permalink / raw)
  To: Peter Zijlstra, Jiri Olsa (jolsa@kernel.org),
	Jiri Olsa (jolsa@redhat.com)
  Cc: Andi Kleen, lkml, Ingo Molnar, Michael Petlan



> I really would prefer to move the thing to its own PMU.

The patch as below creates a new PMU to fix the issue.

Jirka, could you please try the patch on your machine?


Thanks,
Kan
-------
>From 2de8b2eda6b54734e08a608b5fc8c367b94369d3 Mon Sep 17 00:00:00 2001
From: Kan Liang <kan.liang@intel.com>
Date: Mon, 12 Dec 2016 09:03:35 -0500
Subject: [PATCH] perf/x86/intel/uncore: fix nonexistent clockticks event for
 client uncore

The clockticks event can only be used by the first Cbox pmu. Other
Cboxes don't allow to open clockticks event, eventhough it's announced
via /sys/../events/..

For client uncore, there is only one clocktick fixed counter. Current
kernel code forces that only the first box can access the fixed counter
in uncore_pmu_event_init. But it doesn't take care of the the
attr_groups. All the pmus of same type share the same attr_groups. If
the clockticks event is set for the first box, user can also observe the
event in other boxes.

The clocktick fixed counter is a standalone counter. It should be
removed from the Cbox PMUs. A new type of PMU is added which only
supports fixed counter events.

User observable changes with the patch.
clockticks event is removed from Cbox. It will return unsupported, if
uncore_cbox_0/clockticks/ is accessed. User may need to change their
script to use uncore_clock/clockticks/ to instead.

Signed-off-by: Kan Liang <kan.liang@intel.com>
---
 arch/x86/events/intel/uncore.c     | 13 +++++++------
 arch/x86/events/intel/uncore_snb.c | 38 +++++++++++++++++++++++++++-----------
 2 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index dbaaf7dc..03afeca 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -652,6 +652,10 @@ static int uncore_pmu_event_init(struct perf_event *event)
 	if (hwc->sample_period)
 		return -EINVAL;
 
+	/* Single fixed PMU only has fixed event */
+	if (pmu->type->single_fixed && (event->attr.config != UNCORE_FIXED_EVENT))
+		return -EINVAL;
+
 	/*
 	 * Place all uncore events for a particular physical package
 	 * onto a single cpu
@@ -675,12 +679,9 @@ static int uncore_pmu_event_init(struct perf_event *event)
 		/* no fixed counter */
 		if (!pmu->type->fixed_ctl)
 			return -EINVAL;
-		/*
-		 * if there is only one fixed counter, only the first pmu
-		 * can access the fixed counter
-		 */
-		if (pmu->type->single_fixed && pmu->pmu_idx > 0)
-			return -EINVAL;
+
+		if (pmu->type->single_fixed)
+			event->hw.idx = UNCORE_PMC_IDX_FIXED;
 
 		/* fixed counters have event field hardcoded to zero */
 		hwc->config = 0ULL;
diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c
index a3dcc12..1b037ea 100644
--- a/arch/x86/events/intel/uncore_snb.c
+++ b/arch/x86/events/intel/uncore_snb.c
@@ -117,7 +117,7 @@ static void snb_uncore_msr_exit_box(struct intel_uncore_box *box)
 }
 
 static struct uncore_event_desc snb_uncore_events[] = {
-	INTEL_UNCORE_EVENT_DESC(clockticks, "event=0xff,umask=0x00"),
+	INTEL_UNCORE_EVENT_DESC(clockticks, "event=0xff"),
 	{ /* end: all zeroes */ },
 };
 
@@ -155,17 +155,12 @@ static struct intel_uncore_type snb_uncore_cbox = {
 	.num_counters   = 2,
 	.num_boxes	= 4,
 	.perf_ctr_bits	= 44,
-	.fixed_ctr_bits	= 48,
 	.perf_ctr	= SNB_UNC_CBO_0_PER_CTR0,
 	.event_ctl	= SNB_UNC_CBO_0_PERFEVTSEL0,
-	.fixed_ctr	= SNB_UNC_FIXED_CTR,
-	.fixed_ctl	= SNB_UNC_FIXED_CTR_CTRL,
-	.single_fixed	= 1,
 	.event_mask	= SNB_UNC_RAW_EVENT_MASK,
 	.msr_offset	= SNB_UNC_CBO_MSR_OFFSET,
 	.ops		= &snb_uncore_msr_ops,
 	.format_group	= &snb_uncore_format_group,
-	.event_descs	= snb_uncore_events,
 };
 
 static struct intel_uncore_type snb_uncore_arb = {
@@ -182,9 +177,34 @@ static struct intel_uncore_type snb_uncore_arb = {
 	.format_group	= &snb_uncore_format_group,
 };
 
+static struct attribute *snb_uncore_clock_formats_attr[] = {
+	&format_attr_event.attr,
+	NULL,
+};
+
+static struct attribute_group snb_uncore_clock_format_group = {
+	.name = "format",
+	.attrs = snb_uncore_clock_formats_attr,
+};
+
+static struct intel_uncore_type snb_uncore_clockbox = {
+	.name		= "clock",
+	.num_counters   = 1,
+	.num_boxes	= 1,
+	.fixed_ctr_bits	= 48,
+	.fixed_ctr	= SNB_UNC_FIXED_CTR,
+	.fixed_ctl	= SNB_UNC_FIXED_CTR_CTRL,
+	.single_fixed	= 1,
+	.event_mask	= SNB_UNC_CTL_EV_SEL_MASK,
+	.format_group	= &snb_uncore_clock_format_group,
+	.ops		= &snb_uncore_msr_ops,
+	.event_descs	= snb_uncore_events,
+};
+
 static struct intel_uncore_type *snb_msr_uncores[] = {
 	&snb_uncore_cbox,
 	&snb_uncore_arb,
+	&snb_uncore_clockbox,
 	NULL,
 };
 
@@ -229,22 +249,18 @@ static struct intel_uncore_type skl_uncore_cbox = {
 	.num_counters   = 4,
 	.num_boxes	= 5,
 	.perf_ctr_bits	= 44,
-	.fixed_ctr_bits	= 48,
 	.perf_ctr	= SNB_UNC_CBO_0_PER_CTR0,
 	.event_ctl	= SNB_UNC_CBO_0_PERFEVTSEL0,
-	.fixed_ctr	= SNB_UNC_FIXED_CTR,
-	.fixed_ctl	= SNB_UNC_FIXED_CTR_CTRL,
-	.single_fixed	= 1,
 	.event_mask	= SNB_UNC_RAW_EVENT_MASK,
 	.msr_offset	= SNB_UNC_CBO_MSR_OFFSET,
 	.ops		= &skl_uncore_msr_ops,
 	.format_group	= &snb_uncore_format_group,
-	.event_descs	= snb_uncore_events,
 };
 
 static struct intel_uncore_type *skl_msr_uncores[] = {
 	&skl_uncore_cbox,
 	&snb_uncore_arb,
+	&snb_uncore_clockbox,
 	NULL,
 };
 
-- 
2.4.3

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

* Re: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-12-12 14:49         ` Liang, Kan
@ 2016-12-14 11:33           ` Jiri Olsa
  2016-12-20 18:05             ` Liang, Kan
  0 siblings, 1 reply; 11+ messages in thread
From: Jiri Olsa @ 2016-12-14 11:33 UTC (permalink / raw)
  To: Liang, Kan
  Cc: Peter Zijlstra, Jiri Olsa (jolsa@kernel.org),
	Andi Kleen, lkml, Ingo Molnar, Michael Petlan

On Mon, Dec 12, 2016 at 02:49:03PM +0000, Liang, Kan wrote:
> 
> 
> > I really would prefer to move the thing to its own PMU.
> 
> The patch as below creates a new PMU to fix the issue.
> 
> Jirka, could you please try the patch on your machine?
> 
> 
> Thanks,
> Kan
> -------
> From 2de8b2eda6b54734e08a608b5fc8c367b94369d3 Mon Sep 17 00:00:00 2001
> From: Kan Liang <kan.liang@intel.com>
> Date: Mon, 12 Dec 2016 09:03:35 -0500
> Subject: [PATCH] perf/x86/intel/uncore: fix nonexistent clockticks event for
>  client uncore
> 
> The clockticks event can only be used by the first Cbox pmu. Other
> Cboxes don't allow to open clockticks event, eventhough it's announced
> via /sys/../events/..
> 
> For client uncore, there is only one clocktick fixed counter. Current
> kernel code forces that only the first box can access the fixed counter
> in uncore_pmu_event_init. But it doesn't take care of the the
> attr_groups. All the pmus of same type share the same attr_groups. If
> the clockticks event is set for the first box, user can also observe the
> event in other boxes.
> 
> The clocktick fixed counter is a standalone counter. It should be
> removed from the Cbox PMUs. A new type of PMU is added which only
> supports fixed counter events.
> 
> User observable changes with the patch.
> clockticks event is removed from Cbox. It will return unsupported, if
> uncore_cbox_0/clockticks/ is accessed. User may need to change their
> script to use uncore_clock/clockticks/ to instead.
> 
> Signed-off-by: Kan Liang <kan.liang@intel.com>

seems ok

Tested-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka

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

* RE: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-12-14 11:33           ` Jiri Olsa
@ 2016-12-20 18:05             ` Liang, Kan
  2017-01-16 13:15               ` Liang, Kan
  0 siblings, 1 reply; 11+ messages in thread
From: Liang, Kan @ 2016-12-20 18:05 UTC (permalink / raw)
  To: Jiri Olsa, Peter Zijlstra, Ingo Molnar
  Cc: Jiri Olsa (jolsa@kernel.org), Andi Kleen, lkml, Michael Petlan


> On Mon, Dec 12, 2016 at 02:49:03PM +0000, Liang, Kan wrote:
> >
> >
> > > I really would prefer to move the thing to its own PMU.
> >
> > The patch as below creates a new PMU to fix the issue.
> >
> > Jirka, could you please try the patch on your machine?
> >
> >
> > Thanks,
> > Kan
> > -------
> > From 2de8b2eda6b54734e08a608b5fc8c367b94369d3 Mon Sep 17
> 00:00:00 2001
> > From: Kan Liang <kan.liang@intel.com>
> > Date: Mon, 12 Dec 2016 09:03:35 -0500
> > Subject: [PATCH] perf/x86/intel/uncore: fix nonexistent clockticks
> > event for  client uncore
> >
> > The clockticks event can only be used by the first Cbox pmu. Other
> > Cboxes don't allow to open clockticks event, eventhough it's announced
> > via /sys/../events/..
> >
> > For client uncore, there is only one clocktick fixed counter. Current
> > kernel code forces that only the first box can access the fixed
> > counter in uncore_pmu_event_init. But it doesn't take care of the the
> > attr_groups. All the pmus of same type share the same attr_groups. If
> > the clockticks event is set for the first box, user can also observe
> > the event in other boxes.
> >
> > The clocktick fixed counter is a standalone counter. It should be
> > removed from the Cbox PMUs. A new type of PMU is added which only
> > supports fixed counter events.
> >
> > User observable changes with the patch.
> > clockticks event is removed from Cbox. It will return unsupported, if
> > uncore_cbox_0/clockticks/ is accessed. User may need to change their
> > script to use uncore_clock/clockticks/ to instead.
> >
> > Signed-off-by: Kan Liang <kan.liang@intel.com>
> 
> seems ok
> 
> Tested-by: Jiri Olsa <jolsa@redhat.com>
> 

Hi Peter and Ingo,

Any comments for the patch?
Do I need to re-send it?

Thanks,
Kan

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

* RE: [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question
  2016-12-20 18:05             ` Liang, Kan
@ 2017-01-16 13:15               ` Liang, Kan
  0 siblings, 0 replies; 11+ messages in thread
From: Liang, Kan @ 2017-01-16 13:15 UTC (permalink / raw)
  To: 'Jiri Olsa', 'Peter Zijlstra', 'Ingo Molnar'
  Cc: 'Jiri Olsa (jolsa@kernel.org)', 'Andi Kleen',
	'lkml', 'Michael Petlan'

> 
> > On Mon, Dec 12, 2016 at 02:49:03PM +0000, Liang, Kan wrote:
> > >
> > >
> > > > I really would prefer to move the thing to its own PMU.
> > >
> > > The patch as below creates a new PMU to fix the issue.
> > >
> > > Jirka, could you please try the patch on your machine?
> > >
> > >
> > > Thanks,
> > > Kan
> > > -------
> > > From 2de8b2eda6b54734e08a608b5fc8c367b94369d3 Mon Sep 17
> > 00:00:00 2001
> > > From: Kan Liang <kan.liang@intel.com>
> > > Date: Mon, 12 Dec 2016 09:03:35 -0500
> > > Subject: [PATCH] perf/x86/intel/uncore: fix nonexistent clockticks
> > > event for  client uncore
> > >
> > > The clockticks event can only be used by the first Cbox pmu. Other
> > > Cboxes don't allow to open clockticks event, eventhough it's
> > > announced via /sys/../events/..
> > >
> > > For client uncore, there is only one clocktick fixed counter.
> > > Current kernel code forces that only the first box can access the
> > > fixed counter in uncore_pmu_event_init. But it doesn't take care of
> > > the the attr_groups. All the pmus of same type share the same
> > > attr_groups. If the clockticks event is set for the first box, user
> > > can also observe the event in other boxes.
> > >
> > > The clocktick fixed counter is a standalone counter. It should be
> > > removed from the Cbox PMUs. A new type of PMU is added which only
> > > supports fixed counter events.
> > >
> > > User observable changes with the patch.
> > > clockticks event is removed from Cbox. It will return unsupported,
> > > if uncore_cbox_0/clockticks/ is accessed. User may need to change
> > > their script to use uncore_clock/clockticks/ to instead.
> > >
> > > Signed-off-by: Kan Liang <kan.liang@intel.com>
> >
> > seems ok
> >
> > Tested-by: Jiri Olsa <jolsa@redhat.com>
> >
> 
> Hi Peter and Ingo,
> 
> Any comments for the patch?
> Do I need to re-send it?
> 
> Thanks,
> Kan

Hi Peter and Ingo,

Ping.
Please let me know if you want me to re-send the patch.

Thanks,
Kan

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

end of thread, other threads:[~2017-01-16 13:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-30 10:51 [RFC] perf/x86/intel/uncore: pmu->type->single_fixed question Jiri Olsa
2016-11-30 14:45 ` Liang, Kan
2016-11-30 17:52   ` Andi Kleen
2016-12-01 16:34     ` Liang, Kan
2016-12-01 16:37       ` Peter Zijlstra
2016-12-12 14:49         ` Liang, Kan
2016-12-14 11:33           ` Jiri Olsa
2016-12-20 18:05             ` Liang, Kan
2017-01-16 13:15               ` Liang, Kan
2016-11-30 15:27 ` Liang, Kan
2016-11-30 15:38   ` Jiri Olsa

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).