lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YNxPvIC3gVdy1bp4@hirez.programming.kicks-ass.net>
Date:   Wed, 30 Jun 2021 13:04:28 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>, Leo Yan <leo.yan@...aro.org>,
        Kan Liang <kan.liang@...ux.intel.com>, x86@...nel.org,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] perf/x86: Add new event for AUX output counter index

On Wed, Jun 30, 2021 at 12:21:07PM +0300, Adrian Hunter wrote:
> 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:

Right, bit yuck, but I suppose it works. The alternative is something
like:

	static_call_cond(x86_pmu_assign)(event, idx);

but I'm not sure that's worth it, but it avoids stuffing even more intel
specific bits into the core.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ