linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Fri, 3 Jul 2015 21:04:20 +0200	[thread overview]
Message-ID: <20150703190420.GS3644@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CAMsRxfJurCVcQD5642R10SP70XuXxTes3CyKrrD5owu39f_AXg@mail.gmail.com>

On Fri, Jul 03, 2015 at 08:56:57PM +0200, Stephane Eranian wrote:
> Where do you see that we use cpuc->pebs_enabled after clearing it
> in pebs_disable() to check for overflow or active in drain_pebs()?
> I only see it used in get_next_pebs_record_by_bit()?


| static inline bool pebs_is_enabled(struct cpu_hw_events *cpuc)
| {
|         return (cpuc->pebs_enabled & ((1ULL << MAX_PEBS_EVENTS) - 1));
| }


| void intel_pmu_pebs_disable(struct perf_event *event)
| {
|         struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
|         struct hw_perf_event *hwc = &event->hw;
|         struct debug_store *ds = cpuc->ds;
| 
|         cpuc->pebs_enabled &= ~(1ULL << hwc->idx);

Here we clear it...

|         if (event->hw.flags & PERF_X86_EVENT_PEBS_LDLAT)
|                 cpuc->pebs_enabled &= ~(1ULL << (hwc->idx + 32));
|         else if (event->hw.flags & PERF_X86_EVENT_PEBS_ST)
|                 cpuc->pebs_enabled &= ~(1ULL << 63);
| 
|         if (ds->pebs_interrupt_threshold >
|             ds->pebs_buffer_base + x86_pmu.pebs_record_size) {
|                 intel_pmu_drain_pebs_buffer();

Here we drain the buffer; which uses ->pebs_enabled

|                 if (!pebs_is_enabled(cpuc))

And here we test it

|                         perf_sched_cb_dec(event->ctx->pmu);
|         }
| 
|         if (cpuc->enabled)
|                 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
| 
|         hwc->config |= ARCH_PERFMON_EVENTSEL_INT;
| }

That said, its far too warm and I might just not be making sense.

  reply	other threads:[~2015-07-03 19:04 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 [this message]
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
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=20150703190420.GS3644@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;
as well as URLs for NNTP newsgroup(s).