From: Peter Zijlstra <peterz@infradead.org>
To: eranian@gmail.com
Cc: Vince Weaver <vincent.weaver@maine.edu>,
LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
kan.liang@intel.com
Subject: Re: perf: fuzzer triggered warning in intel_pmu_drain_pebs_nhm()
Date: Thu, 16 Jul 2015 09:15:36 +0200 [thread overview]
Message-ID: <20150716071536.GY19282@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CAMsRxf+W80S+T7KVD95V43oRHFKsK+j7xh5YRrSmVD9jz-4j8g@mail.gmail.com>
On Thu, Jul 16, 2015 at 08:02:03AM +0200, Stephane Eranian wrote:
> Been running it for a couple of hours, so far so good. I will let it
> run all night.
Thanks!
> > ---
> > arch/x86/kernel/cpu/perf_event_intel_ds.c | 29 +++++++++++++----------------
> > 1 file changed, 13 insertions(+), 16 deletions(-)
> >
> > diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
> > index 71fc40238843..68d0ced1d229 100644
> > --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
> > +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
> > @@ -1142,6 +1142,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
> >
> > for (at = base; at < top; at += x86_pmu.pebs_record_size) {
> > struct pebs_record_nhm *p = at;
> > + u64 pebs_status;
> >
> > /* PEBS v3 has accurate status bits */
> > if (x86_pmu.intel_cap.pebs_format >= 3) {
> > @@ -1152,12 +1153,14 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
> > continue;
> > }
> >
> > - bit = find_first_bit((unsigned long *)&p->status,
> > + pebs_status = p->status & cpuc->pebs_enabled;
> > + pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1;
> > +
> > + bit = find_first_bit((unsigned long *)&pebs_status,
> > x86_pmu.max_pebs_events);
> > if (bit >= x86_pmu.max_pebs_events)
> > continue;
Maybe we should WARN in this case? A PEBS entry without any PEBS bits
set in the status field would be 'weird', right?
Maybe something like:
if (WARN(bit >= x86_pmu.max_pebs_events,
"PEBS record without PEBS event! status=%Lx pebs_enabled=%Lx active_mask=%Lx",
p->status, cpuc->pebs_enabled, cpuc->active_mask))
continue;
If that triggers we at least get more info.
next prev parent reply other threads:[~2015-07-16 7:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 15:18 perf: fuzzer triggered warning in intel_pmu_drain_pebs_nhm() Vince Weaver
2015-07-02 19:43 ` Peter Zijlstra
2015-07-03 13:13 ` Peter Zijlstra
2015-07-03 18:56 ` Stephane Eranian
2015-07-03 19:04 ` Peter Zijlstra
2015-07-03 19:49 ` Vince Weaver
2015-07-15 6:42 ` Stephane Eranian
2015-07-15 12:35 ` Peter Zijlstra
2015-07-16 6:02 ` Stephane Eranian
2015-07-16 7:15 ` Peter Zijlstra [this message]
2015-07-16 7:30 ` Stephane Eranian
2015-07-16 21:12 ` Stephane Eranian
2015-07-03 19:03 ` Vince Weaver
2015-07-03 20:08 ` Liang, Kan
2015-07-06 10:55 ` Peter Zijlstra
2015-07-06 13:47 ` Liang, Kan
2015-07-06 16:22 ` Vince Weaver
2015-07-06 16:23 ` Liang, Kan
2015-07-06 16:51 ` Vince Weaver
2015-08-04 9:01 ` [tip:perf/core] perf/x86/intel/pebs: Fix event disable PEBS buffer drain tip-bot for Liang, Kan
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=20150716071536.GY19282@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=eranian@gmail.com \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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