Mamatha Inamdar f03eae644d powerpc tools perf: Initialize error code in auxtrace_record_init function
JIRA: https://issues.redhat.com/browse/RHEL-53366

commit 789d22d77879eabb042627f6627cdb62787bc142
Author: Athira Rajeev <atrajeev@linux.ibm.com>
Date:   Mon May 4 20:43:20 2026 +0530

    powerpc tools perf: Initialize error code in auxtrace_record_init function

    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: 1dbfaf94cf66ec4b ("perf powerpc: Add basic CONFIG_AUXTRACE support for VPA pmu on powerpc")
    Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
    Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
    Acked-by: Namhyung Kim <namhyung@kernel.org>
    Cc: Athira Rajeev <atrajeev@linux.ibm.com>
    Cc: Hari Bathini <hbathini@linux.vnet.ibm.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
    Cc: Michael Petlan <mpetlan@redhat.com>
    Cc: Shivani Nittor <shivani@linux.ibm.com>
    Cc: Tanushree Shah <tanushree.shah@ibm.com>
    Cc: Tejas Manhas <tejas.manhas1@ibm.com>
    Cc: Thomas Richter <tmricht@linux.ibm.com>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Mamatha Inamdar <minamdar@redhat.com>
2026-07-07 01:06:42 -04:00
2026-07-02 08:11:35 +00:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.
S
Description
No description provided
Readme
2.8 GiB
Languages
C 97.6%
Assembly 1%
Shell 0.5%
Python 0.3%
Makefile 0.3%
Other 0.1%