From: Adrian Hunter <adrian.hunter@intel.com>
To: Athira Rajeev <atrajeev@linux.ibm.com>, <acme@kernel.org>,
<jolsa@kernel.org>, <mpetlan@redhat.com>, <tmricht@linux.ibm.com>,
<maddy@linux.ibm.com>, <irogers@google.com>,
<namhyung@kernel.org>
Cc: <linux-perf-users@vger.kernel.org>,
<linuxppc-dev@lists.ozlabs.org>, <hbathini@linux.vnet.ibm.com>,
<Tejas.Manhas1@ibm.com>, <Tanushree.Shah@ibm.com>,
<shivani@linux.ibm.com>
Subject: Re: [PATCH V4 1/2] powerpc tools perf: Initialize error code in auxtrace_record_init function
Date: Mon, 4 May 2026 08:14:56 +0300 [thread overview]
Message-ID: <712411ec-80af-4ac1-a27d-10866340bfe9@intel.com> (raw)
In-Reply-To: <20260502143237.23456-1-atrajeev@linux.ibm.com>
On 02/05/2026 17:32, Athira Rajeev wrote:
> perf trace record fails some cases in powerpc
>
> # ./perf test "perf trace record and replay"
> 128: perf trace record and replay : FAILED!
>
> # ./perf trace record sleep 1
> # echo $?
> 32
>
> This is happening because of non-zero err value from
> auxtrace_record__init() function.
>
> static int record__auxtrace_init(struct record *rec)
> {
> int err;
>
> if ((rec->opts.auxtrace_snapshot_opts || rec->opts.auxtrace_sample_opts)
> && record__threads_enabled(rec)) {
> pr_err("AUX area tracing options are not available in parallel streaming mode.\n");
> return -EINVAL;
> }
>
> if (!rec->itr) {
> rec->itr = auxtrace_record__init(rec->evlist, &err);
> if (err)
> return err;
> }
>
> Here "int err" is not initialised. The code expects "err" to be set
> from auxtrace_record__init() function.
>
> Update auxtrace_record__init() in arch/powerpc/util/auxtrace.c to clear
> err value in the beginning.
>
> - Clear err value in beginning of function. Any fail later will
> set appropriate return code to err.
> - Even if we haven't found any event for auxtrace, perf record
> should continue for other events. NULL return
> will indicate that there is no auxtrace record initialized.
> - Not having "err" set here will affect monitoring of other events
> also because perf record will fail seeing random value in err.
>
> Set err to -EINVAL before invoking auxtrace_record__init() in
> builtin-record.c
>
> With the fix,
>
> # ./perf trace record sleep 1
> [ perf record: Woken up 2 times to write data ]
> [ perf record: Captured and wrote 0.033 MB perf.data (228 samples) ]
>
> Fixes: 1dbfaf94cf66 ("perf powerpc: Add basic CONFIG_AUXTRACE support for VPA pmu on powerpc")
> Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> Changelog:
> v1 -> v2
> Addressed review comment from Adrian:
> - Set err to -EINVAL before invoking auxtrace_record__init() in
> builtin-record.c
> - Added kernel-doc to auxtrace_record__init() in tools/perf/util/auxtrace.c
> Addressed review comment from Namhyung:
> - Added fixes tag
>
> tools/perf/arch/powerpc/util/auxtrace.c | 6 ++++++
> tools/perf/builtin-record.c | 1 +
> 2 files changed, 7 insertions(+)
>
> diff --git a/tools/perf/arch/powerpc/util/auxtrace.c b/tools/perf/arch/powerpc/util/auxtrace.c
> index e39deff6c857..4600a1661b4f 100644
> --- a/tools/perf/arch/powerpc/util/auxtrace.c
> +++ b/tools/perf/arch/powerpc/util/auxtrace.c
> @@ -71,6 +71,12 @@ struct auxtrace_record *auxtrace_record__init(struct evlist *evlist,
> struct evsel *pos;
> int found = 0;
>
> + /*
> + * Set err value to zero here. Any fail later
> + * will set appropriate return code to err.
> + */
> + *err = 0;
> +
> evlist__for_each_entry(evlist, pos) {
> if (strstarts(pos->name, "vpa_dtl")) {
> found = 1;
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 4a5eba498c02..708825747af5 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -865,6 +865,7 @@ static int record__auxtrace_init(struct record *rec)
> }
>
> if (!rec->itr) {
> + err = -EINVAL;
> rec->itr = auxtrace_record__init(rec->evlist, &err);
> if (err)
> return err;
prev parent reply other threads:[~2026-05-04 5:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-02 14:32 [PATCH V4 1/2] powerpc tools perf: Initialize error code in auxtrace_record_init function Athira Rajeev
2026-05-02 14:32 ` [PATCH V4 2/2] tools/perf: Add kernel-doc comment to auxtrace_record__init() function Athira Rajeev
2026-05-04 1:46 ` Namhyung Kim
2026-05-04 4:16 ` Athira Rajeev
2026-05-04 5:14 ` Adrian Hunter [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=712411ec-80af-4ac1-a27d-10866340bfe9@intel.com \
--to=adrian.hunter@intel.com \
--cc=Tanushree.Shah@ibm.com \
--cc=Tejas.Manhas1@ibm.com \
--cc=acme@kernel.org \
--cc=atrajeev@linux.ibm.com \
--cc=hbathini@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpetlan@redhat.com \
--cc=namhyung@kernel.org \
--cc=shivani@linux.ibm.com \
--cc=tmricht@linux.ibm.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