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: <YE/n3yfo37V+cigN@krava>
Date:   Tue, 16 Mar 2021 00:03:59 +0100
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 v2 04/27] perf pmu: Save pmu name

On Thu, Mar 11, 2021 at 03:07:19PM +0800, Jin Yao wrote:
> On hybrid platform, one event is available on one pmu
> (such as, available on cpu_core or on cpu_atom).
> 
> This patch saves the pmu name to the pmu field of struct perf_pmu_alias.
> Then next we can know the pmu which the event can be available on.
> 
> Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
> ---
>  tools/perf/util/pmu.c | 10 +++++++++-
>  tools/perf/util/pmu.h |  1 +
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 54e586bf19a5..45d8db1af8d2 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -283,6 +283,7 @@ void perf_pmu_free_alias(struct perf_pmu_alias *newalias)
>  	zfree(&newalias->str);
>  	zfree(&newalias->metric_expr);
>  	zfree(&newalias->metric_name);
> +	zfree(&newalias->pmu);
>  	parse_events_terms__purge(&newalias->terms);
>  	free(newalias);
>  }
> @@ -297,6 +298,10 @@ static bool perf_pmu_merge_alias(struct perf_pmu_alias *newalias,
>  
>  	list_for_each_entry(a, alist, list) {
>  		if (!strcasecmp(newalias->name, a->name)) {
> +			if (newalias->pmu && a->pmu &&
> +			    !strcasecmp(newalias->pmu, a->pmu)) {
> +				continue;
> +			}
>  			perf_pmu_update_alias(a, newalias);
>  			perf_pmu_free_alias(newalias);
>  			return true;
> @@ -314,7 +319,8 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,
>  	int num;
>  	char newval[256];
>  	char *long_desc = NULL, *topic = NULL, *unit = NULL, *perpkg = NULL,
> -	     *metric_expr = NULL, *metric_name = NULL, *deprecated = NULL;
> +	     *metric_expr = NULL, *metric_name = NULL, *deprecated = NULL,
> +	     *pmu = NULL;
>  
>  	if (pe) {
>  		long_desc = (char *)pe->long_desc;
> @@ -324,6 +330,7 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,
>  		metric_expr = (char *)pe->metric_expr;
>  		metric_name = (char *)pe->metric_name;
>  		deprecated = (char *)pe->deprecated;
> +		pmu = (char *)pe->pmu;
>  	}
>  
>  	alias = malloc(sizeof(*alias));
> @@ -389,6 +396,7 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,
>  	}
>  	alias->per_pkg = perpkg && sscanf(perpkg, "%d", &num) == 1 && num == 1;
>  	alias->str = strdup(newval);
> +	alias->pmu = pmu ? strdup(pmu) : NULL;
>  
>  	if (deprecated)
>  		alias->deprecated = true;
> diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
> index 8164388478c6..0e724d5b84c6 100644
> --- a/tools/perf/util/pmu.h
> +++ b/tools/perf/util/pmu.h
> @@ -72,6 +72,7 @@ struct perf_pmu_alias {
>  	bool deprecated;
>  	char *metric_expr;
>  	char *metric_name;
> +	char *pmu;

please use pmu_name

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ