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] [thread-next>] [day] [month] [year] [list]
Message-ID: <YIFPF/RFVJmztd5b@krava>
Date:   Thu, 22 Apr 2021 12:25:27 +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 14/25] perf stat: Add default hybrid events

On Thu, Apr 22, 2021 at 10:12:49AM +0800, Jin, Yao wrote:
> Hi Jiri,
> 
> On 4/22/2021 2:29 AM, Jiri Olsa wrote:
> > On Fri, Apr 16, 2021 at 10:05:06PM +0800, Jin Yao wrote:
> > 
> > SNIP
> > 
> > > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> > > index 1255af4751c2..0351b99d17a7 100644
> > > --- a/tools/perf/builtin-stat.c
> > > +++ b/tools/perf/builtin-stat.c
> > > @@ -1145,6 +1145,13 @@ static int parse_stat_cgroups(const struct option *opt,
> > >   	return parse_cgroups(opt, str, unset);
> > >   }
> > > +static int add_default_hybrid_events(struct evlist *evlist)
> > > +{
> > > +	struct parse_events_error err;
> > > +
> > > +	return parse_events(evlist, "cycles,instructions,branches,branch-misses", &err);
> > > +}
> > > +
> > >   static struct option stat_options[] = {
> > >   	OPT_BOOLEAN('T', "transaction", &transaction_run,
> > >   		    "hardware transaction statistics"),
> > > @@ -1626,6 +1633,12 @@ static int add_default_attributes(void)
> > >     { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS	},
> > >     { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES		},
> > > +};
> > > +	struct perf_event_attr default_sw_attrs[] = {
> > > +  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK		},
> > > +  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES	},
> > > +  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CPU_MIGRATIONS		},
> > > +  { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS		},
> > 
> > hum, why not use default_attrs0, it's the same, no?
> > 
> 
> The default_attrs0 has one more item " {.type = PERF_TYPE_HARDWARE, .config
> = PERF_COUNT_HW_CPU_CYCLES },"
> 
> So I have to only pick out the sw attrs and save them to default_sw_attrs.
> 
> > >   };
> > >   /*
> > > @@ -1863,6 +1876,14 @@ static int add_default_attributes(void)
> > >   	}
> > >   	if (!evsel_list->core.nr_entries) {
> > > +		if (perf_pmu__has_hybrid()) {
> > > +			if (evlist__add_default_attrs(evsel_list,
> > > +						      default_sw_attrs) < 0) {
> > > +				return -1;
> > > +			}
> > > +			return add_default_hybrid_events(evsel_list);
> > 
> > please do it the same way like when topdown calls parse events,
> > we don't need to check for cycles, but please check result and
> > display the error
> > 
> 
> Something like this?
> 
> err = parse_events(evsel_list, "cycles,instructions,branches,branch-misses", &errinfo);
> if (err) {
> 	fprintf(stderr,...);
> 	parse_events_print_error(&errinfo, ...);
> 	return -1;
> }

yes

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ