From: James Clark <james.clark@linaro.org>
To: Levi Yun <yeoreum.yun@arm.com>
Cc: nd@arm.com, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@redhat.com, acme@kernel.org, namhyung@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
asmadeus@codewreck.org
Subject: Re: [PATCH v2 2/2] perf stat: Stop repeating when ref_perf_stat() returns -1
Date: Fri, 13 Sep 2024 09:36:54 +0100 [thread overview]
Message-ID: <39eafc82-dfa8-4e22-9d8a-071ed09460d3@linaro.org> (raw)
In-Reply-To: <20240913020209.520104-3-yeoreum.yun@arm.com>
On 13/09/2024 03:02, 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@arm.com>
> ---
> Changes in v2:
> - Add some comments.
> ---
> tools/perf/builtin-stat.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 954eb37ce7b8..0153925f2382 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -2875,7 +2875,15 @@ 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) {
> + /*
> + * * Meet COUNTER_FATAL situation (i.e) can't open event counter.
> + * * In this case, there is a high chance of failure in the next attempt
> + * * as well with the same reason. so, stop it.
> + * */
There's something wrong with the formatting here.
But I don't think the comment answers my question about the other return
codes. It just states what the code does.
There are many more return -1's than just for COUNTER_FATAL, so it's not
just that situation anyway. And in addition to that, there is -ENOMEM
and others that aren't -1 which aren't explained that they are
deliberately explicit retry or ignores.
> + if (status == -1)
> + break;
> +
> + if (forever && !interval) {
> print_counters(NULL, argc, argv);
> perf_stat__reset_stats();
> }
> --
> LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
>
next prev parent reply other threads:[~2024-09-13 8:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 2:02 [PATCH v2 0/2] Minor fixes error handling of perf stat Levi Yun
2024-09-13 2:02 ` [PATCH v2 1/2] perf stat: Close cork_fd when create_perf_stat_counter() failed Levi Yun
2024-09-13 2:02 ` [PATCH v2 2/2] perf stat: Stop repeating when ref_perf_stat() returns -1 Levi Yun
2024-09-13 8:36 ` James Clark [this message]
2024-09-13 8:45 ` James Clark
2024-09-13 9:15 ` Yeo Reum Yun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=39eafc82-dfa8-4e22-9d8a-071ed09460d3@linaro.org \
--to=james.clark@linaro.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=asmadeus@codewreck.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=nd@arm.com \
--cc=peterz@infradead.org \
--cc=yeoreum.yun@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).