[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1463658462-85131-7-git-send-email-hekuang@huawei.com>
Date: Thu, 19 May 2016 11:47:42 +0000
From: He Kuang <hekuang@...wei.com>
To: <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<alexander.shishkin@...ux.intel.com>, <jolsa@...hat.com>,
<wangnan0@...wei.com>, <hekuang@...wei.com>, <jpoimboe@...hat.com>,
<ak@...ux.intel.com>, <eranian@...gle.com>, <namhyung@...nel.org>,
<adrian.hunter@...el.com>, <sukadev@...ux.vnet.ibm.com>,
<masami.hiramatsu.pt@...achi.com>, <tumanova@...ux.vnet.ibm.com>,
<kan.liang@...el.com>, <penberg@...nel.org>, <dsahern@...il.com>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH v4 6/6] perf callchain: Support aarch64 cross-platform
Support aarch64 cross platform callchain unwind.
Signed-off-by: He Kuang <hekuang@...wei.com>
---
.../perf/arch/arm64/include/libunwind/libunwind-arch.h | 18 ++++++++++++++++++
tools/perf/arch/arm64/util/unwind-libunwind.c | 5 ++++-
tools/perf/config/Makefile | 12 ++++++++++++
tools/perf/util/Build | 4 ++++
tools/perf/util/unwind-libunwind_common.c | 10 ++++++++++
tools/perf/util/unwind.h | 3 +++
6 files changed, 51 insertions(+), 1 deletion(-)
create mode 100644 tools/perf/arch/arm64/include/libunwind/libunwind-arch.h
diff --git a/tools/perf/arch/arm64/include/libunwind/libunwind-arch.h b/tools/perf/arch/arm64/include/libunwind/libunwind-arch.h
new file mode 100644
index 0000000..7bc8a00
--- /dev/null
+++ b/tools/perf/arch/arm64/include/libunwind/libunwind-arch.h
@@ -0,0 +1,18 @@
+#ifndef _LIBUNWIND_ARCH_H
+#define _LIBUNWIND_ARCH_H
+
+#include <libunwind-aarch64.h>
+#include <../perf_regs.h>
+#include <../../../../../../arch/arm64/include/uapi/asm/perf_regs.h>
+
+#define LIBUNWIND_AARCH64
+int libunwind__aarch64_reg_id(int regnum);
+
+#include <../../../arm64/util/unwind-libunwind.c>
+
+#define LIBUNWIND__ARCH_REG_ID libunwind__aarch64_reg_id
+
+#define UNWT_PREFIX UNW_PASTE(UNW_PASTE(_U, aarch64), _)
+#define UNWT_OBJ(fn) UNW_PASTE(UNWT_PREFIX, fn)
+
+#endif /* _LIBUNWIND_ARCH_H */
diff --git a/tools/perf/arch/arm64/util/unwind-libunwind.c b/tools/perf/arch/arm64/util/unwind-libunwind.c
index a87afa9..5b557a5 100644
--- a/tools/perf/arch/arm64/util/unwind-libunwind.c
+++ b/tools/perf/arch/arm64/util/unwind-libunwind.c
@@ -1,11 +1,14 @@
#include <errno.h>
-#include <libunwind.h>
#include "perf_regs.h"
#include "../../util/unwind.h"
#include "../../util/debug.h"
+#ifndef LIBUNWIND_AARCH64
int libunwind__arch_reg_id(int regnum)
+#else
+int libunwind__aarch64_reg_id(int regnum)
+#endif
{
switch (regnum) {
case UNW_AARCH64_X0:
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 3035dbf..d3b77d8 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -353,6 +353,18 @@ ifndef NO_LIBUNWIND
have_libunwind = 1
endif
+ ifeq ($(feature-libunwind-aarch64), 1)
+ $(call detected,CONFIG_LIBUNWIND_AARCH64)
+ CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
+ LDFLAGS += -lunwind -lunwind-aarch64
+ have_libunwind = 1
+ $(call feature_check,libunwind-debug-frame-aarch64)
+ ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
+ msg := $(warning No debug_frame support found in libunwind-aarch64);
+ CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
+ endif
+ endif
+
ifneq ($(feature-libunwind), 1)
msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
NO_LOCAL_LIBUNWIND := 1
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 2373130..f1b51a2 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -104,10 +104,14 @@ libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
libperf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
libperf-$(CONFIG_LIBUNWIND) += unwind-libunwind_common.o
libperf-$(CONFIG_LIBUNWIND_X86) += unwind-libunwind_x86_32.o
+libperf-$(CONFIG_LIBUNWIND_AARCH64) += unwind-libunwind_arm64.o
$(OUTPUT)util/unwind-libunwind_x86_32.o: util/unwind-libunwind.c arch/x86/util/unwind-libunwind.c
$(QUIET_CC)$(CC) $(CFLAGS) -DREMOTE_UNWIND_LIBUNWIND -Iarch/x86/include/libunwind -c -o $@ util/unwind-libunwind.c
+$(OUTPUT)util/unwind-libunwind_arm64.o: util/unwind-libunwind.c arch/arm64/util/unwind-libunwind.c
+ $(QUIET_CC)$(CC) $(CFLAGS) -DREMOTE_UNWIND_LIBUNWIND -Iarch/arm64/include/libunwind -c -o $@ util/unwind-libunwind.c
+
libperf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
libperf-y += scripting-engines/
diff --git a/tools/perf/util/unwind-libunwind_common.c b/tools/perf/util/unwind-libunwind_common.c
index 619c6c0..d19b062 100644
--- a/tools/perf/util/unwind-libunwind_common.c
+++ b/tools/perf/util/unwind-libunwind_common.c
@@ -89,6 +89,16 @@ void unwind__get_arch(struct thread *thread, struct map *map)
#endif
use_local_unwind = 0;
}
+ } else if (!strcmp(arch, "arm64") || !strcmp(arch, "arm")) {
+ if (dso_type == DSO__TYPE_64BIT) {
+#ifdef HAVE_LIBUNWIND_AARCH64_SUPPORT
+ register_unwind_libunwind_ops(
+ &_Uaarch64_unwind_libunwind_ops, thread);
+#else
+ register_null_unwind_libunwind_ops(thread);
+#endif
+ use_local_unwind = 0;
+ }
}
if (use_local_unwind)
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index 73f4bd9..9748c36 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -55,6 +55,9 @@ register_null_unwind_libunwind_ops(struct thread *thread __maybe_unused) {}
#ifdef HAVE_LIBUNWIND_X86_SUPPORT
extern struct unwind_libunwind_ops _Ux86_unwind_libunwind_ops;
#endif
+#ifdef HAVE_LIBUNWIND_AARCH64_SUPPORT
+extern struct unwind_libunwind_ops _Uaarch64_unwind_libunwind_ops;
+#endif
#else
static inline int
--
1.8.5.2
Powered by blists - more mailing lists