linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Leo Yan <leo.yan@linaro.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	x86@kernel.org, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] perf/x86: Add new event for AUX output counter index
Date: Wed, 30 Jun 2021 12:21:07 +0300	[thread overview]
Message-ID: <cc79fce0-2c92-dd55-fd50-46b28644f4fc@intel.com> (raw)
In-Reply-To: <YNXW4+QqeO1KL4Xq@hirez.programming.kicks-ass.net>

On 25/06/21 4:15 pm, Peter Zijlstra wrote:
> On Wed, Jun 09, 2021 at 05:20:53PM +0300, Adrian Hunter wrote:
> 
>> +static void intel_pmu_report_aux_output_id(struct perf_event *event)
>> +{
>> +	struct hw_perf_event *hwc = &event->hw;
>> +
>> +	/*
>> +	 * So long as all PEBS-via-PT events for a recording session are
>> +	 * scheduled together, then only changes to hwc->idx need be reported.
>> +	 */
>> +	if (hwc->idx != hwc->idx_reported) {
>> +		hwc->idx_reported = hwc->idx;
>> +		perf_report_aux_output_id(event, hwc->idx);
>> +	}
>> +}
> 
> AFAICT you want a callback in x86_assign_hw_event(), is that so?
> 

Yes, or open-coded e.g.

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 8f71dd72ef95..46dac45298d1 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -1207,6 +1207,11 @@ static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader,
 	return n;
 }
 
+static inline bool report_aux_output_id(struct perf_event *event)
+{
+	return is_pebs_pt(event);
+}
+
 static inline void x86_assign_hw_event(struct perf_event *event,
 				struct cpu_hw_events *cpuc, int i)
 {
@@ -1217,6 +1222,9 @@ static inline void x86_assign_hw_event(struct perf_event *event,
 	hwc->last_cpu = smp_processor_id();
 	hwc->last_tag = ++cpuc->tags[i];
 
+	if (report_aux_output_id(event))
+		perf_report_aux_output_id(event, idx);
+
 	switch (hwc->idx) {
 	case INTEL_PMC_IDX_FIXED_BTS:
 	case INTEL_PMC_IDX_FIXED_VLBR:

  reply	other threads:[~2021-06-30  9:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 14:20 [PATCH 0/3] perf intel-pt: Add PEBS-via-PT side-band Adrian Hunter
2021-06-09 14:20 ` [PATCH 1/3] perf/x86: Add new event for AUX output counter index Adrian Hunter
2021-06-25 12:06   ` Peter Zijlstra
2021-06-25 13:15   ` Peter Zijlstra
2021-06-30  9:21     ` Adrian Hunter [this message]
2021-06-30 11:04       ` Peter Zijlstra
2021-06-09 14:20 ` [PATCH 2/3] perf tools: Add support for PERF_RECORD_AUX_OUTPUT_HW_ID Adrian Hunter
2021-06-09 14:20 ` [PATCH 3/3] perf intel-pt: " Adrian Hunter
2021-06-21  6:15 ` [PATCH 0/3] perf intel-pt: Add PEBS-via-PT side-band Adrian Hunter

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=cc79fce0-2c92-dd55-fd50-46b28644f4fc@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.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).