From: James Clark <james.clark@linaro.org>
To: Levi Yun <yeoreum.yun@arm.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
nd@arm.com, 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, asmadeus@codewreck.org
Subject: Re: [PATCH v3 2/2] perf stat: Stop repeating when ref_perf_stat() returns -1
Date: Fri, 13 Sep 2024 14:49:24 +0100 [thread overview]
Message-ID: <d6df6edd-688d-403d-8006-491e302fd042@linaro.org> (raw)
In-Reply-To: <20240913101456.633819-3-yeoreum.yun@arm.com>
On 13/09/2024 11:14, 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 | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 954eb37ce7b8..d25528ea7e40 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -2875,7 +2875,19 @@ 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) {
> +
> + /*
> + * Returns -1 for fatal errors which signifies to not continue
> + * when in repeat mode.
> + *
> + * Returns < -1 error codes when stat record is used. These
> + * result in the stat information being displayed, but writing
> + * to the file fails and is non fatal.
> + */
I meant this to be a function doc above the run_perf_stat() function.
Usually what a function returns would be documented there, in case there
end up being multiple callers.
With that change:
Reviewed-by: James Clark <james.clark@linaro.org>
Also I think something happened with the cover letter as well, it's
marked as V2.
next prev parent reply other threads:[~2024-09-13 13:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 10:14 [PATCH v2 0/2] Minor fixes error handling of perf stat Levi Yun
2024-09-13 10:14 ` [PATCH v3 1/2] perf stat: Close cork_fd when create_perf_stat_counter() failed Levi Yun
2024-09-13 10:14 ` [PATCH v3 2/2] perf stat: Stop repeating when ref_perf_stat() returns -1 Levi Yun
2024-09-13 13:49 ` James Clark [this message]
2024-09-13 13:56 ` 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=d6df6edd-688d-403d-8006-491e302fd042@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=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).