[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <586cc208-faee-4b76-bd9b-180ac06a0a92@linaro.org>
Date: Wed, 11 Sep 2024 14:20:09 +0100
From: James Clark <james.clark@...aro.org>
To: Levi Yun <yeoreum.yun@....com>
Cc: nd@....com, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org, peterz@...radead.org, mingo@...hat.com,
acme@...nel.org, namhyung@...nel.org, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, irogers@...gle.com,
asmadeus@...ewreck.org
Subject: Re: [PATCH RESEND 2/2] perf stat: Stop repeating when ref_perf_stat()
returns -1
On 11/09/2024 13:19, Levi Yun wrote:
> Exit when run_perf_stat() returns an error to avoid continuously
> repeating the same error message. It's not expected that COUNTER_FATAL
> or internal errors are recoverable so there's no point in retrying.
>
> This fixes the following flood of error messages for permission issues,
> for example when perf_event_paranoid==3:
> perf stat -r 1044 -- false
>
> Error:
> Access to performance monitoring and observability operations is limited.
> ...
> Error:
> Access to performance monitoring and observability operations is limited.
> ...
> (repeating for 1044 times).
>
> Signed-off-by: Levi Yun <yeoreum.yun@....com>
> ---
> tools/perf/builtin-stat.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 954eb37ce7b8..18197ded88a7 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -2875,7 +2875,10 @@ int cmd_stat(int argc, const char **argv)
> evlist__reset_prev_raw_counts(evsel_list);
>
> status = run_perf_stat(argc, argv, run_idx);
> - if (forever && status != -1 && !interval) {
> + if (status == -1)
> + break;
Was this "status != -1" here correct? Seems like everything in
run_perf_stat() returns -1 except what's in "if (STAT_RECORD)" for some
reason.
Maybe there is something special about -1, but that feels a bit fragile
and relies on the whole chain to continue to do the right thing. At
least a comment about the relevance of -1 is required, although the
issue might not be introduced by this patch.
James
Powered by blists - more mailing lists