Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428469 > unrolled thread

[PATCH 0/5] Fixes on perf unwind

Started byHe Kuang <hekuang@huawei.com>
First post2016-06-22 09:00 +0200
Last post2016-06-23 15:40 +0200
Articles 10 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/5] Fixes on perf unwind He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
    [PATCH 2/5] perf unwind: Fix wrongly used regs for x86_32 unwind He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
      [tip:perf/core] perf unwind: Fix wrongly used regs for x86_32  unwind tip-bot for He Kuang <tipbot@zytor.com> - 2016-06-26 13:00 +0200
    [PATCH 4/5] perf tools: Let python use correct gcc for build_ext He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
      [tip:perf/core] perf tools: Let python use correct gcc for  build_ext tip-bot for He Kuang <tipbot@zytor.com> - 2016-06-26 13:00 +0200
    [PATCH 1/5] perf unwind: Change macro names of perf register He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
      [tip:perf/core] perf unwind: Change macro names of perf register tip-bot for He Kuang <tipbot@zytor.com> - 2016-06-26 13:00 +0200
    [PATCH 3/5] perf unwind: Fix wrongly used regs for aarch64 unwind He Kuang <hekuang@huawei.com> - 2016-06-22 09:00 +0200
      [tip:perf/core] perf unwind: Fix wrongly used regs for aarch64  unwind tip-bot for He Kuang <tipbot@zytor.com> - 2016-06-26 13:00 +0200
    Re: [PATCH 0/5] Fixes on perf unwind Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-23 15:40 +0200

#1428469 — [PATCH 0/5] Fixes on perf unwind

FromHe Kuang <hekuang@huawei.com>
Date2016-06-22 09:00 +0200
Subject[PATCH 0/5] Fixes on perf unwind
Message-ID<rMKiJ-8pY-1@gated-at.bofh.it>
hi,

Patch 1-3 fix wrongly used PERF_REG_SP/IP by redefining
those macros in the wrapper file according to the target platform, for
example in "util/libunwind/x86_32.c".
The first 3 patches have been acked-by "Jiri Olsa" and not touched.

Patch 4 catches an error on python build_ext build.

Patch 5 fixes a NULL pointer deference which can cause segfault when
the desired dso is not found.

Thank you.

He Kuang (5):
  perf unwind: Change macro names of perf register
  perf unwind: Fix wrongly used regs for x86_32 unwind
  perf unwind: Fix wrongly used regs for aarch64 unwind
  perf tools: Let python use correct gcc for build_ext
  perf tools: Fix NULL pointer deference when vdso not found

 tools/perf/Makefile.perf                 | 3 ++-
 tools/perf/util/libunwind/arm64.c        | 5 +++++
 tools/perf/util/libunwind/x86_32.c       | 6 ++++++
 tools/perf/util/unwind-libunwind-local.c | 6 ++++--
 tools/perf/util/unwind.h                 | 9 +++++++++
 tools/perf/util/vdso.c                   | 2 +-
 6 files changed, 27 insertions(+), 4 deletions(-)

-- 
1.8.5.2

[toc] | [next] | [standalone]


#1428470 — [PATCH 2/5] perf unwind: Fix wrongly used regs for x86_32 unwind

FromHe Kuang <hekuang@huawei.com>
Date2016-06-22 09:00 +0200
Subject[PATCH 2/5] perf unwind: Fix wrongly used regs for x86_32 unwind
Message-ID<rMKiJ-8pY-5@gated-at.bofh.it>
In reply to#1428469
By default, "unwind-libunwind-local.c" gets SP/IP register number
according to the host platform, for remote unwind, we should use
register number for target platform. Fix this by define
LIBUNWIND_ARCH_REG_SP/IP in the wrapper file of x86_32 platform.

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/libunwind/x86_32.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/libunwind/x86_32.c b/tools/perf/util/libunwind/x86_32.c
index d98c17e..957ffff 100644
--- a/tools/perf/util/libunwind/x86_32.c
+++ b/tools/perf/util/libunwind/x86_32.c
@@ -12,7 +12,13 @@
  */
 
 #define REMOTE_UNWIND_LIBUNWIND
+
+/* Define arch specific functions & regs for libunwind, should be
+ * defined before including "unwind.h"
+ */
 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__x86_reg_id(regnum)
+#define LIBUNWIND__ARCH_REG_IP PERF_REG_X86_IP
+#define LIBUNWIND__ARCH_REG_SP PERF_REG_X86_SP
 
 #include "unwind.h"
 #include "debug.h"
-- 
1.8.5.2

[toc] | [prev] | [next] | [standalone]


#1431419 — [tip:perf/core] perf unwind: Fix wrongly used regs for x86_32 unwind

Fromtip-bot for He Kuang <tipbot@zytor.com>
Date2016-06-26 13:00 +0200
Subject[tip:perf/core] perf unwind: Fix wrongly used regs for x86_32 unwind
Message-ID<rOfXk-1Sr-351@gated-at.bofh.it>
In reply to#1428470
Commit-ID:  5dafea097ac65bd01cc86801c399ae41dce79756
Gitweb:     http://git.kernel.org/tip/5dafea097ac65bd01cc86801c399ae41dce79756
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Wed, 22 Jun 2016 06:57:03 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 23 Jun 2016 10:30:21 -0300

perf unwind: Fix wrongly used regs for x86_32 unwind

By default, "unwind-libunwind-local.c" gets SP/IP register number
according to the host platform, for remote unwind, we should use
register number for target platform. Fix this by define
LIBUNWIND_ARCH_REG_SP/IP in the wrapper file of x86_32 platform.

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1466578626-92406-3-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/libunwind/x86_32.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/libunwind/x86_32.c b/tools/perf/util/libunwind/x86_32.c
index d98c17e..957ffff 100644
--- a/tools/perf/util/libunwind/x86_32.c
+++ b/tools/perf/util/libunwind/x86_32.c
@@ -12,7 +12,13 @@
  */
 
 #define REMOTE_UNWIND_LIBUNWIND
+
+/* Define arch specific functions & regs for libunwind, should be
+ * defined before including "unwind.h"
+ */
 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__x86_reg_id(regnum)
+#define LIBUNWIND__ARCH_REG_IP PERF_REG_X86_IP
+#define LIBUNWIND__ARCH_REG_SP PERF_REG_X86_SP
 
 #include "unwind.h"
 #include "debug.h"

[toc] | [prev] | [next] | [standalone]


#1428471 — [PATCH 4/5] perf tools: Let python use correct gcc for build_ext

FromHe Kuang <hekuang@huawei.com>
Date2016-06-22 09:00 +0200
Subject[PATCH 4/5] perf tools: Let python use correct gcc for build_ext
Message-ID<rMKiJ-8pY-9@gated-at.bofh.it>
In reply to#1428469
Currently, python uses host gcc instead of cross-compile gcc in the
last step of compiling build_ext(remove '--quiet' to show verbose):

  cross-gcc ...
  cross-gcc ...
  creating ~/out/python_ext_build/lib
  gcc -pthread -shared -Wl,-z ...

This is wrong but may not cause any errors unless the features detected
by cross-compiler do not match those for host compiler, and causes the
following errors:

  /usr/lib64/gcc/bin/ld: cannot find -lunwind-x86
  collect2: error: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1
  cp: cannot stat ‘~/out/python_ext_build/lib/perf.so’: No such file or directory
  Makefile.perf:257: recipe for target '~/out/python/perf.so' failed
  make[1]: *** [~/out/python/perf.so] Error 1
  Makefile:68: recipe for target 'all' failed
  make: *** [all] Error 2

This issue is also reported and anwsered on stackoverflow.
Link: http://stackoverflow.com/questions/5986256/python-distutils-gcc-path

Signed-off-by: He Kuang <hekuang@huawei.com>
---
 tools/perf/Makefile.perf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index bde8cba..d0a2cb1 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -254,7 +254,8 @@ PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI)
 
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
-	$(QUIET_GEN)CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
+	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
+        CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
 	  $(PYTHON_WORD) util/setup.py \
 	  --quiet build_ext; \
 	mkdir -p $(OUTPUT)python && \
-- 
1.8.5.2

[toc] | [prev] | [next] | [standalone]


#1431410 — [tip:perf/core] perf tools: Let python use correct gcc for build_ext

Fromtip-bot for He Kuang <tipbot@zytor.com>
Date2016-06-26 13:00 +0200
Subject[tip:perf/core] perf tools: Let python use correct gcc for build_ext
Message-ID<rOfXe-1Sr-165@gated-at.bofh.it>
In reply to#1428471
Commit-ID:  48d8d5db4ac454e590ef7d440f456743d6cbaa94
Gitweb:     http://git.kernel.org/tip/48d8d5db4ac454e590ef7d440f456743d6cbaa94
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Wed, 22 Jun 2016 06:57:05 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Jun 2016 16:11:42 -0300

perf tools: Let python use correct gcc for build_ext

Currently, python uses host gcc instead of cross-compile gcc in the last
step of compiling build_ext(remove '--quiet' to show verbose):

  cross-gcc ...
  cross-gcc ...
  creating ~/out/python_ext_build/lib
  gcc -pthread -shared -Wl,-z ...

This is wrong but may not cause any errors unless the features detected
by cross-compiler do not match those for host compiler, and causes the
following errors:

  /usr/lib64/gcc/bin/ld: cannot find -lunwind-x86
  collect2: error: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1
  cp: cannot stat ‘~/out/python_ext_build/lib/perf.so’: No such file or directory
  Makefile.perf:257: recipe for target '~/out/python/perf.so' failed
  make[1]: *** [~/out/python/perf.so] Error 1
  Makefile:68: recipe for target 'all' failed
  make: *** [all] Error 2

This issue is also reported and anwsered on stackoverflow.
Link: http://stackoverflow.com/questions/5986256/python-distutils-gcc-path

Signed-off-by: He Kuang <hekuang@huawei.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1466578626-92406-5-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index bde8cba..d0a2cb1 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -254,7 +254,8 @@ PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI)
 
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
-	$(QUIET_GEN)CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
+	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
+        CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
 	  $(PYTHON_WORD) util/setup.py \
 	  --quiet build_ext; \
 	mkdir -p $(OUTPUT)python && \

[toc] | [prev] | [next] | [standalone]


#1428472 — [PATCH 1/5] perf unwind: Change macro names of perf register

FromHe Kuang <hekuang@huawei.com>
Date2016-06-22 09:00 +0200
Subject[PATCH 1/5] perf unwind: Change macro names of perf register
Message-ID<rMKiK-8pY-23@gated-at.bofh.it>
In reply to#1428469
Use macro name prefixed with "LIBUNWIND_ARCH" for better understanding
that the regs used by callbacks of libunwind are arch specific. The
real regs used should be defined in the wrapper file of
"unwind-libunwind-local.c" for each supported arch.

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/unwind-libunwind-local.c | 6 ++++--
 tools/perf/util/unwind.h                 | 9 +++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index 01c2e86..97c0f8f 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -462,7 +462,8 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
 		return 0;
 	}
 
-	ret = perf_reg_value(&start, &ui->sample->user_regs, PERF_REG_SP);
+	ret = perf_reg_value(&start, &ui->sample->user_regs,
+			     LIBUNWIND__ARCH_REG_SP);
 	if (ret)
 		return ret;
 
@@ -621,7 +622,8 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
 	unw_cursor_t c;
 	int ret, i = 0;
 
-	ret = perf_reg_value(&val, &ui->sample->user_regs, PERF_REG_IP);
+	ret = perf_reg_value(&val, &ui->sample->user_regs,
+			     LIBUNWIND__ARCH_REG_IP);
 	if (ret)
 		return ret;
 
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index b074662..84c6d44 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -32,6 +32,15 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
 #ifndef LIBUNWIND__ARCH_REG_ID
 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arch_reg_id(regnum)
 #endif
+
+#ifndef LIBUNWIND__ARCH_REG_SP
+#define LIBUNWIND__ARCH_REG_SP PERF_REG_SP
+#endif
+
+#ifndef LIBUNWIND__ARCH_REG_IP
+#define LIBUNWIND__ARCH_REG_IP PERF_REG_IP
+#endif
+
 int LIBUNWIND__ARCH_REG_ID(int regnum);
 int unwind__prepare_access(struct thread *thread, struct map *map);
 void unwind__flush_access(struct thread *thread);
-- 
1.8.5.2

[toc] | [prev] | [next] | [standalone]


#1431418 — [tip:perf/core] perf unwind: Change macro names of perf register

Fromtip-bot for He Kuang <tipbot@zytor.com>
Date2016-06-26 13:00 +0200
Subject[tip:perf/core] perf unwind: Change macro names of perf register
Message-ID<rOfXk-1Sr-353@gated-at.bofh.it>
In reply to#1428472
Commit-ID:  78ff1d6d8bf6bb3ee2b3781bbd88355a322435a4
Gitweb:     http://git.kernel.org/tip/78ff1d6d8bf6bb3ee2b3781bbd88355a322435a4
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Wed, 22 Jun 2016 06:57:02 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 23 Jun 2016 10:30:17 -0300

perf unwind: Change macro names of perf register

Use macro name prefixed with "LIBUNWIND_ARCH" for better understanding
that the regs used by callbacks of libunwind are arch specific. The real
regs used should be defined in the wrapper file of
"unwind-libunwind-local.c" for each supported arch.

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1466578626-92406-2-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/unwind-libunwind-local.c | 6 ++++--
 tools/perf/util/unwind.h                 | 9 +++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index 01c2e86..97c0f8f 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -462,7 +462,8 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
 		return 0;
 	}
 
-	ret = perf_reg_value(&start, &ui->sample->user_regs, PERF_REG_SP);
+	ret = perf_reg_value(&start, &ui->sample->user_regs,
+			     LIBUNWIND__ARCH_REG_SP);
 	if (ret)
 		return ret;
 
@@ -621,7 +622,8 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
 	unw_cursor_t c;
 	int ret, i = 0;
 
-	ret = perf_reg_value(&val, &ui->sample->user_regs, PERF_REG_IP);
+	ret = perf_reg_value(&val, &ui->sample->user_regs,
+			     LIBUNWIND__ARCH_REG_IP);
 	if (ret)
 		return ret;
 
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index b074662..84c6d44 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -32,6 +32,15 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
 #ifndef LIBUNWIND__ARCH_REG_ID
 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arch_reg_id(regnum)
 #endif
+
+#ifndef LIBUNWIND__ARCH_REG_SP
+#define LIBUNWIND__ARCH_REG_SP PERF_REG_SP
+#endif
+
+#ifndef LIBUNWIND__ARCH_REG_IP
+#define LIBUNWIND__ARCH_REG_IP PERF_REG_IP
+#endif
+
 int LIBUNWIND__ARCH_REG_ID(int regnum);
 int unwind__prepare_access(struct thread *thread, struct map *map);
 void unwind__flush_access(struct thread *thread);

[toc] | [prev] | [next] | [standalone]


#1428479 — [PATCH 3/5] perf unwind: Fix wrongly used regs for aarch64 unwind

FromHe Kuang <hekuang@huawei.com>
Date2016-06-22 09:00 +0200
Subject[PATCH 3/5] perf unwind: Fix wrongly used regs for aarch64 unwind
Message-ID<rMKiK-8pY-33@gated-at.bofh.it>
In reply to#1428469
By default, "unwind-libunwind-local.c" gets SP/IP register number
according to the host platform, for remote unwind, we should use
register number for target platform. Fix this by define
LIBUNWIND_ARCH_REG_SP/IP in the wrapper file of aarch64 platform.

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/libunwind/arm64.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/util/libunwind/arm64.c b/tools/perf/util/libunwind/arm64.c
index 4fb5395..6559bc5 100644
--- a/tools/perf/util/libunwind/arm64.c
+++ b/tools/perf/util/libunwind/arm64.c
@@ -13,7 +13,12 @@
 
 #define REMOTE_UNWIND_LIBUNWIND
 
+/* Define arch specific functions & regs for libunwind, should be
+ * defined before including "unwind.h"
+ */
 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arm64_reg_id(regnum)
+#define LIBUNWIND__ARCH_REG_IP PERF_REG_ARM64_PC
+#define LIBUNWIND__ARCH_REG_SP PERF_REG_ARM64_SP
 
 #include "unwind.h"
 #include "debug.h"
-- 
1.8.5.2

[toc] | [prev] | [next] | [standalone]


#1431413 — [tip:perf/core] perf unwind: Fix wrongly used regs for aarch64 unwind

Fromtip-bot for He Kuang <tipbot@zytor.com>
Date2016-06-26 13:00 +0200
Subject[tip:perf/core] perf unwind: Fix wrongly used regs for aarch64 unwind
Message-ID<rOfXf-1Sr-171@gated-at.bofh.it>
In reply to#1428479
Commit-ID:  3bd03c9583bfb22cb82eeb09d8445bb79d27ae78
Gitweb:     http://git.kernel.org/tip/3bd03c9583bfb22cb82eeb09d8445bb79d27ae78
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Wed, 22 Jun 2016 06:57:04 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 23 Jun 2016 10:30:31 -0300

perf unwind: Fix wrongly used regs for aarch64 unwind

By default, "unwind-libunwind-local.c" gets SP/IP register number
according to the host platform, for remote unwind, we should use
register number for target platform. Fix this by define
LIBUNWIND_ARCH_REG_SP/IP in the wrapper file of aarch64 platform.

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1466578626-92406-4-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/libunwind/arm64.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/util/libunwind/arm64.c b/tools/perf/util/libunwind/arm64.c
index 4fb5395..6559bc5 100644
--- a/tools/perf/util/libunwind/arm64.c
+++ b/tools/perf/util/libunwind/arm64.c
@@ -13,7 +13,12 @@
 
 #define REMOTE_UNWIND_LIBUNWIND
 
+/* Define arch specific functions & regs for libunwind, should be
+ * defined before including "unwind.h"
+ */
 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arm64_reg_id(regnum)
+#define LIBUNWIND__ARCH_REG_IP PERF_REG_ARM64_PC
+#define LIBUNWIND__ARCH_REG_SP PERF_REG_ARM64_SP
 
 #include "unwind.h"
 #include "debug.h"

[toc] | [prev] | [next] | [standalone]


#1429831

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-06-23 15:40 +0200
Message-ID<rNd1n-2aV-5@gated-at.bofh.it>
In reply to#1428469
Em Wed, Jun 22, 2016 at 06:57:01AM +0000, He Kuang escreveu:
> hi,
> 
> Patch 1-3 fix wrongly used PERF_REG_SP/IP by redefining
> those macros in the wrapper file according to the target platform, for
> example in "util/libunwind/x86_32.c".
> The first 3 patches have been acked-by "Jiri Olsa" and not touched.
> 
> Patch 4 catches an error on python build_ext build.
> 
> Patch 5 fixes a NULL pointer deference which can cause segfault when
> the desired dso is not found.
> 
> Thank you.

Thanks, all applied.

- Arnaldo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web