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: <YaO1FIOYpF/Y5BDK@krava>
Date:   Sun, 28 Nov 2021 17:57:56 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        eranian@...gle.com
Subject: Re: [PATCH 2/2] perf evsel: Improve error message for uncore events

On Mon, Nov 22, 2021 at 06:03:41PM -0800, Ian Rogers wrote:
> When a group has multiple events and the leader fails it can yield
> errors like:
> 
> $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true
> Error:
> The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_imc/cas_count_read/).
> /bin/dmesg | grep -i perf may provide additional information.
> 
> However, when not the group leader <not supported> is given:
> 
> $ perf stat -e '{instructions,uncore_imc/cas_count_read/}' /bin/true
> ...
>          1,619,057      instructions
>    <not supported> MiB  uncore_imc/cas_count_read/
> 
> This is necessary because get_group_fd will fail if the leader fails and
> is the direct result of the check on line 750 of builtin-stat.c in
> stat_handle_error that returns COUNTER_SKIP for the latter case.
> 
> This patch improves the error message to:
> 
> $ perf stat -e '{uncore_imc/cas_count_read/},instructions' /bin/true
> Error:
> Invalid event (uncore_imc/cas_count_read/) in per-thread mode, enable system wide with '-a'.
> 
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
>  tools/perf/util/evsel.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index a59fb2ecb84e..48696ff4bddb 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -2950,6 +2950,11 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
>  			return scnprintf(msg, size, "wrong clockid (%d).", clockid);
>  		if (perf_missing_features.aux_output)
>  			return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel.");
> +		if ((evsel__leader(evsel) == evsel) &&
> +		    (evsel->core.leader->nr_members > 1))
> +			return scnprintf(msg, size,
> +	"Invalid event (%s) in per-thread mode, enable system wide with '-a'.",
> +					evsel__name(evsel));

should we rather check 'target' pointer for the per-thread mode?
I'm not sure that per-thread mode will always be the case for the failure

jirka

>  		break;
>  	case ENODATA:
>  		return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. "
> -- 
> 2.34.0.rc2.393.gf8c9666880-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ