perf cs-etm: Print unknown header version as an error
authorJames Clark <james.clark@arm.com>
Mon, 12 Dec 2022 15:55:09 +0000 (15:55 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 14 Dec 2022 14:24:31 +0000 (11:24 -0300)
This is an error rather than just for the raw trace dump so always print
it as an error. Also remove the duplicate header version check.

Signed-off-by: James Clark <james.clark@arm.com>
Cc: Al Grant <Al.Grant@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20221212155513.2259623-2-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/cs-etm.c

index 16db965..aeb1e30 100644 (file)
@@ -2623,14 +2623,7 @@ static void cs_etm__print_auxtrace_info(__u64 *val, int num)
 {
        int i, cpu = 0, version, err;
 
-       /* bail out early on bad header version */
        version = val[0];
-       if (version > CS_HEADER_CURRENT_VERSION) {
-               /* failure.. return */
-               fprintf(stdout, "       Unknown Header Version = %x, ", version);
-               fprintf(stdout, "Version supported <= %x\n", CS_HEADER_CURRENT_VERSION);
-               return;
-       }
 
        for (i = 0; i < CS_HEADER_VERSION_MAX; i++)
                fprintf(stdout, cs_etm_global_header_fmts[i], val[i]);
@@ -2916,9 +2909,8 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
        /* Look for version of the header */
        hdr_version = ptr[0];
        if (hdr_version > CS_HEADER_CURRENT_VERSION) {
-               /* print routine will print an error on bad version */
-               if (dump_trace)
-                       cs_etm__print_auxtrace_info(auxtrace_info->priv, 0);
+               pr_err("\nCS ETM Trace: Unknown Header Version = %#" PRIx64, hdr_version);
+               pr_err(", version supported <= %x\n", CS_HEADER_CURRENT_VERSION);
                return -EINVAL;
        }