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: <20180619182418.GB1926@krava>
Date:   Tue, 19 Jun 2018 20:24:18 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Thomas Richter <tmricht@...ux.ibm.com>,
        linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
        brueckner@...ux.vnet.ibm.com, schwidefsky@...ibm.com,
        heiko.carstens@...ibm.com
Subject: Re: [PATCH 3/3] perf stat: Remove duplicate event counting

On Tue, Jun 19, 2018 at 12:17:06PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jun 15, 2018 at 10:21:24AM +0200, Jiri Olsa escreveu:
> > On Thu, Jun 14, 2018 at 01:48:45PM +0200, Thomas Richter wrote:
> > 
> > SNIP
> > 
> > > +static void perf_pmu_assign_str(char *name, const char *field, char **old_str,
> > > +				char **new_str)
> > > +{
> > > +	if (!*old_str)
> > > +		goto set_new;
> > > +
> > > +	if (*new_str) {	/* Have new string, check with old */
> > > +		if (strcasecmp(*old_str, *new_str))
> > > +			pr_debug("alias %s differs in field '%s'\n",
> > > +				 name, field);
> > > +		zfree(old_str);
> > > +	} else		/* Nothing new --> keep old string */
> > > +		return;
> > > +set_new:
> > > +	*old_str = *new_str;
> > > +	*new_str = NULL;
> > > +}
> > > +
> > > +static void perf_pmu_update_alias(struct perf_pmu_alias *old,
> > > +				  struct perf_pmu_alias *newalias)
> > > +{
> > > +	perf_pmu_assign_str(old->name, "desc", &old->desc, &newalias->desc);
> > > +	perf_pmu_assign_str(old->name, "long_desc", &old->long_desc,
> > > +			    &newalias->long_desc);
> > > +	perf_pmu_assign_str(old->name, "topic", &old->topic, &newalias->topic);
> > > +	perf_pmu_assign_str(old->name, "metric_expr", &old->metric_expr,
> > > +			    &newalias->metric_expr);
> > > +	perf_pmu_assign_str(old->name, "metric_name", &old->metric_name,
> > > +			    &newalias->metric_name);
> > > +	perf_pmu_assign_str(old->name, "value", &old->str, &newalias->str);
> > > +	old->scale = newalias->scale;
> > > +	old->per_pkg = newalias->per_pkg;
> > > +	old->snapshot = newalias->snapshot;
> > > +	memcpy(old->unit, newalias->unit, sizeof(old->unit));
> > > +}
> > > +
> > > +/* Delete an alias entry. */
> > > +static void perf_pmu_free_alias(struct perf_pmu_alias *newalias)
> > > +{
> > > +	zfree(&newalias->name);
> > > +	zfree(&newalias->desc);
> > > +	zfree(&newalias->long_desc);
> > > +	zfree(&newalias->topic);
> > > +	zfree(&newalias->str);
> > > +	zfree(&newalias->metric_expr);
> > > +	zfree(&newalias->metric_name);
> > > +	parse_events_terms__purge(&newalias->terms);
> > > +	free(newalias);
> > > +}
> > > +
> > > +/* Merge an alias, search in alias list. If this name is already
> > > + * present merge both of them to combine all information.
> > > + */
> > > +static bool perf_pmu_merge_alias(struct perf_pmu_alias *newalias,
> > > +				 struct list_head *alist)
> > > +{
> > > +	struct perf_pmu_alias *a;
> > > +
> > > +	list_for_each_entry(a, alist, list) {
> > > +		if (!strcasecmp(newalias->name, a->name)) {
> > > +			perf_pmu_update_alias(a, newalias);
> > > +			perf_pmu_free_alias(newalias);
> > > +			return true;
> > > +		}
> > > +	}
> > > +	return false;
> > > +}
> > 
> > ok, I like your change better.. we can rebuilt it to use
> > rb tree later when we have this fixed
> 
> Ok, can I take this as an Acked-by or Reviewed-by?

yes

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ