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]
Date:   Wed, 21 Apr 2021 20:29:46 +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 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?

>  };
>  
>  /*
> @@ -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


> +		}
> +
>  		if (target__has_cpu(&target))
>  			default_attrs0[0].config = PERF_COUNT_SW_CPU_CLOCK;

also you still want this change for hybrid pmus as well

thanks,
jirka

>  
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ