summaryrefslogtreecommitdiffstats
path: root/meta-raspberrypi-extras
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@theqtcompany.com>2015-02-12 14:44:25 +0200
committerSamuli Piippo <samuli.piippo@theqtcompany.com>2015-02-26 08:55:46 +0200
commitb2397a823399be9ae901d02f0073df5001b75c55 (patch)
tree9f12adaad26c1c29237e70e9a6d25bacc9b4927c /meta-raspberrypi-extras
parentd025004a0d1a78ed67131d30f4251e1faf2d4083 (diff)
downloadmeta-boot2qt-b2397a823399be9ae901d02f0073df5001b75c55.tar.gz
Performance analysis tools for Linux
Build perf with DWARF unwinding support. Kernels older then 3.14 need to be patched to add ARM support. Kernels for tibidabo (3.0) and imx53 (2.6) are too old and would require more patches to be backported, so they are left without unwinding support. RPi needed extra layer to modify the kernel recipe, and linux-imx recipe was renamed so that it doesn't conflict with older tibidabo kernel recipe. Change-Id: Ic8331f8feeace67b32a5ce99ffd3fda517d595d1 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com> Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
Diffstat (limited to 'meta-raspberrypi-extras')
-rw-r--r--meta-raspberrypi-extras/conf/layer.conf33
-rw-r--r--meta-raspberrypi-extras/recipes/linux/linux-raspberrypi/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch171
-rw-r--r--meta-raspberrypi-extras/recipes/linux/linux-raspberrypi_3.12.26.bbappend27
3 files changed, 231 insertions, 0 deletions
diff --git a/meta-raspberrypi-extras/conf/layer.conf b/meta-raspberrypi-extras/conf/layer.conf
new file mode 100644
index 0000000..0ac91aa
--- /dev/null
+++ b/meta-raspberrypi-extras/conf/layer.conf
@@ -0,0 +1,33 @@
1#############################################################################
2##
3## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4##
5## This file is part of the Qt Enterprise Embedded Scripts of the Qt
6## framework.
7##
8## $QT_BEGIN_LICENSE$
9## Commercial License Usage Only
10## Licensees holding valid commercial Qt license agreements with Digia
11## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
12## may use this file in accordance with the terms contained in said license
13## agreement.
14##
15## For further information use the contact form at
16## http://www.qt.io/contact-us.
17##
18##
19## $QT_END_LICENSE$
20##
21#############################################################################
22
23# We have a conf and classes directory, append to BBPATH
24BBPATH .= ":${LAYERDIR}"
25
26# We have a recipes directory, add to BBFILES
27BBFILES += "${LAYERDIR}/recipes*/*/*.bb \
28 ${LAYERDIR}/recipes*/*/*.bbappend \
29 "
30
31BBFILE_COLLECTIONS += "b2qt_rpi"
32BBFILE_PATTERN_b2qt_rpi := "^${LAYERDIR}/"
33BBFILE_PRIORITY_b2qt_rpi = "20"
diff --git a/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch b/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch
new file mode 100644
index 0000000..4f2a45a
--- /dev/null
+++ b/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch
@@ -0,0 +1,171 @@
1From 7495f3742dda97612a77d92fa62f85cb7591ab14 Mon Sep 17 00:00:00 2001
2From: Will Deacon <will.deacon@arm.com>
3Date: Thu, 26 Sep 2013 12:36:36 +0100
4Subject: [PATCH] ARM: perf: wire up perf_regs and unwind support for ARM
5
6This patch hooks in the perf_regs and libunwind code for ARM.
7
8Cc: Jean Pihet <jean.pihet@linaro.org>
9Signed-off-by: Will Deacon <will.deacon@arm.com>
10---
11 tools/perf/arch/arm/Makefile | 3 ++
12 tools/perf/arch/arm/include/perf_regs.h | 54 +++++++++++++++++++++++++++++++++
13 tools/perf/arch/arm/util/unwind.c | 48 +++++++++++++++++++++++++++++
14 tools/perf/config/Makefile | 7 +++--
15 4 files changed, 110 insertions(+), 2 deletions(-)
16 create mode 100644 tools/perf/arch/arm/include/perf_regs.h
17 create mode 100644 tools/perf/arch/arm/util/unwind.c
18
19diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
20index 15130b5..fe9b61e 100644
21--- a/tools/perf/arch/arm/Makefile
22+++ b/tools/perf/arch/arm/Makefile
23@@ -2,3 +2,6 @@ ifndef NO_DWARF
24 PERF_HAVE_DWARF_REGS := 1
25 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
26 endif
27+ifndef NO_LIBUNWIND
28+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o
29+endif
30diff --git a/tools/perf/arch/arm/include/perf_regs.h b/tools/perf/arch/arm/include/perf_regs.h
31new file mode 100644
32index 0000000..2a1cfde
33--- /dev/null
34+++ b/tools/perf/arch/arm/include/perf_regs.h
35@@ -0,0 +1,54 @@
36+#ifndef ARCH_PERF_REGS_H
37+#define ARCH_PERF_REGS_H
38+
39+#include <stdlib.h>
40+#include "../../util/types.h"
41+#include <asm/perf_regs.h>
42+
43+#define PERF_REGS_MASK ((1ULL << PERF_REG_ARM_MAX) - 1)
44+#define PERF_REG_IP PERF_REG_ARM_PC
45+#define PERF_REG_SP PERF_REG_ARM_SP
46+
47+static inline const char *perf_reg_name(int id)
48+{
49+ switch (id) {
50+ case PERF_REG_ARM_R0:
51+ return "r0";
52+ case PERF_REG_ARM_R1:
53+ return "r1";
54+ case PERF_REG_ARM_R2:
55+ return "r2";
56+ case PERF_REG_ARM_R3:
57+ return "r3";
58+ case PERF_REG_ARM_R4:
59+ return "r4";
60+ case PERF_REG_ARM_R5:
61+ return "r5";
62+ case PERF_REG_ARM_R6:
63+ return "r6";
64+ case PERF_REG_ARM_R7:
65+ return "r7";
66+ case PERF_REG_ARM_R8:
67+ return "r8";
68+ case PERF_REG_ARM_R9:
69+ return "r9";
70+ case PERF_REG_ARM_R10:
71+ return "r10";
72+ case PERF_REG_ARM_FP:
73+ return "fp";
74+ case PERF_REG_ARM_IP:
75+ return "ip";
76+ case PERF_REG_ARM_SP:
77+ return "sp";
78+ case PERF_REG_ARM_LR:
79+ return "lr";
80+ case PERF_REG_ARM_PC:
81+ return "pc";
82+ default:
83+ return NULL;
84+ }
85+
86+ return NULL;
87+}
88+
89+#endif /* ARCH_PERF_REGS_H */
90diff --git a/tools/perf/arch/arm/util/unwind.c b/tools/perf/arch/arm/util/unwind.c
91new file mode 100644
92index 0000000..da3dc95
93--- /dev/null
94+++ b/tools/perf/arch/arm/util/unwind.c
95@@ -0,0 +1,48 @@
96+
97+#include <errno.h>
98+#include <libunwind.h>
99+#include "perf_regs.h"
100+#include "../../util/unwind.h"
101+
102+int unwind__arch_reg_id(int regnum)
103+{
104+ switch (regnum) {
105+ case UNW_ARM_R0:
106+ return PERF_REG_ARM_R0;
107+ case UNW_ARM_R1:
108+ return PERF_REG_ARM_R1;
109+ case UNW_ARM_R2:
110+ return PERF_REG_ARM_R2;
111+ case UNW_ARM_R3:
112+ return PERF_REG_ARM_R3;
113+ case UNW_ARM_R4:
114+ return PERF_REG_ARM_R4;
115+ case UNW_ARM_R5:
116+ return PERF_REG_ARM_R5;
117+ case UNW_ARM_R6:
118+ return PERF_REG_ARM_R6;
119+ case UNW_ARM_R7:
120+ return PERF_REG_ARM_R7;
121+ case UNW_ARM_R8:
122+ return PERF_REG_ARM_R8;
123+ case UNW_ARM_R9:
124+ return PERF_REG_ARM_R9;
125+ case UNW_ARM_R10:
126+ return PERF_REG_ARM_R10;
127+ case UNW_ARM_R11:
128+ return PERF_REG_ARM_FP;
129+ case UNW_ARM_R12:
130+ return PERF_REG_ARM_IP;
131+ case UNW_ARM_R13:
132+ return PERF_REG_ARM_SP;
133+ case UNW_ARM_R14:
134+ return PERF_REG_ARM_LR;
135+ case UNW_ARM_R15:
136+ return PERF_REG_ARM_PC;
137+ default:
138+ pr_err("unwind: invalid reg id %d\n", regnum);
139+ return -EINVAL;
140+ }
141+
142+ return -EINVAL;
143+}
144diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
145index 5f6f9b3..4796ce5 100644
146--- a/tools/perf/config/Makefile
147+++ b/tools/perf/config/Makefile
148@@ -29,6 +29,10 @@ ifeq ($(ARCH),x86_64)
149 NO_PERF_REGS := 0
150 LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
151 endif
152+ifeq ($(ARCH),arm)
153+ NO_PERF_REGS := 0
154+ LIBUNWIND_LIBS = -lunwind -lunwind-arm
155+endif
156
157 ifeq ($(NO_PERF_REGS),0)
158 CFLAGS += -DHAVE_PERF_REGS
159@@ -208,8 +212,7 @@ ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
160 endif # try-cc
161 endif # NO_LIBELF
162
163-# There's only x86 (both 32 and 64) support for CFI unwind so far
164-ifneq ($(ARCH),x86)
165+ifeq ($(LIBUNWIND_LIBS),)
166 NO_LIBUNWIND := 1
167 endif
168
169--
1701.9.1
171
diff --git a/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi_3.12.26.bbappend b/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi_3.12.26.bbappend
new file mode 100644
index 0000000..94b2ab1
--- /dev/null
+++ b/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi_3.12.26.bbappend
@@ -0,0 +1,27 @@
1#############################################################################
2##
3## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4##
5## This file is part of the Qt Enterprise Embedded Scripts of the Qt
6## framework.
7##
8## $QT_BEGIN_LICENSE$
9## Commercial License Usage Only
10## Licensees holding valid commercial Qt license agreements with Digia
11## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
12## may use this file in accordance with the terms contained in said license
13## agreement.
14##
15## For further information use the contact form at
16## http://www.qt.io/contact-us.
17##
18##
19## $QT_END_LICENSE$
20##
21#############################################################################
22
23FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:${THISDIR}/../../../recipes/linux/linux:"
24SRC_URI += "\
25 file://ARM-perf-add-support-for-perf-registers-API.diff \
26 file://ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch \
27 "