[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210602103007.184993-9-leo.yan@linaro.org>
Date: Wed, 2 Jun 2021 18:30:07 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org
Cc: Leo Yan <leo.yan@...aro.org>
Subject: [PATCH v2 8/8] perf record: Directly bail out for compat case
Since the 64-bit atomicity is not promised in 32-bit perf, directly
report the error and bail out for this case.
Now only applies on x86_64 and Arm64 platforms.
Suggested-by: Adrian Hunter <adrian.hunter@...el.com>
Signed-off-by: Leo Yan <leo.yan@...aro.org>
---
tools/perf/builtin-record.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3337b5f93336..f47e298281f7 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -74,6 +74,7 @@
#include <linux/zalloc.h>
#include <linux/bitmap.h>
#include <sys/time.h>
+#include <sys/utsname.h>
struct switch_output {
bool enabled;
@@ -848,6 +849,22 @@ static int record__mmap_evlist(struct record *rec,
opts->auxtrace_sample_mode;
char msg[512];
+#ifndef __LP64__
+ struct utsname uts;
+ int ret;
+
+ ret = uname(&uts);
+ if (ret < 0)
+ return ret;
+
+ if (!strncmp(uts.machine, "x86_64", 6) || !strncmp(uts.machine, "aarch64", 7) ||
+ !strncmp(uts.machine, "arm64", 5)) {
+ pr_err("Error, 32-bit perf cannot record from a 64-bit kernel.\n"
+ "Please use a 64-bit version of perf instead.\n");
+ return -ENOTSUP;
+ }
+#endif
+
if (opts->affinity != PERF_AFFINITY_SYS)
cpu__setup_cpunode_map();
--
2.25.1
Powered by blists - more mailing lists