From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, ak@linux.intel.com,
vincent.weaver@maine.edu
Subject: Re: [PATCH] perf/x86/pebs: fix handling of PEBS buffer overflows
Date: Thu, 22 Dec 2016 14:25:23 +0100 [thread overview]
Message-ID: <20161222132523.GM3107@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1482395366-8992-1-git-send-email-eranian@google.com>
On Thu, Dec 22, 2016 at 12:29:26AM -0800, Stephane Eranian wrote:
> This patch solves a race condition between PEBS and the PMU handler.
>
> In case multiple PEBS events are sampled at the same time,
> it is possible to have GLOBAL_STATUS bit 62 set indicating
> PEBS buffer overflow and also seeing at most 3 PEBS counters
> having their bits set in the status register. This is a sign
> that there was at least one PEBS record pending at the time
> of the PMU interrupt. PEBS counters must only be processed
> via the drain_pebs() calls, and not via the regular sample
> processing loop coming after that the function, otherwise
> phony regular samples may be generated in the sampling buffer
> not marked with the EXACT tag.
>
> Another possibility is to have one PEBS event and at least
> one non-PEBS event whic hoverflows while PEBS has armed. In this
> case, bit 62 of GLOBAL_STATUS will not be set, yet the overflow
> status bit for the PEBS counter will be on Skylake.
>
> To avoid this problem, we systematically ignore the PEBS-enabled
> counters from the GLOBAL_STATUS mask and we always process PEBS
> events via drain_pebs().
>
> The problem manifested itself by having non-exact samples when
> sampling only PEBS events, i.e., the PERF_SAMPLE_RECORD would
> not have the EXACT flag set.
>
> Note that this problem is only present on Skylake processor.
> This fix is harmless on older processors.
>
> Reported-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Stephane Eranian <eranian@google.com>
> ---
Thanks!
next prev parent reply other threads:[~2016-12-22 13:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-22 8:29 Stephane Eranian
2016-12-22 13:25 ` Peter Zijlstra [this message]
2016-12-22 16:50 ` [tip:perf/urgent] perf/x86/pebs: Fix " tip-bot for 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=20161222132523.GM3107@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=vincent.weaver@maine.edu \
/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
all inboxes | Powered by JetHome®