Messages in this thread Patch in this message | | | From | Leo Yan <> | Subject | [PATCH v2 8/8] perf record: Directly bail out for compat case | Date | Wed, 2 Jun 2021 18:30:07 +0800 |
| |
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@intel.com> Signed-off-by: Leo Yan <leo.yan@linaro.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
| |