From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Peter Zijlstra <peterz@infradead.org>
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, mathieu.poirier@linaro.org,
mark.rutland@arm.com,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: [PATCH v3 2/3] perf/x86/intel/pt: Factor out starting the trace
Date: Fri, 25 Oct 2019 17:08:34 +0300 [thread overview]
Message-ID: <20191025140835.53665-3-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <20191025140835.53665-1-alexander.shishkin@linux.intel.com>
PT trace is now enabled at the bottom of the event configuration
function that takes care of all configuration bits related to a given
event, including the address filter update. This is only needed where
the event configuration changes, that is, in ->add()/->start().
In the interrupt path we can use a lighter version that keeps the
configuration intact, since it hasn't changed, and only flips the
enable bit.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
arch/x86/events/intel/pt.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 05e43d0f430b..170f3b402274 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -397,6 +397,20 @@ static bool pt_event_valid(struct perf_event *event)
* These all are cpu affine and operate on a local PT
*/
+static void pt_config_start(struct perf_event *event)
+{
+ struct pt *pt = this_cpu_ptr(&pt_ctx);
+ u64 ctl = event->hw.config;
+
+ ctl |= RTIT_CTL_TRACEEN;
+ if (READ_ONCE(pt->vmx_on))
+ perf_aux_output_flag(&pt->handle, PERF_AUX_FLAG_PARTIAL);
+ else
+ wrmsrl(MSR_IA32_RTIT_CTL, ctl);
+
+ WRITE_ONCE(event->hw.config, ctl);
+}
+
/* Address ranges and their corresponding msr configuration registers */
static const struct pt_address_range {
unsigned long msr_a;
@@ -468,7 +482,6 @@ static u64 pt_config_filters(struct perf_event *event)
static void pt_config(struct perf_event *event)
{
- struct pt *pt = this_cpu_ptr(&pt_ctx);
u64 reg;
/* First round: clear STATUS, in particular the PSB byte counter. */
@@ -501,10 +514,7 @@ static void pt_config(struct perf_event *event)
reg |= (event->attr.config & PT_CONFIG_MASK);
event->hw.config = reg;
- if (READ_ONCE(pt->vmx_on))
- perf_aux_output_flag(&pt->handle, PERF_AUX_FLAG_PARTIAL);
- else
- wrmsrl(MSR_IA32_RTIT_CTL, reg);
+ pt_config_start(event);
}
static void pt_config_stop(struct perf_event *event)
@@ -1381,7 +1391,7 @@ void intel_pt_interrupt(void)
pt_config_buffer(topa_to_page(buf->cur)->table, buf->cur_idx,
buf->output_off);
- pt_config(event);
+ pt_config_start(event);
}
}
--
2.23.0
next prev parent reply other threads:[~2019-10-25 14:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-25 14:08 [PATCH v3 0/3] perf: Add AUX data sampling Alexander Shishkin
2019-10-25 14:08 ` [PATCH v3 1/3] perf: Allow using AUX data in perf samples Alexander Shishkin
2019-10-28 16:27 ` Peter Zijlstra
2019-10-28 16:28 ` Peter Zijlstra
2019-10-28 17:10 ` Alexander Shishkin
2019-10-28 17:08 ` Alexander Shishkin
2019-11-04 8:40 ` Peter Zijlstra
2019-11-04 10:40 ` Alexander Shishkin
2019-11-04 10:16 ` Peter Zijlstra
2019-11-04 12:30 ` Leo Yan
2019-11-13 10:56 ` [tip: perf/core] perf/aux: " tip-bot2 for Alexander Shishkin
2019-10-25 14:08 ` Alexander Shishkin [this message]
2019-11-13 10:56 ` [tip: perf/core] perf/x86/intel/pt: Factor out pt_config_start() tip-bot2 for Alexander Shishkin
2019-10-25 14:08 ` [PATCH v3 3/3] perf/x86/intel/pt: Add sampling support Alexander Shishkin
2019-11-13 10:56 ` [tip: perf/core] " tip-bot2 for Alexander Shishkin
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=20191025140835.53665-3-alexander.shishkin@linux.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.poirier@linaro.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).