public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Stephane Eranian <eranian@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Andi Kleen <andi@firstfloor.org>, Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Arjan van de Ven <arjan@infradead.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 2/3 v3] perf: Implement Nehalem uncore pmu
Date: Mon, 17 Jan 2011 18:51:45 +0800	[thread overview]
Message-ID: <1295261505.28388.189.camel@minggr.sh.intel.com> (raw)
In-Reply-To: <AANLkTinGWPABoYszmbLcSRroFg74e6mpz=5FK7-C9cKK@mail.gmail.com>

On Mon, 2011-01-17 at 16:44 +0800, Stephane Eranian wrote:
> On Mon, Jan 17, 2011 at 2:29 AM, Lin Ming <ming.m.lin@intel.com> wrote:
> > On Fri, 2011-01-14 at 01:14 +0800, Stephane Eranian wrote:
> >> Lin,
> >
> > Hi, Stephane,
> >
> > Sorry for late response, I'm just back from vacation.
> >
> >>
> >> On Thu, Dec 2, 2010 at 6:20 AM, Lin Ming <ming.m.lin@intel.com> wrote:
> >> > +static void uncore_pmu_enable_all(int nmi_core)
> >> > +{
> >> > +       u64 ctrl;
> >> > +
> >> > +       ctrl = ((1 << UNCORE_NUM_GENERAL_COUNTERS) - 1) | MSR_UNCORE_PERF_GLOBAL_CTRL_EN_FC0;
> >> > +
> >> > +       /* Route all interrupts to the first core that accesses uncore */
> >> > +       ctrl |= 1ULL << (48 + nmi_core);
> >> > +
> >> > +       wrmsrl(MSR_UNCORE_PERF_GLOBAL_CTRL, ctrl);
> >> > +}
> >>
> >> Are you sure nmi_core is always between 0-3 on a 4-core system and 0-5
> >> on a 6-core system?
> >> In other words, is that what topology_core_id(raw_smp_processor_id()) returns?
> >
> > I just have a look at a 6-core system, the core id is not 0-5
> >
> > $ cat /proc/cpuinfo |grep "core id"
> > core id         : 0
> > core id         : 1
> > core id         : 2
> > core id         : 8
> > core id         : 9
> > core id         : 10
> >
> > So we'd better route all the interrupts to the first core of the socket.
> >
> I recently realized the issue with 0,1,2,8,9,10. At the time I wrote the perfmon
> support for uncore, those systems did not exist. Sparse APIC id is a major pain
> for uncore PMU interrupt routine given the way UNC_GLOBAL_CTRL works.
> 
> Unfortunately, routing to core 0 (core_cpu_id=0) won't be enough in the
> presence of HOTPLUG CPU. Imagine I disable the first three 3 cores.
> Now you the cpu you have to play with are 8,9,10. You need to remap
> to a number between 0-5.

Good idea.

And I have confirmed that there are 6 interrupt target bits on my 6-core
Westmere machine, although documentation does not say this.

u64 val=0x3FULL << 48;
wrmsrl(MSR_UNCORE_PERF_GLOBAL_CTRL, val);

Thanks,
Lin Ming

> 
> 
> > Thanks for the catch.
> > Lin Ming
> >
> >>
> >> Note that, unfortunately, I have not seen documentation that says on
> >> 6-core system
> >> UNC_GLOBAL_CTRL has 6 interrupt target bits, but it would make sense.
> >>
> >>
> >> Otherwise, you will get a kernel panic when you wrmsr UNC_GLOBAL_CTRL.
> >>
> >> > +
> >> > +       if (uncore->n_events == 1) {
> >> > +               nmi_core = topology_core_id(raw_smp_processor_id());
> >> > +               uncore->nmi_core = nmi_core;
> >> > +               uncore_pmu_enable_all(nmi_core);
> >> > +       }
> >
> >
> >



  reply	other threads:[~2011-01-17 10:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02  5:20 [RFC PATCH 2/3 v3] perf: Implement Nehalem uncore pmu Lin Ming
2010-12-02  5:57 ` Lin Ming
2010-12-07  6:15 ` Lin Ming
2010-12-09 19:17   ` Peter Zijlstra
2010-12-09 19:21 ` Peter Zijlstra
2010-12-09 20:15   ` Stephane Eranian
2010-12-09 20:19     ` Peter Zijlstra
2010-12-09 20:27       ` Stephane Eranian
2010-12-09 23:46   ` Stephane Eranian
2010-12-10  8:31     ` Lin Ming
2010-12-10 10:47     ` Peter Zijlstra
2010-12-10 10:52       ` Peter Zijlstra
2010-12-10 15:11         ` Cyrill Gorcunov
2010-12-11  5:49       ` Stephane Eranian
2010-12-13  8:27         ` Lin Ming
2010-12-13 16:42           ` Stephane Eranian
2010-12-13 16:51             ` Andi Kleen
2010-12-13 19:04               ` Stephane Eranian
2010-12-10  8:28   ` Lin Ming
2010-12-09 19:24 ` Peter Zijlstra
2010-12-10  8:28   ` Lin Ming
2011-01-13 17:14 ` Stephane Eranian
2011-01-17  1:29   ` Lin Ming
2011-01-17  8:44     ` Stephane Eranian
2011-01-17 10:51       ` Lin Ming [this message]
2011-01-17 10:56         ` Stephane Eranian

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=1295261505.28388.189.camel@minggr.sh.intel.com \
    --to=ming.m.lin@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=andi@firstfloor.org \
    --cc=arjan@infradead.org \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.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