From: Peter Zijlstra <peterz@infradead.org>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, jolsa@redhat.com,
adrian.hunter@intel.com
Subject: Re: [PATCH 2/2] perf/x86/intel: Support PEBS output to PT
Date: Wed, 8 May 2019 11:12:27 +0200 [thread overview]
Message-ID: <20190508091227.GB2606@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190502105022.15534-3-alexander.shishkin@linux.intel.com>
On Thu, May 02, 2019 at 01:50:22PM +0300, Alexander Shishkin wrote:
> If PEBS declares ability to output its data to Intel PT stream, use the
> aux_source attribute bit to enable PEBS data output to PT. This requires
> a PT event to be present and scheduled in the same context. Unlike the
> DS area, the kernel does not extract PEBS records from the PT stream to
> generate corresponding records in the perf stream, because that would
> require real time in-kernel PT decoding, which is not feasible. The PMI,
> however, can still be used.
>
> The output setting is per-CPU, so all PEBS events must be either writing
> to PT or to the DS area, so in order to not mess up the event scheduling,
> we fall back to the latter in case both types of events are scheduled in.
>
> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> ---
> arch/x86/events/intel/core.c | 13 +++++++
> arch/x86/events/intel/ds.c | 59 +++++++++++++++++++++++++++++++-
> arch/x86/events/perf_event.h | 9 +++++
> arch/x86/include/asm/msr-index.h | 3 ++
> 4 files changed, 83 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> index 4b4dac089635..949a589fd9b1 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -3291,6 +3291,19 @@ static int intel_pmu_hw_config(struct perf_event *event)
> }
> }
>
> + if (event->attr.aux_source) {
> + if (!event->attr.precise_ip)
> + return -EINVAL;
> +
> + if (!x86_pmu.intel_cap.pebs_output_pt_available)
> + return -EOPNOTSUPP;
> +
> + event->hw.flags |= PERF_X86_EVENT_PEBS_VIA_PT;
> +
> + /* Signal to the core that we handled it */
> + event->attr.aux_source = 0;
That's a bit yuck, ideally we'd not modify attrs.
Can't we change that test in perf_event_alloc() to something like:
if (event->attr.aux_source &&
!(pmu->capabilities & PERF_PMU_CAP_AUX_SOURCE))
// error
?
> + }
next prev parent reply other threads:[~2019-05-08 9:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-02 10:50 [PATCH 0/2] perf, intel: Add support for PEBS output to Intel PT Alexander Shishkin
2019-05-02 10:50 ` [PATCH 1/2] perf: Allow normal events to be sources of AUX data Alexander Shishkin
2019-05-02 10:50 ` [PATCH 2/2] perf/x86/intel: Support PEBS output to PT Alexander Shishkin
2019-05-08 9:12 ` Peter Zijlstra [this message]
2019-05-08 9:18 ` Peter Zijlstra
2019-05-08 9:34 ` Peter Zijlstra
2019-05-03 8:57 ` [PATCH 0/2] perf, intel: Add support for PEBS output to Intel PT Alexander Shishkin
2019-05-08 10:39 ` Peter Zijlstra
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=20190508091227.GB2606@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/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®