Skip to contentSkip to conversation

perf tools: introduce arm64 support unwind test.

PATCH Superseded Wang Nan 4 participants 8 messages Mar 27, 2015 – May 29, 2015

Subsystems (2)
lore
Share & tools
lore

Wang Nan

author
#0 lore raw

PATCH 1/1 perf tools: introduce arm64 support unwind test.

Newest libunwind does support ARM64, and perf is able to utilize it also. This patch enables the missing perf test dwarf unwind for arm64.

Test result:

  # ./perf test unwind
  25: Test dwarf unwind                                      : Ok
---
 tools/perf/arch/arm64/Build                |  1 +
 tools/perf/arch/arm64/include/perf_regs.h  |  3 ++
 tools/perf/arch/arm64/tests/Build          |  2 +
 tools/perf/arch/arm64/tests/dwarf-unwind.c | 61 ++++++++++++++++++++++++++++++
 tools/perf/arch/arm64/tests/regs_load.S    | 46 ++++++++++++++++++++++
 tools/perf/tests/Build                     |  2 +-
 tools/perf/tests/builtin-test.c            |  2 +-
 tools/perf/tests/tests.h                   |  2 +-
 8 files changed, 116 insertions(+), 3 deletions(-)
 create mode 100644 tools/perf/arch/arm64/tests/Build
 create mode 100644 tools/perf/arch/arm64/tests/dwarf-unwind.c
 create mode 100644 tools/perf/arch/arm64/tests/regs_load.S
tools/perf/arch/arm64/Build +1 -0
index 54afe4a..41bf61d 100644
@@ -1 +1,2 @@
 libperf-y += util/
+libperf-$(CONFIG_DWARF_UNWIND) += tests/
tools/perf/arch/arm64/include/perf_regs.h +3 -0
index 1d3f39c..4e5af27 100644
@@ -5,8 +5,11 @@
 #include <linux/types.h>
 #include <asm/perf_regs.h>
 
+void perf_regs_load(u64 *regs);
+
 #define PERF_REGS_MASK	((1ULL << PERF_REG_ARM64_MAX) - 1)
 #define PERF_REGS_MAX	PERF_REG_ARM64_MAX
+#define PERF_SAMPLE_REGS_ABI	PERF_SAMPLE_REGS_ABI_64
 
 #define PERF_REG_IP	PERF_REG_ARM64_PC
 #define PERF_REG_SP	PERF_REG_ARM64_SP
tools/perf/arch/arm64/tests/Build new file +2 -0
new file mode 100644
index 0000000..b30eff9
@@ -0,0 +1,2 @@
+libperf-y += regs_load.o
+libperf-y += dwarf-unwind.o
tools/perf/arch/arm64/tests/dwarf-unwind.c new file +61 -0

61 lines not on this page · raw message

tools/perf/arch/arm64/tests/regs_load.S new file +46 -0

46 lines not on this page · raw message

tools/perf/tests/Build +1 -1
index 6a8801b..67f48e6 100644
@@ -34,7 +34,7 @@ perf-y += kmod-path.o
 
 perf-$(CONFIG_X86) += perf-time-to-tsc.o
 
-ifeq ($(ARCH),$(filter $(ARCH),x86 arm))
+ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64))
 perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 endif
 
tools/perf/tests/builtin-test.c +1 -1
index 4f40981..63b0d27 100644
@@ -126,7 +126,7 @@ static struct test {
 		.desc = "Test parsing with no sample_id_all bit set",
 		.func = test__parse_no_sample_id_all,
 	},
-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 	{
 		.desc = "Test dwarf unwind",
tools/perf/tests/tests.h +1 -1
index 52758a3..a94ea87 100644
@@ -53,7 +53,7 @@ int test__fdarray__filter(void);
 int test__fdarray__add(void);
 int test__kmod_path__parse(void);
 
-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 struct thread;
 struct perf_sample;
Signature · 1 line
1.8.3.4
#1 lore raw

Ping?

Quoted 211 lines · Wang Nan

Newest libunwind does support ARM64, and perf is able to utilize it also. This patch enables the missing perf test dwarf unwind for arm64.

Test result:

   # ./perf test unwind
   25: Test dwarf unwind                                      : Ok
---
  tools/perf/arch/arm64/Build                |  1 +
  tools/perf/arch/arm64/include/perf_regs.h  |  3 ++
  tools/perf/arch/arm64/tests/Build          |  2 +
  tools/perf/arch/arm64/tests/dwarf-unwind.c | 61 ++++++++++++++++++++++++++++++
  tools/perf/arch/arm64/tests/regs_load.S    | 46 ++++++++++++++++++++++
  tools/perf/tests/Build                     |  2 +-
  tools/perf/tests/builtin-test.c            |  2 +-
  tools/perf/tests/tests.h                   |  2 +-
  8 files changed, 116 insertions(+), 3 deletions(-)

create mode 100644 tools/perf/arch/arm64/tests/Build create mode 100644 tools/perf/arch/arm64/tests/dwarf-unwind.c create mode 100644 tools/perf/arch/arm64/tests/regs_load.S

tools/perf/arch/arm64/Build +1 -0
index 54afe4a..41bf61d 100644
@@ -1 +1,2 @@
  libperf-y += util/
+libperf-$(CONFIG_DWARF_UNWIND) += tests/
tools/perf/arch/arm64/include/perf_regs.h +3 -0
index 1d3f39c..4e5af27 100644
@@ -5,8 +5,11 @@
  #include <linux/types.h>
  #include <asm/perf_regs.h>
 
+void perf_regs_load(u64 *regs);
+
  #define PERF_REGS_MASK	((1ULL << PERF_REG_ARM64_MAX) - 1)
  #define PERF_REGS_MAX	PERF_REG_ARM64_MAX
+#define PERF_SAMPLE_REGS_ABI	PERF_SAMPLE_REGS_ABI_64
 
  #define PERF_REG_IP	PERF_REG_ARM64_PC
  #define PERF_REG_SP	PERF_REG_ARM64_SP
tools/perf/arch/arm64/tests/Build new file +2 -0
new file mode 100644
index 0000000..b30eff9
@@ -0,0 +1,2 @@
+libperf-y += regs_load.o
+libperf-y += dwarf-unwind.o
tools/perf/arch/arm64/tests/dwarf-unwind.c new file +61 -0
new file mode 100644
index 0000000..cf04a4c
@@ -0,0 +1,61 @@
+#include <string.h>
+#include "perf_regs.h"
+#include "thread.h"
+#include "map.h"
+#include "event.h"
+#include "debug.h"
+#include "tests/tests.h"
+
+#define STACK_SIZE 8192
+
+static int sample_ustack(struct perf_sample *sample,
+		struct thread *thread, u64 *regs)
+{
+	struct stack_dump *stack = &sample->user_stack;
+	struct map *map;
+	unsigned long sp;
+	u64 stack_size, *buf;
+
+	buf = malloc(STACK_SIZE);
+	if (!buf) {
+		pr_debug("failed to allocate sample uregs data\n");
+		return -1;
+	}
+
+	sp = (unsigned long) regs[PERF_REG_ARM64_SP];
+
+	map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
+	if (!map) {
+		pr_debug("failed to get stack map\n");
+		free(buf);
+		return -1;
+	}
+
+	stack_size = map->end - sp;
+	stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size;
+
+	memcpy(buf, (void *) sp, stack_size);
+	stack->data = (char *) buf;
+	stack->size = stack_size;
+	return 0;
+}
+
+int test__arch_unwind_sample(struct perf_sample *sample,
+		struct thread *thread)
+{
+	struct regs_dump *regs = &sample->user_regs;
+	u64 *buf;
+
+	buf = calloc(1, sizeof(u64) * PERF_REGS_MAX);
+	if (!buf) {
+		pr_debug("failed to allocate sample uregs data\n");
+		return -1;
+	}
+
+	perf_regs_load(buf);
+	regs->abi  = PERF_SAMPLE_REGS_ABI;
+	regs->regs = buf;
+	regs->mask = PERF_REGS_MASK;
+
+	return sample_ustack(sample, thread, buf);
+}
tools/perf/arch/arm64/tests/regs_load.S new file +46 -0
new file mode 100644
index 0000000..025b46e
@@ -0,0 +1,46 @@
+#include <linux/linkage.h>
+
+.text
+.type perf_regs_load,%function
+#define STR_REG(r)	str x##r, [x0, 8 * r]
+#define LDR_REG(r)	ldr x##r, [x0, 8 * r]
+#define SP	(8 * 31)
+#define PC	(8 * 32)
+ENTRY(perf_regs_load)
+	STR_REG(0)
+	STR_REG(1)
+	STR_REG(2)
+	STR_REG(3)
+	STR_REG(4)
+	STR_REG(5)
+	STR_REG(6)
+	STR_REG(7)
+	STR_REG(8)
+	STR_REG(9)
+	STR_REG(10)
+	STR_REG(11)
+	STR_REG(12)
+	STR_REG(13)
+	STR_REG(14)
+	STR_REG(15)
+	STR_REG(16)
+	STR_REG(17)
+	STR_REG(18)
+	STR_REG(19)
+	STR_REG(20)
+	STR_REG(21)
+	STR_REG(22)
+	STR_REG(23)
+	STR_REG(24)
+	STR_REG(25)
+	STR_REG(26)
+	STR_REG(27)
+	STR_REG(28)
+	STR_REG(29)
+	STR_REG(30)
+	mov x1, sp
+	str x1, [x0, #SP]
+	str x30, [x0, #PC]
+	LDR_REG(1)
+	ret
+ENDPROC(perf_regs_load)
tools/perf/tests/Build +1 -1
index 6a8801b..67f48e6 100644
@@ -34,7 +34,7 @@ perf-y += kmod-path.o
 
  perf-$(CONFIG_X86) += perf-time-to-tsc.o
 
-ifeq ($(ARCH),$(filter $(ARCH),x86 arm))
+ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64))
  perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
  endif
 
tools/perf/tests/builtin-test.c +1 -1
index 4f40981..63b0d27 100644
@@ -126,7 +126,7 @@ static struct test {
  		.desc = "Test parsing with no sample_id_all bit set",
  		.func = test__parse_no_sample_id_all,
  	},
-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
  #ifdef HAVE_DWARF_UNWIND_SUPPORT
  	{
  		.desc = "Test dwarf unwind",
tools/perf/tests/tests.h +1 -1
index 52758a3..a94ea87 100644
@@ -53,7 +53,7 @@ int test__fdarray__filter(void);
  int test__fdarray__add(void);
  int test__kmod_path__parse(void);
 
-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
  #ifdef HAVE_DWARF_UNWIND_SUPPORT
  struct thread;
  struct perf_sample;
#2 lore raw

Em Thu, May 28, 2015 at 03:17:26PM +0800, Wangnan (F) escreveu:

Quoted 1 line

Ping?

Jiri, Ack?

And from a quick look, isn't this better split in two pieces, i.e. the first wiring up ARM64 to libunwing, i.e. all those perf_regs.h files being added to tools/perf/arch/arm64/, and then a second patch, enabling the dwarf unwind 'perf test' entry to run on ARM64?

- Arnaldo

Quoted 207 lines · Wang Nan
Quoted 205 lines

Newest libunwind does support ARM64, and perf is able to utilize it also. This patch enables the missing perf test dwarf unwind for arm64.

Test result:

  # ./perf test unwind
  25: Test dwarf unwind                                      : Ok
---
 tools/perf/arch/arm64/Build                |  1 +
 tools/perf/arch/arm64/include/perf_regs.h  |  3 ++
 tools/perf/arch/arm64/tests/Build          |  2 +
 tools/perf/arch/arm64/tests/dwarf-unwind.c | 61 ++++++++++++++++++++++++++++++
 tools/perf/arch/arm64/tests/regs_load.S    | 46 ++++++++++++++++++++++
 tools/perf/tests/Build                     |  2 +-
 tools/perf/tests/builtin-test.c            |  2 +-
 tools/perf/tests/tests.h                   |  2 +-
 8 files changed, 116 insertions(+), 3 deletions(-)
 create mode 100644 tools/perf/arch/arm64/tests/Build
 create mode 100644 tools/perf/arch/arm64/tests/dwarf-unwind.c
 create mode 100644 tools/perf/arch/arm64/tests/regs_load.S
tools/perf/arch/arm64/Build +1 -0
index 54afe4a..41bf61d 100644
@@ -1 +1,2 @@
 libperf-y += util/
+libperf-$(CONFIG_DWARF_UNWIND) += tests/
tools/perf/arch/arm64/include/perf_regs.h +3 -0
index 1d3f39c..4e5af27 100644
@@ -5,8 +5,11 @@
 #include <linux/types.h>
 #include <asm/perf_regs.h>
+void perf_regs_load(u64 *regs);
+
 #define PERF_REGS_MASK	((1ULL << PERF_REG_ARM64_MAX) - 1)
 #define PERF_REGS_MAX	PERF_REG_ARM64_MAX
+#define PERF_SAMPLE_REGS_ABI	PERF_SAMPLE_REGS_ABI_64
 #define PERF_REG_IP	PERF_REG_ARM64_PC
 #define PERF_REG_SP	PERF_REG_ARM64_SP
tools/perf/arch/arm64/tests/Build new file +2 -0
new file mode 100644
index 0000000..b30eff9
@@ -0,0 +1,2 @@
+libperf-y += regs_load.o
+libperf-y += dwarf-unwind.o
tools/perf/arch/arm64/tests/dwarf-unwind.c new file +61 -0
new file mode 100644
index 0000000..cf04a4c
@@ -0,0 +1,61 @@
+#include <string.h>
+#include "perf_regs.h"
+#include "thread.h"
+#include "map.h"
+#include "event.h"
+#include "debug.h"
+#include "tests/tests.h"
+
+#define STACK_SIZE 8192
+
+static int sample_ustack(struct perf_sample *sample,
+		struct thread *thread, u64 *regs)
+{
+	struct stack_dump *stack = &sample->user_stack;
+	struct map *map;
+	unsigned long sp;
+	u64 stack_size, *buf;
+
+	buf = malloc(STACK_SIZE);
+	if (!buf) {
+		pr_debug("failed to allocate sample uregs data\n");
+		return -1;
+	}
+
+	sp = (unsigned long) regs[PERF_REG_ARM64_SP];
+
+	map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
+	if (!map) {
+		pr_debug("failed to get stack map\n");
+		free(buf);
+		return -1;
+	}
+
+	stack_size = map->end - sp;
+	stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size;
+
+	memcpy(buf, (void *) sp, stack_size);
+	stack->data = (char *) buf;
+	stack->size = stack_size;
+	return 0;
+}
+
+int test__arch_unwind_sample(struct perf_sample *sample,
+		struct thread *thread)
+{
+	struct regs_dump *regs = &sample->user_regs;
+	u64 *buf;
+
+	buf = calloc(1, sizeof(u64) * PERF_REGS_MAX);
+	if (!buf) {
+		pr_debug("failed to allocate sample uregs data\n");
+		return -1;
+	}
+
+	perf_regs_load(buf);
+	regs->abi  = PERF_SAMPLE_REGS_ABI;
+	regs->regs = buf;
+	regs->mask = PERF_REGS_MASK;
+
+	return sample_ustack(sample, thread, buf);
+}
tools/perf/arch/arm64/tests/regs_load.S new file +46 -0
new file mode 100644
index 0000000..025b46e
@@ -0,0 +1,46 @@
+#include <linux/linkage.h>
+
+.text
+.type perf_regs_load,%function
+#define STR_REG(r)	str x##r, [x0, 8 * r]
+#define LDR_REG(r)	ldr x##r, [x0, 8 * r]
+#define SP	(8 * 31)
+#define PC	(8 * 32)
+ENTRY(perf_regs_load)
+	STR_REG(0)
+	STR_REG(1)
+	STR_REG(2)
+	STR_REG(3)
+	STR_REG(4)
+	STR_REG(5)
+	STR_REG(6)
+	STR_REG(7)
+	STR_REG(8)
+	STR_REG(9)
+	STR_REG(10)
+	STR_REG(11)
+	STR_REG(12)
+	STR_REG(13)
+	STR_REG(14)
+	STR_REG(15)
+	STR_REG(16)
+	STR_REG(17)
+	STR_REG(18)
+	STR_REG(19)
+	STR_REG(20)
+	STR_REG(21)
+	STR_REG(22)
+	STR_REG(23)
+	STR_REG(24)
+	STR_REG(25)
+	STR_REG(26)
+	STR_REG(27)
+	STR_REG(28)
+	STR_REG(29)
+	STR_REG(30)
+	mov x1, sp
+	str x1, [x0, #SP]
+	str x30, [x0, #PC]
+	LDR_REG(1)
+	ret
+ENDPROC(perf_regs_load)
tools/perf/tests/Build +1 -1
index 6a8801b..67f48e6 100644
@@ -34,7 +34,7 @@ perf-y += kmod-path.o
 perf-$(CONFIG_X86) += perf-time-to-tsc.o
-ifeq ($(ARCH),$(filter $(ARCH),x86 arm))
+ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64))
 perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 endif
tools/perf/tests/builtin-test.c +1 -1
index 4f40981..63b0d27 100644
@@ -126,7 +126,7 @@ static struct test {
 		.desc = "Test parsing with no sample_id_all bit set",
 		.func = test__parse_no_sample_id_all,
 	},
-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 	{
 		.desc = "Test dwarf unwind",
tools/perf/tests/tests.h +1 -1
index 52758a3..a94ea87 100644
@@ -53,7 +53,7 @@ int test__fdarray__filter(void);
 int test__fdarray__add(void);
 int test__kmod_path__parse(void);
-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 struct thread;
 struct perf_sample;
#3 lore raw
Quoted 4 lines · Arnaldo Carvalho de Melo

Em Thu, May 28, 2015 at 03:17:26PM +0800, Wangnan (F) escreveu:

Quoted 1 line

Ping?

Jiri, Ack?

yep, I've already ack-ed that.. should be on the lkml somewhere ;-)

Quoted 5 lines

And from a quick look, isn't this better split in two pieces, i.e. the first wiring up ARM64 to libunwing, i.e. all those perf_regs.h files being added to tools/perf/arch/arm64/, and then a second patch, enabling the dwarf unwind 'perf test' entry to run on ARM64?

I guess.. but the change is fairly small, so it did not occur to me as necessary..

jirka

#4 lore raw

Em Fri, May 29, 2015 at 11:21:19AM +0200, Jiri Olsa escreveu:

Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

Em Thu, May 28, 2015 at 03:17:26PM +0800, Wangnan (F) escreveu:

Quoted 1 line

Ping?

Jiri, Ack?

yep, I've already ack-ed that.. should be on the lkml somewhere ;-)

Quoted 7 lines
Quoted 4 lines

And from a quick look, isn't this better split in two pieces, i.e. the first wiring up ARM64 to libunwing, i.e. all those perf_regs.h files being added to tools/perf/arch/arm64/, and then a second patch, enabling the dwarf unwind 'perf test' entry to run on ARM64?

I guess.. but the change is fairly small, so it did not occur to me as necessary..

:-)

I felt mislead when looking at the subject, i.e. "hey, a new test, testing unwind on arm64", no, it wasn't that, it introduces support for unwind on ARM64 by providing that regs mapping, then it _enables_ an existing test on arm64 :-\

- Arnaldo

#5 lore raw
Quoted 17 lines · Arnaldo Carvalho de Melo

Em Fri, May 29, 2015 at 11:21:19AM +0200, Jiri Olsa escreveu:

Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

Em Thu, May 28, 2015 at 03:17:26PM +0800, Wangnan (F) escreveu:

Quoted 1 line

Ping?

Jiri, Ack?

yep, I've already ack-ed that.. should be on the lkml somewhere ;-)

Quoted 7 lines
Quoted 4 lines

And from a quick look, isn't this better split in two pieces, i.e. the first wiring up ARM64 to libunwing, i.e. all those perf_regs.h files being added to tools/perf/arch/arm64/, and then a second patch, enabling the dwarf unwind 'perf test' entry to run on ARM64?

I guess.. but the change is fairly small, so it did not occur to me as necessary..

Quoted 6 lines

:-)

I felt mislead when looking at the subject, i.e. "hey, a new test, testing unwind on arm64", no, it wasn't that, it introduces support for unwind on ARM64 by providing that regs mapping, then it _enables_ an existing test on arm64 :-\

still it's good news right? ;-)

jirka

#6 lore raw

Em Fri, May 29, 2015 at 04:40:24PM +0200, Jiri Olsa escreveu:

Quoted 18 lines · Arnaldo Carvalho de Melo
Quoted 17 lines

Em Fri, May 29, 2015 at 11:21:19AM +0200, Jiri Olsa escreveu:

Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

Em Thu, May 28, 2015 at 03:17:26PM +0800, Wangnan (F) escreveu:

Quoted 1 line

Ping?

Jiri, Ack?

yep, I've already ack-ed that.. should be on the lkml somewhere ;-)

Quoted 4 lines

And from a quick look, isn't this better split in two pieces, i.e. the first wiring up ARM64 to libunwing, i.e. all those perf_regs.h files being added to tools/perf/arch/arm64/, and then a second patch, enabling the dwarf unwind 'perf test' entry to run on ARM64?

I guess.. but the change is fairly small, so it did not occur to me as necessary..

Quoted 8 lines
Quoted 6 lines

:-)

I felt mislead when looking at the subject, i.e. "hey, a new test, testing unwind on arm64", no, it wasn't that, it introduces support for unwind on ARM64 by providing that regs mapping, then it _enables_ an existing test on arm64 :-\

still it's good news right? ;-)

Whatever, I'll fix at least the cset log message and apply...

- Arnaldo

#7 lore raw

[tip:perf/core] perf tools: Add ARM64 perf_regs_load to support libunwind and enable testing

In reply to Wang Nan
perf tools: Add ARM64 perf_regs_load to support libunwind and enable testing
Commit-ID:  3237f28188c3e41a938781a369652772a23e97a9
Gitweb:     http://git.kernel.org/tip/3237f28188c3e41a938781a369652772a23e97a9
Author:     Wang Nan <[email protected]>
AuthorDate: Fri, 27 Mar 2015 13:08:01 +0000
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 29 May 2015 12:43:40 -0300

perf tools: Add ARM64 perf_regs_load to support libunwind and enable testing

Newest libunwind does support ARM64, and perf is able to utilize it also.

This patch enables the perf test dwarf unwind for arm64.

Test result:

  # ./perf test unwind
  25: Test dwarf unwind                                      : Ok
---
 tools/perf/arch/arm64/Build                        |  1 +
 tools/perf/arch/arm64/include/perf_regs.h          |  3 ++
 tools/perf/arch/{arm => arm64}/tests/Build         |  0
 .../perf/arch/{arm => arm64}/tests/dwarf-unwind.c  |  6 +--
 tools/perf/arch/arm64/tests/regs_load.S            | 46 ++++++++++++++++++++++
 tools/perf/tests/Build                             |  2 +-
 tools/perf/tests/builtin-test.c                    |  2 +-
 tools/perf/tests/tests.h                           |  2 +-
 8 files changed, 56 insertions(+), 6 deletions(-)
tools/perf/arch/arm64/Build +1 -0
index 54afe4a..41bf61d 100644
@@ -1 +1,2 @@
 libperf-y += util/
+libperf-$(CONFIG_DWARF_UNWIND) += tests/
tools/perf/arch/arm64/include/perf_regs.h +3 -0
index 1d3f39c..4e5af27 100644
@@ -5,8 +5,11 @@
 #include <linux/types.h>
 #include <asm/perf_regs.h>
 
+void perf_regs_load(u64 *regs);
+
 #define PERF_REGS_MASK	((1ULL << PERF_REG_ARM64_MAX) - 1)
 #define PERF_REGS_MAX	PERF_REG_ARM64_MAX
+#define PERF_SAMPLE_REGS_ABI	PERF_SAMPLE_REGS_ABI_64
 
 #define PERF_REG_IP	PERF_REG_ARM64_PC
 #define PERF_REG_SP	PERF_REG_ARM64_SP
tools/perf/arch/arm64/tests/Build renamed from tools/perf/arch/arm/tests/Build +0 -0
similarity index 100%
copy from tools/perf/arch/arm/tests/Build
copy to tools/perf/arch/arm64/tests/Build
tools/perf/arch/arm64/tests/dwarf-unwind.c renamed from tools/perf/arch/arm/tests/dwarf-unwind.c +3 -3
similarity index 91%
copy from tools/perf/arch/arm/tests/dwarf-unwind.c
copy to tools/perf/arch/arm64/tests/dwarf-unwind.c
index 62eff84..cf04a4c9 100644
@@ -9,7 +9,7 @@
 #define STACK_SIZE 8192
 
 static int sample_ustack(struct perf_sample *sample,
-			 struct thread *thread, u64 *regs)
+		struct thread *thread, u64 *regs)
 {
 	struct stack_dump *stack = &sample->user_stack;
 	struct map *map;
@@ -22,7 +22,7 @@ static int sample_ustack(struct perf_sample *sample,
 		return -1;
 	}
 
-	sp = (unsigned long) regs[PERF_REG_ARM_SP];
+	sp = (unsigned long) regs[PERF_REG_ARM64_SP];
 
 	map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
 	if (!map) {
@@ -41,7 +41,7 @@ static int sample_ustack(struct perf_sample *sample,
 }
 
 int test__arch_unwind_sample(struct perf_sample *sample,
-			     struct thread *thread)
+		struct thread *thread)
 {
 	struct regs_dump *regs = &sample->user_regs;
 	u64 *buf;
tools/perf/arch/arm64/tests/regs_load.S new file +46 -0

46 lines not on this page · raw message

tools/perf/tests/Build +1 -1
index 6a8801b..67f48e6 100644
@@ -34,7 +34,7 @@ perf-y += kmod-path.o
 
 perf-$(CONFIG_X86) += perf-time-to-tsc.o
 
-ifeq ($(ARCH),$(filter $(ARCH),x86 arm))
+ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64))
 perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 endif
 
tools/perf/tests/builtin-test.c +1 -1
index f42af98..b5b87a2 100644
@@ -126,7 +126,7 @@ static struct test {
 		.desc = "Test parsing with no sample_id_all bit set",
 		.func = test__parse_no_sample_id_all,
 	},
-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 	{
 		.desc = "Test dwarf unwind",
tools/perf/tests/tests.h +1 -1
index a10eaf5..87bcaf1 100644
@@ -62,7 +62,7 @@ int test__fdarray__filter(void);
 int test__fdarray__add(void);
 int test__kmod_path__parse(void);
 
-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 struct thread;
 struct perf_sample;