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: <DB8PR04MB6795C5ED20F96DE37C3A95FEE6A10@DB8PR04MB6795.eurprd04.prod.outlook.com>
Date:   Mon, 11 May 2020 11:35:04 +0000
From:   Joakim Zhang <qiangqing.zhang@....com>
To:     John Garry <john.garry@...wei.com>, Jiri Olsa <jolsa@...hat.com>
CC:     "peterz@...radead.org" <peterz@...radead.org>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "acme@...nel.org" <acme@...nel.org>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "alexander.shishkin@...ux.intel.com" 
        <alexander.shishkin@...ux.intel.com>,
        "namhyung@...nel.org" <namhyung@...nel.org>,
        "will@...nel.org" <will@...nel.org>,
        "ak@...ux.intel.com" <ak@...ux.intel.com>,
        "linuxarm@...wei.com" <linuxarm@...wei.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "irogers@...gle.com" <irogers@...gle.com>,
        "robin.murphy@....com" <robin.murphy@....com>,
        "zhangshaokun@...ilicon.com" <zhangshaokun@...ilicon.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: RE: [PATCH RFC v3 09/12] perf metricgroup: Split up
 metricgroup__add_metric()


> -----Original Message-----
> From: John Garry <john.garry@...wei.com>
> Sent: 2020年5月11日 19:25
> To: Jiri Olsa <jolsa@...hat.com>; Joakim Zhang <qiangqing.zhang@....com>
> Cc: peterz@...radead.org; mingo@...hat.com; acme@...nel.org;
> mark.rutland@....com; alexander.shishkin@...ux.intel.com;
> namhyung@...nel.org; will@...nel.org; ak@...ux.intel.com;
> linuxarm@...wei.com; linux-kernel@...r.kernel.org; irogers@...gle.com;
> robin.murphy@....com; zhangshaokun@...ilicon.com;
> linux-arm-kernel@...ts.infradead.org
> Subject: Re: [PATCH RFC v3 09/12] perf metricgroup: Split up
> metricgroup__add_metric()
> 
> On 11/05/2020 12:01, Jiri Olsa wrote:
> > On Thu, May 07, 2020 at 07:57:48PM +0800, John Garry wrote:
> >> To aid supporting system event metric groups, break up the function
> >> metricgroup__add_metric() into a part which iterates metrics and a
> >> part which actually "adds" the metric.
> >>
> >> No functional change intended.
> >
> > this no longer applied on Arnaldo's perf/core,
> 
> 
> Hi jirka,
> 
> > it's very busy part now :-\
> 
> Right.
> 
> So I could rebase and resend, but I rather avoid that if possible since the metric
> code is so busy.
> 
> The point is that I would like to see progress on the kernel part first (to expose
> per-PMU sysfs identifier file). Once we agreement there, then I can promote
> this series to non-RFC and ensure I'm based on acme tip.
> 
> Hi Joakim, can you progress
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ker
> nel.org%2Flinux-arm-kernel%2F20200226073433.5834-1-qiangqing.zhang%40n
> xp.com%2F&amp;data=02%7C01%7Cqiangqing.zhang%40nxp.com%7Cf89617c
> e13bb4617a64d08d7f59e1e4e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0
> %7C0%7C637247931771912817&amp;sdata=8vOLZrUzBQs69KijOaIXmVqt%2F
> cUtadDK3bCHRFD04kE%3D&amp;reserved=0
> to non-RFC now?

Hi John,

Okay, I will re-send the patch as non-RFC right now.

Best Regards,
Joakim Zhang
> Thanks,
> John
> 
> 
> >
> > jirka
> >
> >>
> >> Signed-off-by: John Garry <john.garry@...wei.com>
> >> ---
> >>   tools/perf/util/metricgroup.c | 75
> ++++++++++++++++++++++++++-----------------
> >>   1 file changed, 45 insertions(+), 30 deletions(-)
> >>
> >> diff --git a/tools/perf/util/metricgroup.c
> >> b/tools/perf/util/metricgroup.c index 926449a7cdbf..d1033756a1bc
> >> 100644
> >> --- a/tools/perf/util/metricgroup.c
> >> +++ b/tools/perf/util/metricgroup.c
> >> @@ -231,6 +231,12 @@ static bool match_metric(const char *n, const
> char *list)
> >>   	return false;
> >>   }
> >>
> >> +static bool match_pe_metric(struct pmu_event *pe, const char
> >> +*metric) {
> >> +	return match_metric(pe->metric_group, metric) ||
> >> +	       match_metric(pe->metric_name, metric); }
> >> +
> >>   struct mep {
> >>   	struct rb_node nd;
> >>   	const char *name;
> >> @@ -485,6 +491,40 @@ static bool metricgroup__has_constraint(struct
> pmu_event *pe)
> >>   	return false;
> >>   }
> >>
> >> +static int metricgroup__add_metric_pmu_event(struct pmu_event *pe,
> >> +					     struct strbuf *events,
> >> +					     struct list_head *group_list) {
> >> +	const char **ids;
> >> +	int idnum;
> >> +	struct egroup *eg;
> >> +
> >> +	pr_debug("metric expr %s for %s\n", pe->metric_expr,
> >> +pe->metric_name);
> >> +
> >> +	if (expr__find_other(pe->metric_expr, NULL, &ids, &idnum) < 0)
> >> +		return 0;
> >> +
> >> +	if (events->len > 0)
> >> +		strbuf_addf(events, ",");
> >> +
> >> +	if (metricgroup__has_constraint(pe))
> >> +		metricgroup__add_metric_non_group(events, ids, idnum);
> >> +	else
> >> +		metricgroup__add_metric_weak_group(events, ids, idnum);
> >> +
> >> +	eg = malloc(sizeof(*eg));
> >> +	if (!eg)
> >> +		return -ENOMEM;
> >> +	eg->ids = ids;
> >> +	eg->idnum = idnum;
> >> +	eg->metric_name = pe->metric_name;
> >> +	eg->metric_expr = pe->metric_expr;
> >> +	eg->metric_unit = pe->unit;
> >> +	list_add_tail(&eg->nd, group_list);
> >> +
> >> +	return 0;
> >> +}
> >> +
> >>   static int metricgroup__add_metric(const char *metric, struct strbuf
> *events,
> >>   				   struct list_head *group_list)
> >>   {
> >> @@ -502,37 +542,12 @@ static int metricgroup__add_metric(const char
> *metric, struct strbuf *events,
> >>   			break;
> >>   		if (!pe->metric_expr)
> >>   			continue;
> >> -		if (match_metric(pe->metric_group, metric) ||
> >> -		    match_metric(pe->metric_name, metric)) {
> >> -			const char **ids;
> >> -			int idnum;
> >> -			struct egroup *eg;
> >> -
> >> -			pr_debug("metric expr %s for %s\n", pe->metric_expr,
> pe->metric_name);
> >>
> >> -			if (expr__find_other(pe->metric_expr,
> >> -					     NULL, &ids, &idnum) < 0)
> >> -				continue;
> >> -			if (events->len > 0)
> >> -				strbuf_addf(events, ",");
> >> -
> >> -			if (metricgroup__has_constraint(pe))
> >> -				metricgroup__add_metric_non_group(events, ids, idnum);
> >> -			else
> >> -				metricgroup__add_metric_weak_group(events, ids,
> idnum);
> >> -
> >> -			eg = malloc(sizeof(struct egroup));
> >> -			if (!eg) {
> >> -				ret = -ENOMEM;
> >> -				break;
> >> -			}
> >> -			eg->ids = ids;
> >> -			eg->idnum = idnum;
> >> -			eg->metric_name = pe->metric_name;
> >> -			eg->metric_expr = pe->metric_expr;
> >> -			eg->metric_unit = pe->unit;
> >> -			list_add_tail(&eg->nd, group_list);
> >> -			ret = 0;
> >> +		if (match_pe_metric(pe, metric)) {
> >> +			ret = metricgroup__add_metric_pmu_event(pe, events,
> >> +								group_list);
> >> +			if (ret)
> >> +				return ret;
> >>   		}
> >>   	}
> >>   	return ret;
> >> --
> >> 2.16.4
> >>
> >
> > .
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ