@@ -4,6 +4,7 @@ libperf-y += pmu.o
libperf-y += kvm-stat.o
libperf-y += perf_regs.o
libperf-y += group.o
+libperf-y += evsel.o
libperf-$(CONFIG_DWARF) += dwarf-regs.o
libperf-$(CONFIG_BPF_PROLOGUE) += dwarf-regs.o
new file mode 100644
@@ -0,0 +1,24 @@
+#include <string.h>
+
+#include <linux/perf_event.h>
+#include <linux/err.h>
+
+#include "../../util/evsel.h"
+
+int perf_evsel__open_strerror_arch(struct perf_evsel *evsel,
+ struct target *target __maybe_unused,
+ int err, char *msg, size_t size)
+{
+ switch (err) {
+ case EOPNOTSUPP:
+ if (evsel->attr.type == PERF_TYPE_HARDWARE)
+ return scnprintf(msg, size, "%s",
+ "No hardware sampling interrupt available.\n"
+ "No APIC? If so then you can boot the kernel with the \"lapic\" boot parameter to force-enable it.");
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
@@ -2686,8 +2686,18 @@ static bool find_process(const char *name)
return ret ? false : true;
}
-int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
- int err, char *msg, size_t size)
+int __weak perf_evsel__open_strerror_arch(struct perf_evsel *evsel __maybe_unused,
+ struct target *target __maybe_unused,
+ int err __maybe_unused,
+ char *msg __maybe_unused,
+ size_t size __maybe_unused)
+{
+ return 0;
+}
+
+static int __perf_evsel__open_strerror(struct perf_evsel *evsel,
+ struct target *target,
+ int err, char *msg, size_t size)
{
char sbuf[STRERR_BUFSIZE];
int printed = 0;
@@ -2745,12 +2755,6 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
if (evsel->attr.precise_ip)
return scnprintf(msg, size, "%s",
"\'precise\' request may not be supported. Try removing 'p' modifier.");
-#if defined(__i386__) || defined(__x86_64__)
- if (evsel->attr.type == PERF_TYPE_HARDWARE)
- return scnprintf(msg, size, "%s",
- "No hardware sampling interrupt available.\n"
- "No APIC? If so then you can boot the kernel with the \"lapic\" boot parameter to force-enable it.");
-#endif
break;
case EBUSY:
if (find_process("oprofiled"))
@@ -2778,6 +2782,18 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
perf_evsel__name(evsel));
}
+int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
+ int err, char *msg, size_t size)
+{
+ int printed;
+
+ printed = perf_evsel__open_strerror_arch(evsel, target, err, msg, size);
+ if (printed)
+ return printed;
+
+ return __perf_evsel__open_strerror(evsel, target, err, msg, size);
+}
+
char *perf_evsel__env_arch(struct perf_evsel *evsel)
{
if (evsel && evsel->evlist && evsel->evlist->env)
@@ -416,6 +416,8 @@ bool perf_evsel__fallback(struct perf_evsel *evsel, int err,
char *msg, size_t msgsize);
int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
int err, char *msg, size_t size);
+int perf_evsel__open_strerror_arch(struct perf_evsel *evsel, struct target *target,
+ int err, char *msg, size_t size);
static inline int perf_evsel__group_idx(struct perf_evsel *evsel)
{