Re: [PATCH 2/9] perf tools: Support the auxiliary event

From: Liang, Kan
Date: Wed Feb 03 2021 - 16:22:46 EST




On 2/3/2021 3:02 PM, Arnaldo Carvalho de Melo wrote:
Em Tue, Feb 02, 2021 at 12:09:06PM -0800,kan.liang@xxxxxxxxxxxxxxx escreveu:
From: Kan Liang<kan.liang@xxxxxxxxxxxxxxx>
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index c26ea822..c48f6de 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2689,6 +2689,9 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
if (perf_missing_features.aux_output)
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.");
Are you sure this is the only case where ENODATA comes out from
perf_event_open()? Well, according to your comment in:

61b985e3e775a3a7 ("perf/x86/intel: Add perf core PMU support for Sapphire Rapids")

It should be at that point in time, so its safe to merge as-is, but then
I think this is fragile, what if someone else, in the future, not
knowing that ENODATA is supposed to be used only with that ancient CPU,
Sapphire Rapids, uses it?:-)

Please consider adding a check before assuming ENODATA is for this
specific case.

Sure, I will add a check in V2.

Thanks,
Kan