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]
Date:   Thu, 22 Apr 2021 12:26:22 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     "Jin, Yao" <yao.jin@...ux.intel.com>
Cc:     acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com,
        Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v4 15/25] perf stat: Filter out unmatched aggregation for
 hybrid event

On Thu, Apr 22, 2021 at 11:10:54AM +0800, Jin, Yao wrote:
> Hi Jiri,
> 
> On 4/22/2021 2:29 AM, Jiri Olsa wrote:
> > On Fri, Apr 16, 2021 at 10:05:07PM +0800, Jin Yao wrote:
> > 
> > SNIP
> > 
> > > diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> > > index 5255d78b1c30..15eafd249e46 100644
> > > --- a/tools/perf/util/stat-display.c
> > > +++ b/tools/perf/util/stat-display.c
> > > @@ -643,6 +643,20 @@ static void aggr_cb(struct perf_stat_config *config,
> > >   	}
> > >   }
> > > +static bool aggr_id_hybrid_matched(struct perf_stat_config *config,
> > > +				   struct evsel *counter, struct aggr_cpu_id id)
> > > +{
> > > +	struct aggr_cpu_id s;
> > > +
> > > +	for (int i = 0; i < evsel__nr_cpus(counter); i++) {
> > > +		s = config->aggr_get_id(config, evsel__cpus(counter), i);
> > > +		if (cpu_map__compare_aggr_cpu_id(s, id))
> > > +			return true;
> > > +	}
> > > +
> > > +	return false;
> > > +}
> > > +
> > >   static void print_counter_aggrdata(struct perf_stat_config *config,
> > >   				   struct evsel *counter, int s,
> > >   				   char *prefix, bool metric_only,
> > > @@ -656,6 +670,12 @@ static void print_counter_aggrdata(struct perf_stat_config *config,
> > >   	double uval;
> > >   	ad.id = id = config->aggr_map->map[s];
> > > +
> > > +	if (perf_pmu__has_hybrid() &&
> > > +	    !aggr_id_hybrid_matched(config, counter, id)) {
> > > +		return;
> > > +	}
> > > +
> > >   	ad.val = ad.ena = ad.run = 0;
> > >   	ad.nr = 0;
> > >   	if (!collect_data(config, counter, aggr_cb, &ad))
> > 
> > there's same check in aggr_cb, so it seems like we could just make check in here:
> > 
> > 	if (perf_pmu__has_hybrid() && ad.ena == 0)
> > 		return;
> > 
> > without another extra loop
> > 
> > jirka
> > 
> 
> I guess you recommended the patch like this:
> 
>  static void print_counter_aggrdata(struct perf_stat_config *config,
>                                    struct evsel *counter, int s,
>                                    char *prefix, bool metric_only,
> @@ -670,17 +656,14 @@ static void print_counter_aggrdata(struct perf_stat_config *config,
>         double uval;
> 
>         ad.id = id = config->aggr_map->map[s];
>         ad.val = ad.ena = ad.run = 0;
>         ad.nr = 0;
>         if (!collect_data(config, counter, aggr_cb, &ad))
>                 return;
> 
> +       if (perf_pmu__has_hybrid() && ad.ena == 0)
> +               return;
> +
>         nr = ad.nr;
>         ena = ad.ena;
>         run = ad.run;
> 
> Yes, it works. The test log is,

ok, great

thanks,
jirka

> 
> # perf stat --per-core -e cpu_core/cycles/ -a -- sleep 1
> 
>  Performance counter stats for 'system wide':
> 
> S0-D0-C0           2          2,341,923      cpu_core/cycles/
> S0-D0-C4           2          1,707,933      cpu_core/cycles/
> S0-D0-C8           2            845,805      cpu_core/cycles/
> S0-D0-C12          2          1,001,961      cpu_core/cycles/
> S0-D0-C16          2            932,004      cpu_core/cycles/
> S0-D0-C20          2          1,778,603      cpu_core/cycles/
> S0-D0-C24          2            804,448      cpu_core/cycles/
> S0-D0-C28          2            178,360      cpu_core/cycles/
> 
>        1.002264168 seconds time elapsed
> 
> Thanks
> Jin Yao
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ