From: Peter Zijlstra <peterz@infradead.org>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, vince@deater.net,
eranian@google.com, Arnaldo Carvalho de Melo <acme@infradead.org>,
Borislav Petkov <bp@suse.de>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX
Date: Tue, 14 Feb 2017 17:27:02 +0100 [thread overview]
Message-ID: <20170214162702.GR6500@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <87d1eklpb9.fsf@ashishki-desk.ger.corp.intel.com>
On Tue, Feb 14, 2017 at 06:17:30PM +0200, Alexander Shishkin wrote:
> Peter Zijlstra <peterz@infradead.org> writes:
>
> > On Tue, Feb 14, 2017 at 03:24:15PM +0200, Alexander Shishkin wrote:
> >> At the moment, if VMX operation prevents PT tracing, the PMU will
> >> silently return success to the event scheduling code, which will
> >> track its 'on' time, etc. Instead, report failure so that perf
> >> core knows this event is not actually on.
> >>
> >> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> >> Reported-by: Andi Kleen <ak@linux.intel.com>
> >> Fixes: 1c5ac21a0e ("perf/x86/intel/pt: Don't die on VMXON")
> >> ---
> >> arch/x86/events/intel/pt.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
> >> index d92a60ef08..9372fa4549 100644
> >> --- a/arch/x86/events/intel/pt.c
> >> +++ b/arch/x86/events/intel/pt.c
> >> @@ -1335,7 +1335,7 @@ static void pt_event_start(struct perf_event *event, int mode)
> >> struct pt_buffer *buf;
> >>
> >> if (READ_ONCE(pt->vmx_on))
> >> - return;
> >> + goto fail_stop;
> >>
> >> buf = perf_aux_output_begin(&pt->handle, event);
> >> if (!buf)
> >
> > I'm not getting it; how does this matter to the time tracking in
> > event_sched_in() / event_sched_out() ?
> >
> > That looks at event->state == PERF_EVENT_STATE*
> >
> > This goto affects event->hw.state == PERF_HES_
> >
> > The core assumes ->start() will _NOT_ fail.
>
> This is called by pmu::add(), which checks hw.state afterwards and if it
> finds HES_STOPPED, it returns an error, which event_sched_in() captures
> and keeps the event in INACTIVE state. Should I add a comment about it?
Egads... so what if ->add() succeeds but we then hit this on
->stop()/->start() due to throttle or period adjust?
Now I suppose PT will never normally hit either of those, but you can do
IOC_PERIOD on it, just for giggles.
Yes, this very much needs a comment... Also, should not this then live
in ->add() in the first place?
next prev parent reply other threads:[~2017-02-14 16:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 13:24 [PATCH 0/2] perf/x86/intel/pt: VMX related updates Alexander Shishkin
2017-02-14 13:24 ` [PATCH 1/2] perf/x86/intel/pt: Fail event scheduling on conflict with VMX Alexander Shishkin
2017-02-14 13:56 ` Peter Zijlstra
2017-02-14 16:17 ` Alexander Shishkin
2017-02-14 16:27 ` Peter Zijlstra [this message]
2017-02-14 17:21 ` Alexander Shishkin
2017-02-14 18:38 ` Peter Zijlstra
2017-02-14 19:48 ` Peter Zijlstra
2017-02-15 8:11 ` Alexander Shishkin
2017-02-15 8:53 ` Peter Zijlstra
2017-02-14 13:24 ` [PATCH 2/2] perf/x86/intel/pt: Fail event creation if VMX operation is on Alexander Shishkin
2017-02-14 14:02 ` Peter Zijlstra
2017-02-14 17:47 ` Arnaldo Carvalho de Melo
2017-02-15 8:34 ` Alexander Shishkin
2017-02-15 8:56 ` Peter Zijlstra
2017-02-15 13:05 ` Alexander Shishkin
2017-02-15 13:12 ` Arnaldo Carvalho de Melo
2017-02-15 13:37 ` Peter Zijlstra
2017-02-15 12:51 ` Arnaldo Carvalho de Melo
2017-02-15 13:09 ` Alexander Shishkin
2017-02-15 13:16 ` Arnaldo Carvalho de Melo
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=20170214162702.GR6500@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@infradead.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=bp@suse.de \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=vince@deater.net \
/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