public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>, Andi Kleen <ak@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	"mingo@elte.hu" <mingo@elte.hu>,
	"Liang, Kan" <kan.liang@intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH 2/3] perf/x86/pebs: add workaround for broken OVFL status on HSW
Date: Thu, 15 Dec 2016 18:10:08 +0100	[thread overview]
Message-ID: <20161215171008.GX3124@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CABPqkBRM5w-vzt5Vum+m9JjVKXtySGRGkzfE2yRizkORXdC=bg@mail.gmail.com>

On Thu, Dec 15, 2016 at 08:59:56AM -0800, Stephane Eranian wrote:
> On Thu, Dec 15, 2016 at 12:42 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> > On Wed, Dec 14, 2016 at 11:26:49PM -0800, Stephane Eranian wrote:
> >> On Wed, Dec 14, 2016 at 9:55 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> >> >
> >> > Just spotted this again, ping?
> >> >
> >> Ok, on what processor running what command, so I can try and reproduce?
> >
> > For me its more of a correctness issue, i've not actually spotted a
> > problem as such.
> >
> > But every time I read this code it makes me wonder.
> >
> > Supposing that the hardware sets the CTRL overflow flags but hasn't
> > generated the PEBS record yet (or not enough records to reach the PEBS
> > buffer threshold) we still don't want to process these events as if they
> > were !PEBS.
> >
> I am suspicious about the case where you have multiple PEBS events and
> they do not quite fire at the same time but close enough that you may have
> PEBS in-flight by the time you enter handle_irq.
> 
> Last night I ran a simple test on SKL using tip.git:
> 
> $ perf record --e
> cpu/event=0xd0,umask=0x81/upp,cpu/event=0xc0,umask=1/upp,cpu/event=0xd0,umask=0x81/upp
> multichase; perf report -D | fgrep SAMPLE | grep -v 'IP, 0x4' | grep
> -v events
> 
> Basically, looking for samples missing the EXACT tag, i.e., samples
> processed a regular event when I only have PEBS events. Over 8h, I got
> about 3 or 4 such samples. So there is still a condition where we see
> the overflow as regular and not PEBS. So we need to examine that code
> again looking for possible race with PEBS in flight and not having the
> PEBS overflow bits yet.

Isn't that exactly the case I was talking about? and would be avoided by
the proposed patch?


So semantically the counter overflows and then arms PEBS to record a
record on the next event once its armed (and this can be multiple events
after the overflow, since arming takes a while too).


Now, if the chip manages to raise the regular overflow bit during that
time, you get exactly what is described.

meaning we should unconditionally clear the pebs_enabled.

  reply	other threads:[~2016-12-15 17:11 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 19:50 [PATCH 0/3] perf/x86/pebs: various important fixes for PEBS Stephane Eranian
2016-03-03 19:50 ` [PATCH 1/3] perf/x86/intel: add definition for PT PMI bit Stephane Eranian
2016-03-08 13:16   ` [tip:perf/core] perf/x86/intel: Add " tip-bot for Stephane Eranian
2016-03-03 19:50 ` [PATCH 2/3] perf/x86/pebs: add workaround for broken OVFL status on HSW Stephane Eranian
2016-03-03 21:43   ` Andi Kleen
2016-03-03 23:40     ` Stephane Eranian
2016-03-07 10:24       ` Peter Zijlstra
2016-03-07 12:18         ` Peter Zijlstra
2016-03-07 18:27           ` Jiri Olsa
2016-03-07 20:25             ` Peter Zijlstra
2016-03-08 20:59               ` Stephane Eranian
2016-03-08 21:07                 ` Peter Zijlstra
2016-03-08 21:13                   ` Stephane Eranian
2016-03-09  5:34                     ` Stephane Eranian
2016-03-09  5:44                       ` Stephane Eranian
2016-03-09 17:40                         ` Stephane Eranian
2016-03-10 10:42                           ` Peter Zijlstra
2016-12-14 17:55                             ` Peter Zijlstra
2016-12-15  7:26                               ` Stephane Eranian
2016-12-15  7:52                                 ` Jiri Olsa
2016-12-15  8:04                                   ` Stephane Eranian
2016-12-15  8:42                                 ` Peter Zijlstra
2016-12-15 16:59                                   ` Stephane Eranian
2016-12-15 17:10                                     ` Peter Zijlstra [this message]
2016-12-16  8:38                                       ` Stephane Eranian
2016-12-16 17:48                                         ` Stephane Eranian
2016-03-10 13:53           ` Peter Zijlstra
2016-03-10 16:10             ` Stephane Eranian
2016-03-08 13:16   ` [tip:perf/core] perf/x86/pebs: Add workaround for broken OVFL status on HSW+ tip-bot for Stephane Eranian
2016-03-03 19:50 ` [PATCH 3/3] perf/x86/pebs: add proper PEBS constraints for Broadwell Stephane Eranian
2016-03-08 13:16   ` [tip:perf/core] perf/x86/pebs: Add " 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=20161215171008.GX3124@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung@kernel.org \
    /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