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: Fri, 10 Dec 2010 16:31:02 +0800 [thread overview]
Message-ID: <1291969862.10384.53.camel@minggr.sh.intel.com> (raw)
In-Reply-To: <AANLkTinanAQYQvwtowTzJ0bpLRUvp-5sqF6M9PoMSJR-@mail.gmail.com>
Thanks for your great comments.
Let me read it carefully, and then reply back.
Lin Ming
On Fri, 2010-12-10 at 07:46 +0800, Stephane Eranian wrote:
> Hi,
>
> So I have tested this patch a bit on WSM and as I expected there
> are issues with sampling.
>
> When HT is on, both siblings CPUs get the interrupt. The HW does not
> allow you to only point interrupts to a single HT thread (CPU).
>
> I did verify that indeed both threads get the interrupt and that you have a
> race condition. Both sibling CPUs stop uncore, get the status. They may get
> the same overflow status. Both will pass the uncore->active_mask because
> it's shared among siblings cores. Thus, you have a race for the whole
> interrupt handler execution.
>
> You need some serialization in there. But the patch does not address this.
> The problem is different from the back-to-back interrupt issue that
> Don worked on.
> The per-cpu marked/handled trick cannot work to avoid this problem.
>
> You cannot simply say "the lowest indexed" CPU of a sibling pair
> handles the interrupt
> because you don't know if this in an uncore intr, core interrupt or
> something else. You
> need to check. That means each HT thread needs to check uncore
> ovfl_status. IF the
> status is zero, then return. Otherwise, you need to do a 2nd level
> check before you can
> execute the handler. You need to know if the sibling CPU has already
> "consumed" that
> interrupt.
>
> I think you need some sort of generation counter per physical core and
> per HT thread.
> On interrupt, you could do something along the line of:
> if (mycpu->intr_count == mysibling->intr_count) {
> then mycpu->intr_count++
> execute intr_handler()
> } else {
> mycpu->intr_count++
> return;
> }
> Of course, the above needs some atomicity and ad locking (but I don't
> think you can
> use locks in NMI context).
>
> This makes me wonder if vectoring uncore to NMI is really needed,
> given you cannot
> correlated to an IP, incl. a kernel IP. If we were to vector to a
> dedicated (lower prio)
> vector, then we could use the trick of saying the lowest indexed CPU in a pair
> handles the interrupt (because we would already know this is an uncore
> interrupt).
> This would be much simpler. Price: not samples in kernel's critical
> section. But those
> are useless anyway with uncore events.
>
> - uncore_get_status().
> PERF_GLOBAL_STATUS contains more than overflow
> status, bit 61-63 need to be masked off.
>
> - uncore_pmu_cpu_prepare()
> I don't understand the x86_max_cores < 2 test. If you run your
> NHM/WSM is single core mode, you still have uncore to deal with
> thus, you need cpuc->intel_uncore initialized, don't you?
>
> - I assume that the reason the uncore->refcnt management is not
> using atomic ops because the whole CPU hotplug is serialized, right?
next prev parent reply other threads:[~2010-12-10 8:27 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 [this message]
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
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=1291969862.10384.53.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.