[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1612391826-27714-1-git-send-email-kan.liang@linux.intel.com>
Date: Wed, 3 Feb 2021 14:37:06 -0800
From: kan.liang@...ux.intel.com
To: acme@...nel.org, linux-kernel@...r.kernel.org
Cc: mingo@...nel.org, peterz@...radead.org, eranian@...gle.com,
namhyung@...nel.org, jolsa@...hat.com, ak@...ux.intel.com,
yao.jin@...ux.intel.com, Kan Liang <kan.liang@...ux.intel.com>
Subject: [PATCH] perf evsel: Add a check in the error path for the auxiliary event
From: Kan Liang <kan.liang@...ux.intel.com>
Current perf assumes that the ENODATA is a unique error code for the
auxiliary event on Sapphire Rapids. The assumption is good for now, but
this is fragile. In the future, someone may not remember that the
ENODATA is for the auxiliary event on Sapphire Rapids, and reuse it for
other purposes. The error message for the auxiliary event may be
mistakenly displayed.
Add a check to identify the auxiliary event case.
Suggested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
---
tools/perf/util/evsel.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 844aebd..30b5452 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -48,6 +48,7 @@
#include "util.h"
#include "../perf-sys.h"
#include "util/parse-branch-options.h"
+#include "pmu.h"
#include <internal/xyarray.h>
#include <internal/lib.h>
@@ -2735,8 +2736,10 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
return scnprintf(msg, size, "The 'aux_output' feature is not supported, update the kernel.");
break;
case ENODATA:
- return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. "
- "Please add an auxiliary event in front of the load latency event.");
+ if (evsel->core.attr.sample_type & PERF_SAMPLE_DATA_SRC && pmu_have_event("cpu", "mem-loads-aux")) {
+ return scnprintf(msg, size, "Cannot collect data source with the load latency event alone. "
+ "Please add an auxiliary event in front of the load latency event.");
+ }
default:
break;
}
--
2.7.4
Powered by blists - more mailing lists