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: <ZQC5mmDtasr5/vDH@kernel.org>
Date:   Tue, 12 Sep 2023 16:18:50 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Thomas Richter <tmricht@...ux.ibm.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Zhengjun Xing <zhengjun.xing@...ux.intel.com>,
        Kang Minchul <tegongkang@...il.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/2] perf list: Avoid a hardcoded cpu PMU name

Em Wed, Sep 06, 2023 at 04:44:15PM -0700, Ian Rogers escreveu:
> Use the first core PMU instead.
> 
> On a Raspberry Pi, before:
> ```
> $ perf list
> ...
>   cpu/t1=v1[,t2=v2,t3 ...]/modifier                  [Raw hardware event descriptor]
>        [(see 'man perf-list' on how to encode it)]
> ...
> ```
> After:
> ```
> 
> $ perf list
> ...
>   armv8_cortex_a72/t1=v1[,t2=v2,t3 ...]/modifier     [Raw hardware event descriptor]
>        [(see 'man perf-list' on how to encode it)]
> ...
> ```

Thanks, applied the two patches.

- Arnaldo

 
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
>  tools/perf/util/print-events.c | 28 +++++++++++++++++-----------
>  1 file changed, 17 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/perf/util/print-events.c b/tools/perf/util/print-events.c
> index a7566edc86a3..b0fc48be623f 100644
> --- a/tools/perf/util/print-events.c
> +++ b/tools/perf/util/print-events.c
> @@ -395,6 +395,8 @@ void print_symbol_events(const struct print_callbacks *print_cb, void *print_sta
>   */
>  void print_events(const struct print_callbacks *print_cb, void *print_state)
>  {
> +	char *tmp;
> +
>  	print_symbol_events(print_cb, print_state, PERF_TYPE_HARDWARE,
>  			event_symbols_hw, PERF_COUNT_HW_MAX);
>  	print_symbol_events(print_cb, print_state, PERF_TYPE_SOFTWARE,
> @@ -418,17 +420,21 @@ void print_events(const struct print_callbacks *print_cb, void *print_state)
>  			/*long_desc=*/NULL,
>  			/*encoding_desc=*/NULL);
>  
> -	print_cb->print_event(print_state,
> -			/*topic=*/NULL,
> -			/*pmu_name=*/NULL,
> -			"cpu/t1=v1[,t2=v2,t3 ...]/modifier",
> -			/*event_alias=*/NULL,
> -			/*scale_unit=*/NULL,
> -			/*deprecated=*/false,
> -			event_type_descriptors[PERF_TYPE_RAW],
> -			"(see 'man perf-list' on how to encode it)",
> -			/*long_desc=*/NULL,
> -			/*encoding_desc=*/NULL);
> +	if (asprintf(&tmp, "%s/t1=v1[,t2=v2,t3 ...]/modifier",
> +		     perf_pmus__scan_core(/*pmu=*/NULL)->name) > 0) {
> +		print_cb->print_event(print_state,
> +				/*topic=*/NULL,
> +				/*pmu_name=*/NULL,
> +				tmp,
> +				/*event_alias=*/NULL,
> +				/*scale_unit=*/NULL,
> +				/*deprecated=*/false,
> +				event_type_descriptors[PERF_TYPE_RAW],
> +				"(see 'man perf-list' on how to encode it)",
> +				/*long_desc=*/NULL,
> +				/*encoding_desc=*/NULL);
> +		free(tmp);
> +	}
>  
>  	print_cb->print_event(print_state,
>  			/*topic=*/NULL,
> -- 
> 2.42.0.283.g2d96d420d3-goog
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ