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,
irogers@google.com, asmadeus@codewreck.org
Subject: Re: [PATCH RESEND 2/2] perf stat: Stop repeating when ref_perf_stat() returns -1
Date: Wed, 11 Sep 2024 14:20:09 +0100 [thread overview]
Message-ID: <586cc208-faee-4b76-bd9b-180ac06a0a92@linaro.org> (raw)
In-Reply-To: <20240911121919.4167483-3-yeoreum.yun@arm.com>
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@arm.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
prev parent reply other threads:[~2024-09-11 13:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-11 12:19 [PATCH RESEND 0/2] Minor fixes error handling of perf stat Levi Yun
2024-09-11 12:19 ` [PATCH RESEND 1/2] perf stat: Close cork_fd when create_perf_stat_counter() failed Levi Yun
2024-09-11 13:02 ` James Clark
2024-09-11 12:19 ` [PATCH RESEND 2/2] perf stat: Stop repeating when ref_perf_stat() returns -1 Levi Yun
2024-09-11 13:20 ` James Clark [this message]
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=586cc208-faee-4b76-bd9b-180ac06a0a92@linaro.org \
--to=james.clark@linaro.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=asmadeus@codewreck.org \
--cc=irogers@google.com \
--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).