public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>,
	Stephane Eranian <eranian@google.com>,
	Andi Kleen <andi@firstfloor.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 -tip] perf: x86, add SandyBridge support
Date: Mon, 28 Feb 2011 22:56:34 +0800	[thread overview]
Message-ID: <1298904994.2169.60.camel@localhost> (raw)
In-Reply-To: <1298884559.2428.10083.camel@twins>

On Mon, 2011-02-28 at 17:15 +0800, Peter Zijlstra wrote:
> On Mon, 2011-02-28 at 15:22 +0800, Lin Ming wrote:
> > This patch adds basic SandyBridge support, including hardware cache
> > events and PEBS events support.
> > 
> > LLC-* hareware cache events don't work for now, it depends on the
> > offcore patches.
> 
> What's the status of those, Stephane reported some problems last I
> remember?
> 
> 
> >  #define INTEL_EVENT_CONSTRAINT(c, n)	\
> >  	EVENT_CONSTRAINT(c, n, ARCH_PERFMON_EVENTSEL_EVENT)
> > +#define INTEL_EVENT_CONSTRAINT2(c, n)	\
> > +	EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK)
> 
> That's a particularly bad name, how about something like
> 
> INTEL_UEVENT_CONSTRAINT or somesuch.
> 
> > @@ -702,7 +738,13 @@ static void intel_ds_init(void)
> >  			printk(KERN_CONT "PEBS fmt1%c, ", pebs_type);
> >  			x86_pmu.pebs_record_size = sizeof(struct pebs_record_nhm);
> >  			x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm;
> > -			x86_pmu.pebs_constraints = intel_nehalem_pebs_events;
> > +			switch (boot_cpu_data.x86_model) {
> > +			case 42: /* SandyBridge */
> > +				x86_pmu.pebs_constraints = intel_snb_pebs_events;
> > +				break;
> > +			default:
> > +				x86_pmu.pebs_constraints = intel_nehalem_pebs_events;
> > +			}
> >  			break;
> >  
> >  		default:
> 
> We already have this massive model switch right after this function,
> might as well move the pebs constraint assignment there.

How about below?
Leave the default pebs constraint assignment in intel_ds_init, and
overwrite it for snb in intel_pmu_init.

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 66712dd..d6edc8a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1182,6 +1182,7 @@ static __init int intel_pmu_init(void)
 		intel_pmu_lbr_init_nhm();
 
 		x86_pmu.event_constraints = intel_snb_event_constraints;
+		x86_pmu.pebs_constraints = intel_snb_pebs_events;
 		pr_cont("SandyBridge events, ");
 		break;
 
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 2128755..3e5530b 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -740,13 +740,6 @@ static void intel_ds_init(void)
 			printk(KERN_CONT "PEBS fmt1%c, ", pebs_type);
 			x86_pmu.pebs_record_size = sizeof(struct pebs_record_nhm);
 			x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm;
-			switch (boot_cpu_data.x86_model) {
-			case 42: /* SandyBridge */
-				x86_pmu.pebs_constraints = intel_snb_pebs_events;
-				break;
-			default:
-				x86_pmu.pebs_constraints = intel_nehalem_pebs_events;
-			}
 			break;
 
 		default:




  parent reply	other threads:[~2011-02-28 14:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28  7:22 [PATCH v2 -tip] perf: x86, add SandyBridge support Lin Ming
2011-02-28  8:20 ` Stephane Eranian
2011-02-28  8:51   ` Lin Ming
2011-02-28  9:02     ` Stephane Eranian
2011-02-28 14:03       ` Lin Ming
2011-02-28 14:28         ` Lin Ming
2011-02-28  9:08     ` Ingo Molnar
2011-02-28 14:02       ` Lin Ming
2011-02-28 14:13         ` Stephane Eranian
2011-02-28  9:15 ` Peter Zijlstra
2011-02-28 12:25   ` Stephane Eranian
2011-02-28 14:33     ` Lin Ming
2011-02-28 14:43       ` Stephane Eranian
2011-02-28 14:52         ` Lin Ming
2011-02-28 14:55           ` Stephane Eranian
2011-02-28 14:21   ` Lin Ming
2011-02-28 14:24     ` Peter Zijlstra
2011-02-28 14:45       ` Lin Ming
2011-02-28 14:46         ` Stephane Eranian
2011-02-28 14:56   ` Lin Ming [this message]
2011-02-28 15:11     ` Peter Zijlstra
2011-03-01  0:32       ` Lin Ming
2011-03-01  7:43   ` Stephane Eranian
2011-03-01  8:21     ` Lin Ming
2011-03-01  8:45     ` Lin Ming
2011-03-01  8:57       ` Stephane Eranian
2011-03-01  9:39         ` Stephane Eranian
2011-03-01 15:07           ` Lin Ming
2011-03-01 15:09             ` Stephane Eranian
2011-03-01 15:18               ` Lin Ming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1298904994.2169.60.camel@localhost \
    --to=ming.m.lin@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox