perf: Cross arch annotate + few miscellaneous fixes
v6 cover perf: Cross arch annotate + few miscellaneous fixes
Currently Perf annotate support code navigation (branches and calls) only when run on the same architecture where perf.data was recorded. But, for example, record on powerpc server and annotate on client's x86 desktop is not supported.
This patchset enables cross arch annotate. Currently I've used x86 and arm instructions which are already available and added support for powerpc.
Additionally this patch series also contains few other related fixes.
Patches are prepared on top of acme/perf/core and tested it with x86 and powerpc only.
Note for arm:
I don't have arm test machine. As suggested by Russell in one of the review comment, I've copied all instructions from default table to arm table. This way it want break tool on arm but cleanup is needed for x86 specific instructions added in arm table.
Example:
Record on powerpc:
$ ./perf record -a
Report -> Annotate on x86:
$ ./perf report -i perf.data.powerpc --vmlinux vmlinux.powerpc
Changes in v6:
- Instead of adding only those instructions defined in #ifdef __arm__, add all instructions from default table to arm table.
v5 link:
https://lkml.org/lkml/2016/8/19/35
Naveen N. Rao (1):
perf annotate: Add support for powerpc
Ravi Bangoria (6):
perf: Define macro for normalized arch names
perf annotate: Add cross arch annotate support
perf annotate: Do not ignore call instruction with indirect target perf annotate: Show raw form for jump instruction with indirect target perf annotate: Support jump instruction with target as second operand perf annotate: Fix jump target outside of function address range
tools/perf/arch/common.c | 36 ++-- tools/perf/arch/common.h | 11 ++ tools/perf/builtin-top.c | 2 +- tools/perf/ui/browsers/annotate.c | 8 +- tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/util/annotate.c | 330 +++++++++++++++++++++++++++++++------ tools/perf/util/annotate.h | 10 +- tools/perf/util/unwind-libunwind.c | 4 +- 8 files changed, 327 insertions(+), 76 deletions(-)
Signature · 1 line
2.5.5
PATCH v6 1/7 perf: Define macro for normalized arch names
Define macro for each normalized arch name and use them instead of using arch name as string.
---
Changes in v6:
- No change
tools/perf/arch/common.c | 36 ++++++++++++++++++------------------ tools/perf/arch/common.h | 11 +++++++++++ tools/perf/util/unwind-libunwind.c | 4 ++-- 3 files changed, 31 insertions(+), 20 deletions(-)
tools/perf/arch/common.c +18 -18
@@ -123,25 +123,25 @@ static int lookup_triplets(const char *const *triplets, const char *name)const char *normalize_arch (char *arch) {if (!strcmp (arch,"x86_64" )) -return "x86" ; +return NORM_X86 ;if (arch[0 ] =='i' && arch[2 ] =='8' && arch[3 ] =='6' ) -return "x86" ; +return NORM_X86 ;if (!strcmp (arch,"sun4u" ) || !strncmp (arch,"sparc" ,5 )) -return "sparc" ; +return NORM_SPARC ;if (!strcmp (arch,"aarch64" ) || !strcmp (arch,"arm64" )) -return "arm64" ; +return NORM_ARM64 ;if (!strncmp (arch,"arm" ,3 ) || !strcmp (arch,"sa110" )) -return "arm" ; +return NORM_ARM ;if (!strncmp (arch,"s390" ,4 )) -return "s390" ; +return NORM_S390 ;if (!strncmp (arch,"parisc" ,6 )) -return "parisc" ; +return NORM_PARISC ;if (!strncmp (arch,"powerpc" ,7 ) || !strncmp (arch,"ppc" ,3 )) -return "powerpc" ; +return NORM_POWERPC ;if (!strncmp (arch,"mips" ,4 )) -return "mips" ; +return NORM_MIPS ;if (!strncmp (arch,"sh" ,2 ) &&isdigit (arch[2 ])) -return "sh" ; +return NORM_SH ;return arch; }
@@ -181,21 +181,21 @@ static int perf_env__lookup_binutils_path(struct perf_env *env,zfree (&buf); } -if (!strcmp (arch,"arm" )) +if (!strcmp (arch,NORM_ARM )) path_list = arm_triplets; -else if (!strcmp (arch,"arm64" )) +else if (!strcmp (arch,NORM_ARM64 )) path_list = arm64_triplets; -else if (!strcmp (arch,"powerpc" )) +else if (!strcmp (arch,NORM_POWERPC )) path_list = powerpc_triplets; -else if (!strcmp (arch,"sh" )) +else if (!strcmp (arch,NORM_SH )) path_list = sh_triplets; -else if (!strcmp (arch,"s390" )) +else if (!strcmp (arch,NORM_S390 )) path_list = s390_triplets; -else if (!strcmp (arch,"sparc" )) +else if (!strcmp (arch,NORM_SPARC )) path_list = sparc_triplets; -else if (!strcmp (arch,"x86" )) +else if (!strcmp (arch,NORM_X86 )) path_list = x86_triplets; -else if (!strcmp (arch,"mips" )) +else if (!strcmp (arch,NORM_MIPS )) path_list = mips_triplets;else {ui__error ("binutils for %s not supported.\n" , arch);
tools/perf/arch/common.h +11 -0
@@ -5,6 +5,17 @@extern const char *objdump_path; +/* Macro for normalized arch names */ +#define NORM_X86 "x86" +#define NORM_SPARC "sparc" +#define NORM_ARM64 "arm64" +#define NORM_ARM "arm" +#define NORM_S390 "s390" +#define NORM_PARISC "parisc" +#define NORM_POWERPC "powerpc" +#define NORM_MIPS "mips" +#define NORM_SH "sh" +int perf_env__lookup_objdump (struct perf_env *env);const char *normalize_arch (char *arch);
tools/perf/util/unwind-libunwind.c +2 -2
@@ -40,10 +40,10 @@ int unwind__prepare_access(struct thread *thread, struct map *map, arch =normalize_arch (thread->mg->machine->env->arch); -if (!strcmp (arch,"x86" )) { +if (!strcmp (arch,NORM_X86 )) {if (dso_type !=DSO__TYPE_64BIT ) ops = x86_32_unwind_libunwind_ops; - }else if (!strcmp (arch,"arm64" ) || !strcmp (arch,"arm" )) { + }else if (!strcmp (arch,NORM_ARM64 ) || !strcmp (arch,NORM_ARM )) {if (dso_type ==DSO__TYPE_64BIT ) ops = arm64_unwind_libunwind_ops; }
Signature · 1 line
2.5.5
PATCH v6 2/7 perf annotate: Add cross arch annotate support
In reply to Ravi BangoriaChange current data structures and function to enable cross arch annotate.
Current perf implementation does not support cross arch annotate. To make it truly cross arch, instruction table of all arch should be present in perf binary. And use appropriate table based on arch where perf.data was recorded.
---
Changes in v6:
- Instead of adding only those instructions defined in #ifdef __arm__, add all instructions from default table to arm table.
tools/perf/builtin-top.c | 2 +- tools/perf/ui/browsers/annotate.c | 3 +- tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/util/annotate.c | 187 ++++++++++++++++++++++++++++++-------- tools/perf/util/annotate.h | 5 +- 5 files changed, 157 insertions(+), 42 deletions(-)
tools/perf/builtin-top.c +1 -1
@@ -129,7 +129,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)return err; } - err =symbol__disassemble (sym, map,0 ); + err =symbol__disassemble (sym, map,0 ,NULL );if (err ==0 ) { out_assign: top->sym_filter_entry = he;
tools/perf/ui/browsers/annotate.c +2 -1
@@ -1050,7 +1050,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, (nr_pcnt -1 ); } - err =symbol__disassemble (sym, map, sizeof_bdl); + err =symbol__disassemble (sym, map, sizeof_bdl, +perf_evsel__env_arch (evsel));if (err) {char msg[BUFSIZ ];symbol__strerror_disassemble (sym, map, err, msg,sizeof (msg));
tools/perf/ui/gtk/annotate.c +1 -1
@@ -167,7 +167,7 @@ static int symbol__gtk_annotate(struct symbol *sym, struct map *map,if (map->dso->annotate_warned)return -1 ; - err =symbol__disassemble (sym, map,0 ); + err =symbol__disassemble (sym, map,0 ,perf_evsel__env_arch (evsel));if (err) {char msg[BUFSIZ ];symbol__strerror_disassemble (sym, map, err, msg,sizeof (msg));
tools/perf/util/annotate.c +150 -37
343 lines not on this page · raw message
tools/perf/util/annotate.h +3 -2
@@ -36,7 +36,7 @@ struct ins_operands {struct ins_ops {void (*free)(struct ins_operands *ops); -int (*parse)(struct ins_operands *ops); +int (*parse)(struct ins_operands *ops,const char *norm_arch);int (*scnprintf)(struct ins *ins,char *bf,size_t size,struct ins_operands *ops); };
@@ -155,7 +155,8 @@ int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 addr);int symbol__alloc_hist (struct symbol *sym);void symbol__annotate_zero_histograms (struct symbol *sym); -int symbol__disassemble (struct symbol *sym,struct map *map,size_t privsize); +int symbol__disassemble (struct symbol *sym,struct map *map,size_t privsize, +char *arch);enum symbol_disassemble_errno {SYMBOL_ANNOTATE_ERRNO__SUCCESS =0 ,
Signature · 1 line
2.5.5
Re: [PATCH v6 2/7] perf annotate: Add cross arch annotate support
Quoted 3 lines · On Fri, 19 Aug 2016 18:29:33 +0530 Ravi Bangoria…
Changes in v6:
- Instead of adding only those instructions defined in #ifdef__arm__, add all instructions from default table to arm table.
..
Quoted 21 lines
(quoted diff) +2
-3+static struct ins instructions_arm[] = { { .name = "add", .ops = &mov_ops, }, { .name = "addl", .ops = &mov_ops, }, { .name = "addq", .ops = &mov_ops, }, { .name = "addw", .ops = &mov_ops, }, { .name = "and", .ops = &mov_ops, }, -#ifdef __arm__ - { .name = "b", .ops = &jump_ops, }, // might also be a call + { .name = "b", .ops = &jump_ops, }, /* might also be a call */ { .name = "bcc", .ops = &jump_ops, }, { .name = "bcs", .ops = &jump_ops, }, { .name = "beq", .ops = &jump_ops, },@@ -382,7 +462,6 @@ static struct ins instructions[] = { { .name = "blt", .ops = &jump_ops, }, { .name = "blx", .ops = &call_ops, }, { .name = "bne", .ops = &jump_ops, }, -#endif { .name = "bts", .ops = &mov_ops, }, { .name = "call", .ops = &call_ops, }, { .name = "callq", .ops = &call_ops, },
Review static int ins__cmp(const void *a, const void *b) · line 551
Quoted 2 lines
(quoted diff) +0
-0@@ -471,24 +550,48 @@ static int ins__cmp(const void *a, const void *b) return strcmp(ia->name, ib->name); }
Thanks, I've gone through the list and removed all not-ARM instructions, and added some missing ARM branch instructions:
tools/perf/util/annotate.c +6 -70
@@ -451,9 +451,6 @@ static struct ins instructions_x86[] = {static struct ins instructions_arm[] = { { .name ="add" , .ops = &mov_ops, }, - { .name ="addl" , .ops = &mov_ops, }, - { .name ="addq" , .ops = &mov_ops, }, - { .name ="addw" , .ops = &mov_ops, }, { .name ="and" , .ops = &mov_ops, }, { .name ="b" , .ops = &jump_ops, },/* might also be a call */ { .name ="bcc" , .ops = &jump_ops, },
@@ -463,81 +460,20 @@ static struct ins instructions_arm[] = { { .name = "bgt", .ops = &jump_ops, }, { .name = "bhi", .ops = &jump_ops, }, { .name = "bl", .ops = &call_ops, }, + { .name = "ble", .ops = &jump_ops, }, + { .name = "bleq", .ops = &call_ops, }, + { .name = "blne", .ops = &call_ops, }, { .name = "bls", .ops = &jump_ops, }, { .name = "blt", .ops = &jump_ops, }, { .name = "blx", .ops = &call_ops, }, + { .name = "blxne", .ops = &call_ops, }, + { .name = "bmi", .ops = &jump_ops, }, { .name = "bne", .ops = &jump_ops, }, - { .name = "bts", .ops = &mov_ops, }, - { .name = "call", .ops = &call_ops, }, - { .name = "callq", .ops = &call_ops, }, + { .name = "bpl", .ops = &jump_ops, }, { .name = "cmp", .ops = &mov_ops, }, - { .name = "cmpb", .ops = &mov_ops, }, - { .name = "cmpl", .ops = &mov_ops, }, - { .name = "cmpq", .ops = &mov_ops, }, - { .name = "cmpw", .ops = &mov_ops, }, - { .name = "cmpxch", .ops = &mov_ops, }, - { .name = "dec", .ops = &dec_ops, }, - { .name = "decl", .ops = &dec_ops, }, - { .name = "imul", .ops = &mov_ops, }, - { .name = "inc", .ops = &dec_ops, }, - { .name = "incl", .ops = &dec_ops, }, - { .name = "ja", .ops = &jump_ops, }, - { .name = "jae", .ops = &jump_ops, }, - { .name = "jb", .ops = &jump_ops, }, - { .name = "jbe", .ops = &jump_ops, }, - { .name = "jc", .ops = &jump_ops, }, - { .name = "jcxz", .ops = &jump_ops, }, - { .name = "je", .ops = &jump_ops, }, - { .name = "jecxz", .ops = &jump_ops, }, - { .name = "jg", .ops = &jump_ops, }, - { .name = "jge", .ops = &jump_ops, }, - { .name = "jl", .ops = &jump_ops, }, - { .name = "jle", .ops = &jump_ops, }, - { .name = "jmp", .ops = &jump_ops, }, - { .name = "jmpq", .ops = &jump_ops, }, - { .name = "jna", .ops = &jump_ops, }, - { .name = "jnae", .ops = &jump_ops, }, - { .name = "jnb", .ops = &jump_ops, }, - { .name = "jnbe", .ops = &jump_ops, }, - { .name = "jnc", .ops = &jump_ops, }, - { .name = "jne", .ops = &jump_ops, }, - { .name = "jng", .ops = &jump_ops, }, - { .name = "jnge", .ops = &jump_ops, }, - { .name = "jnl", .ops = &jump_ops, }, - { .name = "jnle", .ops = &jump_ops, }, - { .name = "jno", .ops = &jump_ops, }, - { .name = "jnp", .ops = &jump_ops, }, - { .name = "jns", .ops = &jump_ops, }, - { .name = "jnz", .ops = &jump_ops, }, - { .name = "jo", .ops = &jump_ops, }, - { .name = "jp", .ops = &jump_ops, }, - { .name = "jpe", .ops = &jump_ops, }, - { .name = "jpo", .ops = &jump_ops, }, - { .name = "jrcxz", .ops = &jump_ops, }, - { .name = "js", .ops = &jump_ops, }, - { .name = "jz", .ops = &jump_ops, }, - { .name = "lea", .ops = &mov_ops, }, - { .name = "lock", .ops = &lock_ops, }, { .name = "mov", .ops = &mov_ops, }, - { .name = "movb", .ops = &mov_ops, }, - { .name = "movdqa",.ops = &mov_ops, }, - { .name = "movl", .ops = &mov_ops, }, - { .name = "movq", .ops = &mov_ops, }, - { .name = "movslq", .ops = &mov_ops, }, - { .name = "movzbl", .ops = &mov_ops, }, - { .name = "movzwl", .ops = &mov_ops, }, { .name = "nop", .ops = &nop_ops, }, - { .name = "nopl", .ops = &nop_ops, }, - { .name = "nopw", .ops = &nop_ops, }, { .name = "or", .ops = &mov_ops, }, - { .name = "orl", .ops = &mov_ops, }, - { .name = "test", .ops = &mov_ops, }, - { .name = "testb", .ops = &mov_ops, }, - { .name = "testl", .ops = &mov_ops, }, - { .name = "xadd", .ops = &mov_ops, }, - { .name = "xbeginl", .ops = &jump_ops, }, - { .name = "xbeginq", .ops = &jump_ops, }, - { .name = "retq", .ops = &ret_ops, }, }; struct instructions_powerpc {
Ideally ARM would - like this powerpc implementation - add a ins__find_arm() to handle its condition codes, but, for now, is it possible to merge this change into this series? I can post a follow-up patch if not.
Thanks,
Kim
Namhyung Kim
maintainerRe: [PATCH v6 2/7] perf annotate: Add cross arch annotate support
Hello,
Quoted 25 lines · Kim Phillips
Quoted 3 lines · On Fri, 19 Aug 2016 18:29:33 +0530 Ravi Bangoria…
Changes in v6:
- Instead of adding only those instructions defined in #ifdef__arm__, add all instructions from default table to arm table...
Quoted 18 lines
tools/perf/util/annotate.c +2
-3+static struct ins instructions_arm[] = { { .name ="add" , .ops = &mov_ops, }, { .name ="addl" , .ops = &mov_ops, }, { .name ="addq" , .ops = &mov_ops, }, { .name ="addw" , .ops = &mov_ops, }, { .name ="and" , .ops = &mov_ops, }, -#ifdef __arm__ - { .name = "b", .ops = &jump_ops, }, // might also be a call + { .name ="b" , .ops = &jump_ops, },/* might also be a call */ { .name ="bcc" , .ops = &jump_ops, }, { .name ="bcs" , .ops = &jump_ops, }, { .name ="beq" , .ops = &jump_ops, },@@ -382,7 +462,6 @@ static struct ins instructions[] = { { .name = "blt", .ops = &jump_ops, }, { .name = "blx", .ops = &call_ops, }, { .name = "bne", .ops = &jump_ops, }, -#endif { .name = "bts", .ops = &mov_ops, },
Quoted 8 lines
Review static int ins__cmp(const void *a, const void *b) · line 551
Quoted 5 lines
(quoted diff) +0
-0{ .name = "call", .ops = &call_ops, }, { .name = "callq", .ops = &call_ops, },@@ -471,24 +550,48 @@ static int ins__cmp(const void *a, const void *b) return strcmp(ia->name, ib->name); }Thanks, I've gone through the list and removed all not-ARM instructions, and added some missing ARM branch instructions:
Can we use regex patterns instead?
Thanks
Namhyung
Quoted 112 lines
tools/perf/util/annotate.c +6
-70@@ -451,9 +451,6 @@ static struct ins instructions_x86[] = {static struct ins instructions_arm[] = { { .name ="add" , .ops = &mov_ops, }, - { .name ="addl" , .ops = &mov_ops, }, - { .name ="addq" , .ops = &mov_ops, }, - { .name ="addw" , .ops = &mov_ops, }, { .name ="and" , .ops = &mov_ops, }, { .name ="b" , .ops = &jump_ops, },/* might also be a call */ { .name ="bcc" , .ops = &jump_ops, },@@ -463,81 +460,20 @@ static struct ins instructions_arm[] = { { .name = "bgt", .ops = &jump_ops, }, { .name = "bhi", .ops = &jump_ops, }, { .name = "bl", .ops = &call_ops, }, + { .name = "ble", .ops = &jump_ops, }, + { .name = "bleq", .ops = &call_ops, }, + { .name = "blne", .ops = &call_ops, }, { .name = "bls", .ops = &jump_ops, }, { .name = "blt", .ops = &jump_ops, }, { .name = "blx", .ops = &call_ops, }, + { .name = "blxne", .ops = &call_ops, }, + { .name = "bmi", .ops = &jump_ops, }, { .name = "bne", .ops = &jump_ops, }, - { .name = "bts", .ops = &mov_ops, }, - { .name = "call", .ops = &call_ops, }, - { .name = "callq", .ops = &call_ops, }, + { .name = "bpl", .ops = &jump_ops, }, { .name = "cmp", .ops = &mov_ops, }, - { .name = "cmpb", .ops = &mov_ops, }, - { .name = "cmpl", .ops = &mov_ops, }, - { .name = "cmpq", .ops = &mov_ops, }, - { .name = "cmpw", .ops = &mov_ops, }, - { .name = "cmpxch", .ops = &mov_ops, }, - { .name = "dec", .ops = &dec_ops, }, - { .name = "decl", .ops = &dec_ops, }, - { .name = "imul", .ops = &mov_ops, }, - { .name = "inc", .ops = &dec_ops, }, - { .name = "incl", .ops = &dec_ops, }, - { .name = "ja", .ops = &jump_ops, }, - { .name = "jae", .ops = &jump_ops, }, - { .name = "jb", .ops = &jump_ops, }, - { .name = "jbe", .ops = &jump_ops, }, - { .name = "jc", .ops = &jump_ops, }, - { .name = "jcxz", .ops = &jump_ops, }, - { .name = "je", .ops = &jump_ops, }, - { .name = "jecxz", .ops = &jump_ops, }, - { .name = "jg", .ops = &jump_ops, }, - { .name = "jge", .ops = &jump_ops, }, - { .name = "jl", .ops = &jump_ops, }, - { .name = "jle", .ops = &jump_ops, }, - { .name = "jmp", .ops = &jump_ops, }, - { .name = "jmpq", .ops = &jump_ops, }, - { .name = "jna", .ops = &jump_ops, }, - { .name = "jnae", .ops = &jump_ops, }, - { .name = "jnb", .ops = &jump_ops, }, - { .name = "jnbe", .ops = &jump_ops, }, - { .name = "jnc", .ops = &jump_ops, }, - { .name = "jne", .ops = &jump_ops, }, - { .name = "jng", .ops = &jump_ops, }, - { .name = "jnge", .ops = &jump_ops, }, - { .name = "jnl", .ops = &jump_ops, }, - { .name = "jnle", .ops = &jump_ops, }, - { .name = "jno", .ops = &jump_ops, }, - { .name = "jnp", .ops = &jump_ops, }, - { .name = "jns", .ops = &jump_ops, }, - { .name = "jnz", .ops = &jump_ops, }, - { .name = "jo", .ops = &jump_ops, }, - { .name = "jp", .ops = &jump_ops, }, - { .name = "jpe", .ops = &jump_ops, }, - { .name = "jpo", .ops = &jump_ops, }, - { .name = "jrcxz", .ops = &jump_ops, }, - { .name = "js", .ops = &jump_ops, }, - { .name = "jz", .ops = &jump_ops, }, - { .name = "lea", .ops = &mov_ops, }, - { .name = "lock", .ops = &lock_ops, }, { .name = "mov", .ops = &mov_ops, }, - { .name = "movb", .ops = &mov_ops, }, - { .name = "movdqa",.ops = &mov_ops, }, - { .name = "movl", .ops = &mov_ops, }, - { .name = "movq", .ops = &mov_ops, }, - { .name = "movslq", .ops = &mov_ops, }, - { .name = "movzbl", .ops = &mov_ops, }, - { .name = "movzwl", .ops = &mov_ops, }, { .name = "nop", .ops = &nop_ops, }, - { .name = "nopl", .ops = &nop_ops, }, - { .name = "nopw", .ops = &nop_ops, }, { .name = "or", .ops = &mov_ops, }, - { .name = "orl", .ops = &mov_ops, }, - { .name = "test", .ops = &mov_ops, }, - { .name = "testb", .ops = &mov_ops, }, - { .name = "testl", .ops = &mov_ops, }, - { .name = "xadd", .ops = &mov_ops, }, - { .name = "xbeginl", .ops = &jump_ops, }, - { .name = "xbeginq", .ops = &jump_ops, }, - { .name = "retq", .ops = &ret_ops, }, }; struct instructions_powerpc {Ideally ARM would - like this powerpc implementation - add a
ins__find_arm()to handle its condition codes, but, for now, is it possible to merge this change into this series? I can post a follow-up patch if not.Thanks,
Kim
Re: [PATCH v6 2/7] perf annotate: Add cross arch annotate support
Quoted 11 lines · On Tue, 23 Aug 2016 11:17:16 +0900 Namhyung Kim <[email protected]> wrote:
Quoted 8 lines · Kim Phillips
Quoted 3 lines · On Fri, 19 Aug 2016 18:29:33 +0530 Ravi Bangoria…
Changes in v6:
- Instead of adding only those instructions defined in #ifdef__arm__, add all instructions from default table to arm table.Thanks, I've gone through the list and removed all not-ARM instructions, and added some missing ARM branch instructions:
Can we use regex patterns instead?
Yes, that helps prevent mistakes updating instruction lists - how does this look?:
tools/perf/util/annotate.c +67 -110
@@ -26,6 +26,7 @@const char *disassembler_style;const char *objdump_path;static regex_t file_lineno; +static regex_t arm_call_insn, arm_jump_insn;static struct ins *ins__find (const char *name,const char *norm_arch);static int disasm_line__parse (char *line,char **namep,char **rawp);
@@ -449,98 +450,7 @@ static struct ins instructions_x86[] = { { .name = "retq", .ops = &ret_ops, }, }; -static struct ins instructions_arm[] = { - { .name ="add" , .ops = &mov_ops, }, - { .name ="addl" , .ops = &mov_ops, }, - { .name ="addq" , .ops = &mov_ops, }, - { .name ="addw" , .ops = &mov_ops, }, - { .name ="and" , .ops = &mov_ops, }, - { .name ="b" , .ops = &jump_ops, },/* might also be a call */ - { .name ="bcc" , .ops = &jump_ops, }, - { .name ="bcs" , .ops = &jump_ops, }, - { .name ="beq" , .ops = &jump_ops, }, - { .name ="bge" , .ops = &jump_ops, }, - { .name ="bgt" , .ops = &jump_ops, }, - { .name ="bhi" , .ops = &jump_ops, }, - { .name ="bl" , .ops = &call_ops, }, - { .name ="bls" , .ops = &jump_ops, }, - { .name ="blt" , .ops = &jump_ops, }, - { .name ="blx" , .ops = &call_ops, }, - { .name ="bne" , .ops = &jump_ops, }, - { .name ="bts" , .ops = &mov_ops, }, - { .name ="call" , .ops = &call_ops, }, - { .name ="callq" , .ops = &call_ops, }, - { .name ="cmp" , .ops = &mov_ops, }, - { .name ="cmpb" , .ops = &mov_ops, }, - { .name ="cmpl" , .ops = &mov_ops, }, - { .name ="cmpq" , .ops = &mov_ops, }, - { .name ="cmpw" , .ops = &mov_ops, }, - { .name ="cmpxch" , .ops = &mov_ops, }, - { .name ="dec" , .ops = &dec_ops, }, - { .name ="decl" , .ops = &dec_ops, }, - { .name ="imul" , .ops = &mov_ops, }, - { .name ="inc" , .ops = &dec_ops, }, - { .name ="incl" , .ops = &dec_ops, }, - { .name ="ja" , .ops = &jump_ops, }, - { .name ="jae" , .ops = &jump_ops, }, - { .name ="jb" , .ops = &jump_ops, }, - { .name ="jbe" , .ops = &jump_ops, }, - { .name ="jc" , .ops = &jump_ops, }, - { .name ="jcxz" , .ops = &jump_ops, }, - { .name ="je" , .ops = &jump_ops, }, - { .name ="jecxz" , .ops = &jump_ops, }, - { .name ="jg" , .ops = &jump_ops, }, - { .name ="jge" , .ops = &jump_ops, }, - { .name ="jl" , .ops = &jump_ops, }, - { .name ="jle" , .ops = &jump_ops, }, - { .name ="jmp" , .ops = &jump_ops, }, - { .name ="jmpq" , .ops = &jump_ops, }, - { .name ="jna" , .ops = &jump_ops, }, - { .name ="jnae" , .ops = &jump_ops, }, - { .name ="jnb" , .ops = &jump_ops, }, - { .name ="jnbe" , .ops = &jump_ops, }, - { .name ="jnc" , .ops = &jump_ops, }, - { .name ="jne" , .ops = &jump_ops, }, - { .name ="jng" , .ops = &jump_ops, }, - { .name ="jnge" , .ops = &jump_ops, }, - { .name ="jnl" , .ops = &jump_ops, }, - { .name ="jnle" , .ops = &jump_ops, }, - { .name ="jno" , .ops = &jump_ops, }, - { .name ="jnp" , .ops = &jump_ops, }, - { .name ="jns" , .ops = &jump_ops, }, - { .name ="jnz" , .ops = &jump_ops, }, - { .name ="jo" , .ops = &jump_ops, }, - { .name ="jp" , .ops = &jump_ops, }, - { .name ="jpe" , .ops = &jump_ops, }, - { .name ="jpo" , .ops = &jump_ops, }, - { .name ="jrcxz" , .ops = &jump_ops, }, - { .name ="js" , .ops = &jump_ops, }, - { .name ="jz" , .ops = &jump_ops, }, - { .name ="lea" , .ops = &mov_ops, }, - { .name ="lock" , .ops = &lock_ops, }, - { .name ="mov" , .ops = &mov_ops, }, - { .name ="movb" , .ops = &mov_ops, }, - { .name ="movdqa" ,.ops = &mov_ops, }, - { .name ="movl" , .ops = &mov_ops, }, - { .name ="movq" , .ops = &mov_ops, }, - { .name ="movslq" , .ops = &mov_ops, }, - { .name ="movzbl" , .ops = &mov_ops, }, - { .name ="movzwl" , .ops = &mov_ops, }, - { .name ="nop" , .ops = &nop_ops, }, - { .name ="nopl" , .ops = &nop_ops, }, - { .name ="nopw" , .ops = &nop_ops, }, - { .name ="or" , .ops = &mov_ops, }, - { .name ="orl" , .ops = &mov_ops, }, - { .name ="test" , .ops = &mov_ops, }, - { .name ="testb" , .ops = &mov_ops, }, - { .name ="testl" , .ops = &mov_ops, }, - { .name ="xadd" , .ops = &mov_ops, }, - { .name ="xbeginl" , .ops = &jump_ops, }, - { .name ="xbeginq" , .ops = &jump_ops, }, - { .name ="retq" , .ops = &ret_ops, }, -}; - -struct instructions_powerpc { +struct instructions_arch {struct ins *ins;struct list_head list; };
@@ -560,41 +470,41 @@ static int ins__cmp(const void *a, const void *b)return strcmp (ia->name, ib->name); } -static struct ins *list_add__ins_powerpc (struct instructions_powerpc *head, +static struct ins *list_add__ins_arch (struct instructions_arch *head,const char *name,struct ins_ops *ops) { -struct instructions_powerpc *ins_powerpc; +struct instructions_arch *ins_arch;struct ins *ins; ins =zalloc (sizeof (struct ins ));if (!ins)return NULL ; - ins_powerpc =zalloc (sizeof (struct instructions_powerpc )); -if (!ins_powerpc) + ins_arch =zalloc (sizeof (struct instructions_arch )); +if (!ins_arch) goto out_free_ins; ins->name =strdup (name);if (!ins->name) - goto out_free_ins_power; + goto out_free_ins_arch; ins->ops = ops; - ins_powerpc->ins = ins; -list_add_tail (&(ins_powerpc->list), &(head->list)); + ins_arch->ins = ins; +list_add_tail (&(ins_arch->list), &(head->list));return ins; -out_free_ins_power: -zfree (&ins_powerpc); +out_free_ins_arch: +zfree (&ins_arch); out_free_ins:zfree (&ins);return NULL ; } -static struct ins *list_search__ins_powerpc (struct instructions_powerpc *head, +static struct ins *list_search__ins_arch (struct instructions_arch *head,const char *name) { -struct instructions_powerpc *pos; +struct instructions_arch *pos;list_for_each_entry (pos, &head->list, list) {if (!strcmp (pos->ins->name, name))
@@ -608,7 +518,7 @@ static struct ins *ins__find_powerpc(const char *name)int i;struct ins *ins;struct ins_ops *ops; -static struct instructions_powerpc head; +static struct instructions_arch head;static bool list_initialized;/*
@@ -629,7 +539,7 @@ static struct ins *ins__find_powerpc(const char *name)/* * Return if we already have object of 'struct ins' for this instruction */ - ins =list_search__ins_powerpc (&head, name); + ins =list_search__ins_arch (&head, name);if (ins)return ins;
@@ -666,7 +576,44 @@ static struct ins *ins__find_powerpc(const char *name)* Add instruction to list so next time no need to * allocate memory for it. */ -return list_add__ins_powerpc (&head, name, ops); +return list_add__ins_arch (&head, name, ops); +} + +static struct ins *ins__find_arm (const char *name) +{ +struct ins *ins; +struct ins_ops *ops = &mov_ops; +static struct instructions_arch head; +static bool list_initialized; +regmatch_t match[2 ]; +int ret; + +if (!list_initialized) { +INIT_LIST_HEAD (&head.list); + list_initialized = true; + } + +/* +* Return if we already have object of 'struct ins' for this instruction +*/ + ins =list_search__ins_arch (&head, name); +if (ins) +return ins; + + ret =regexec (&arm_call_insn, name,2 , match,0 ); +if (!ret) { + ops = &call_ops; + }else { + ret =regexec (&arm_jump_insn, name,2 , match,0 ); +if (!ret) + ops = &jump_ops; + } + +/* +* Add instruction to list so next time no need to +* allocate memory for it. +*/ +return list_add__ins_arch (&head, name, ops); }static void ins__sort (struct ins *instructions,int nmemb)
@@ -686,15 +633,26 @@ static const char *annotate__norm_arch(char *arch)return normalize_arch (arch); } +#define ARM_CONDS "(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl|vc|vs)" +static struct ins *ins__find (const char *name,const char *norm_arch) {static bool sorted;struct ins *instructions; -int nmemb; +int nmemb, ret;if (!sorted) {ins__sort (instructions_x86,ARRAY_SIZE (instructions_x86)); -ins__sort (instructions_arm,ARRAY_SIZE (instructions_arm)); +if (!strcmp (norm_arch,NORM_ARM )) { + ret =regcomp (&arm_call_insn, +"^blx?" ARM_CONDS "?$" ,REG_EXTENDED ); + ret |=regcomp (&arm_jump_insn, +"^bx?" ARM_CONDS "?$" ,REG_EXTENDED ); +if (ret) { +pr_err ("regcomp failed\n" ); +return NULL ; + } + } sorted = true; }
@@ -702,8 +660,7 @@ static struct ins *ins__find(const char *name, const char *norm_arch) instructions = instructions_x86; nmemb =ARRAY_SIZE (instructions_x86); }else if (!strcmp (norm_arch,NORM_ARM )) { - instructions = instructions_arm; - nmemb =ARRAY_SIZE (instructions_arm); +return ins__find_arm (name); }else if (!strcmp (norm_arch,NORM_POWERPC )) {return ins__find_powerpc (name); }else {
Note that, for ARM, in order to match return instructions, 'lr' must be found to be the operand of the branch instruction, which is not contained in the 'name' variable passed to ins__find().
Kim
Namhyung Kim
maintainerRe: [PATCH v6 2/7] perf annotate: Add cross arch annotate support
Hi,
Quoted 10 lines · Kim Phillips
Quoted 7 lines · On Tue, 23 Aug 2016 11:17:16 +0900 Namhyung Kim <[email protected]> wrote:
Quoted 6 lines · Kim Phillips
Quoted 3 lines · On Fri, 19 Aug 2016 18:29:33 +0530 Ravi Bangoria…
Changes in v6:
- Instead of adding only those instructions defined in #ifdef__arm__, add all instructions from default table to arm table.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Thanks, I've gone through the list and removed all not-ARM instructions, and added some missing ARM branch instructions:
Can we use regex patterns instead?
Yes, that helps prevent mistakes updating instruction lists - how does this look?:
Much better!
Thanks,
Namhyung
Quoted 275 lines
tools/perf/util/annotate.c +67
-110@@ -26,6 +26,7 @@const char *disassembler_style;const char *objdump_path;static regex_t file_lineno; +static regex_t arm_call_insn, arm_jump_insn;static struct ins *ins__find (const char *name,const char *norm_arch);static int disasm_line__parse (char *line,char **namep,char **rawp);@@ -449,98 +450,7 @@ static struct ins instructions_x86[] = { { .name = "retq", .ops = &ret_ops, }, }; -static struct ins instructions_arm[] = { - { .name ="add" , .ops = &mov_ops, }, - { .name ="addl" , .ops = &mov_ops, }, - { .name ="addq" , .ops = &mov_ops, }, - { .name ="addw" , .ops = &mov_ops, }, - { .name ="and" , .ops = &mov_ops, }, - { .name ="b" , .ops = &jump_ops, },/* might also be a call */ - { .name ="bcc" , .ops = &jump_ops, }, - { .name ="bcs" , .ops = &jump_ops, }, - { .name ="beq" , .ops = &jump_ops, }, - { .name ="bge" , .ops = &jump_ops, }, - { .name ="bgt" , .ops = &jump_ops, }, - { .name ="bhi" , .ops = &jump_ops, }, - { .name ="bl" , .ops = &call_ops, }, - { .name ="bls" , .ops = &jump_ops, }, - { .name ="blt" , .ops = &jump_ops, }, - { .name ="blx" , .ops = &call_ops, }, - { .name ="bne" , .ops = &jump_ops, }, - { .name ="bts" , .ops = &mov_ops, }, - { .name ="call" , .ops = &call_ops, }, - { .name ="callq" , .ops = &call_ops, }, - { .name ="cmp" , .ops = &mov_ops, }, - { .name ="cmpb" , .ops = &mov_ops, }, - { .name ="cmpl" , .ops = &mov_ops, }, - { .name ="cmpq" , .ops = &mov_ops, }, - { .name ="cmpw" , .ops = &mov_ops, }, - { .name ="cmpxch" , .ops = &mov_ops, }, - { .name ="dec" , .ops = &dec_ops, }, - { .name ="decl" , .ops = &dec_ops, }, - { .name ="imul" , .ops = &mov_ops, }, - { .name ="inc" , .ops = &dec_ops, }, - { .name ="incl" , .ops = &dec_ops, }, - { .name ="ja" , .ops = &jump_ops, }, - { .name ="jae" , .ops = &jump_ops, }, - { .name ="jb" , .ops = &jump_ops, }, - { .name ="jbe" , .ops = &jump_ops, }, - { .name ="jc" , .ops = &jump_ops, }, - { .name ="jcxz" , .ops = &jump_ops, }, - { .name ="je" , .ops = &jump_ops, }, - { .name ="jecxz" , .ops = &jump_ops, }, - { .name ="jg" , .ops = &jump_ops, }, - { .name ="jge" , .ops = &jump_ops, }, - { .name ="jl" , .ops = &jump_ops, }, - { .name ="jle" , .ops = &jump_ops, }, - { .name ="jmp" , .ops = &jump_ops, }, - { .name ="jmpq" , .ops = &jump_ops, }, - { .name ="jna" , .ops = &jump_ops, }, - { .name ="jnae" , .ops = &jump_ops, }, - { .name ="jnb" , .ops = &jump_ops, }, - { .name ="jnbe" , .ops = &jump_ops, }, - { .name ="jnc" , .ops = &jump_ops, }, - { .name ="jne" , .ops = &jump_ops, }, - { .name ="jng" , .ops = &jump_ops, }, - { .name ="jnge" , .ops = &jump_ops, }, - { .name ="jnl" , .ops = &jump_ops, }, - { .name ="jnle" , .ops = &jump_ops, }, - { .name ="jno" , .ops = &jump_ops, }, - { .name ="jnp" , .ops = &jump_ops, }, - { .name ="jns" , .ops = &jump_ops, }, - { .name ="jnz" , .ops = &jump_ops, }, - { .name ="jo" , .ops = &jump_ops, }, - { .name ="jp" , .ops = &jump_ops, }, - { .name ="jpe" , .ops = &jump_ops, }, - { .name ="jpo" , .ops = &jump_ops, }, - { .name ="jrcxz" , .ops = &jump_ops, }, - { .name ="js" , .ops = &jump_ops, }, - { .name ="jz" , .ops = &jump_ops, }, - { .name ="lea" , .ops = &mov_ops, }, - { .name ="lock" , .ops = &lock_ops, }, - { .name ="mov" , .ops = &mov_ops, }, - { .name ="movb" , .ops = &mov_ops, }, - { .name ="movdqa" ,.ops = &mov_ops, }, - { .name ="movl" , .ops = &mov_ops, }, - { .name ="movq" , .ops = &mov_ops, }, - { .name ="movslq" , .ops = &mov_ops, }, - { .name ="movzbl" , .ops = &mov_ops, }, - { .name ="movzwl" , .ops = &mov_ops, }, - { .name ="nop" , .ops = &nop_ops, }, - { .name ="nopl" , .ops = &nop_ops, }, - { .name ="nopw" , .ops = &nop_ops, }, - { .name ="or" , .ops = &mov_ops, }, - { .name ="orl" , .ops = &mov_ops, }, - { .name ="test" , .ops = &mov_ops, }, - { .name ="testb" , .ops = &mov_ops, }, - { .name ="testl" , .ops = &mov_ops, }, - { .name ="xadd" , .ops = &mov_ops, }, - { .name ="xbeginl" , .ops = &jump_ops, }, - { .name ="xbeginq" , .ops = &jump_ops, }, - { .name ="retq" , .ops = &ret_ops, }, -}; - -struct instructions_powerpc { +struct instructions_arch {struct ins *ins;struct list_head list; };@@ -560,41 +470,41 @@ static int ins__cmp(const void *a, const void *b)return strcmp (ia->name, ib->name); } -static struct ins *list_add__ins_powerpc (struct instructions_powerpc *head, +static struct ins *list_add__ins_arch (struct instructions_arch *head,const char *name,struct ins_ops *ops) { -struct instructions_powerpc *ins_powerpc; +struct instructions_arch *ins_arch;struct ins *ins; ins =zalloc (sizeof (struct ins ));if (!ins)return NULL ; - ins_powerpc =zalloc (sizeof (struct instructions_powerpc )); -if (!ins_powerpc) + ins_arch =zalloc (sizeof (struct instructions_arch )); +if (!ins_arch) goto out_free_ins; ins->name =strdup (name);if (!ins->name) - goto out_free_ins_power; + goto out_free_ins_arch; ins->ops = ops; - ins_powerpc->ins = ins; -list_add_tail (&(ins_powerpc->list), &(head->list)); + ins_arch->ins = ins; +list_add_tail (&(ins_arch->list), &(head->list));return ins; -out_free_ins_power: -zfree (&ins_powerpc); +out_free_ins_arch: +zfree (&ins_arch); out_free_ins:zfree (&ins);return NULL ; } -static struct ins *list_search__ins_powerpc (struct instructions_powerpc *head, +static struct ins *list_search__ins_arch (struct instructions_arch *head,const char *name) { -struct instructions_powerpc *pos; +struct instructions_arch *pos;list_for_each_entry (pos, &head->list, list) {if (!strcmp (pos->ins->name, name))@@ -608,7 +518,7 @@ static struct ins *ins__find_powerpc(const char *name)int i;struct ins *ins;struct ins_ops *ops; -static struct instructions_powerpc head; +static struct instructions_arch head;static bool list_initialized;/* @@ -629,7 +539,7 @@ static struct ins *ins__find_powerpc(const char *name)/* * Return if we already have object of 'struct ins' for this instruction */ - ins =list_search__ins_powerpc (&head, name); + ins =list_search__ins_arch (&head, name);if (ins)return ins;@@ -666,7 +576,44 @@ static struct ins *ins__find_powerpc(const char *name)* Add instruction to list so next time no need to * allocate memory for it. */ -return list_add__ins_powerpc (&head, name, ops); +return list_add__ins_arch (&head, name, ops); +} + +static struct ins *ins__find_arm (const char *name) +{ +struct ins *ins; +struct ins_ops *ops = &mov_ops; +static struct instructions_arch head; +static bool list_initialized; +regmatch_t match[2 ]; +int ret; + +if (!list_initialized) { +INIT_LIST_HEAD (&head.list); + list_initialized = true; + } + +/* +* Return if we already have object of 'struct ins' for this instruction +*/ + ins =list_search__ins_arch (&head, name); +if (ins) +return ins; + + ret =regexec (&arm_call_insn, name,2 , match,0 ); +if (!ret) { + ops = &call_ops; + }else { + ret =regexec (&arm_jump_insn, name,2 , match,0 ); +if (!ret) + ops = &jump_ops; + } + +/* +* Add instruction to list so next time no need to +* allocate memory for it. +*/ +return list_add__ins_arch (&head, name, ops); }static void ins__sort (struct ins *instructions,int nmemb)@@ -686,15 +633,26 @@ static const char *annotate__norm_arch(char *arch)return normalize_arch (arch); } +#define ARM_CONDS "(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl|vc|vs)" +static struct ins *ins__find (const char *name,const char *norm_arch) {static bool sorted;struct ins *instructions; -int nmemb; +int nmemb, ret;if (!sorted) {ins__sort (instructions_x86,ARRAY_SIZE (instructions_x86)); -ins__sort (instructions_arm,ARRAY_SIZE (instructions_arm)); +if (!strcmp (norm_arch,NORM_ARM )) { + ret =regcomp (&arm_call_insn, +"^blx?" ARM_CONDS "?$" ,REG_EXTENDED ); + ret |=regcomp (&arm_jump_insn, +"^bx?" ARM_CONDS "?$" ,REG_EXTENDED ); +if (ret) { +pr_err ("regcomp failed\n" ); +return NULL ; + } + } sorted = true; }@@ -702,8 +660,7 @@ static struct ins *ins__find(const char *name, const char *norm_arch) instructions = instructions_x86; nmemb =ARRAY_SIZE (instructions_x86); }else if (!strcmp (norm_arch,NORM_ARM )) { - instructions = instructions_arm; - nmemb =ARRAY_SIZE (instructions_arm); +return ins__find_arm (name); }else if (!strcmp (norm_arch,NORM_POWERPC )) {return ins__find_powerpc (name); }else {Note that, for ARM, in order to match return instructions, 'lr' must be found to be the operand of the branch instruction, which is not contained in the 'name' variable passed to
ins__find().Kim
Re: [PATCH v6 2/7] perf annotate: Add cross arch annotate support
In reply to Kim PhillipsHi Kim,
I've tested your patch on x86 and powerpc and it looks fine to me. Can you please put your signed-off-by.
Please add Act-by: Ravi Bangoria <[email protected]> as well.
Regards,
-Ravi
Quoted 291 lines · Kim Phillips
Quoted 10 lines · On Tue, 23 Aug 2016 11:17:16 +0900 Namhyung Kim <[email protected]> wrote:
Quoted 8 lines · Kim Phillips
Quoted 3 lines · On Fri, 19 Aug 2016 18:29:33 +0530 Ravi Bangoria…
Changes in v6:
- Instead of adding only those instructions defined in #ifdef__arm__, add all instructions from default table to arm table.Thanks, I've gone through the list and removed all not-ARM instructions, and added some missing ARM branch instructions:
Can we use regex patterns instead?
Yes, that helps prevent mistakes updating instruction lists - how does this look?:
tools/perf/util/annotate.c +67
-110@@ -26,6 +26,7 @@const char *disassembler_style;const char *objdump_path;static regex_t file_lineno; +static regex_t arm_call_insn, arm_jump_insn;static struct ins *ins__find (const char *name,const char *norm_arch);static int disasm_line__parse (char *line,char **namep,char **rawp);@@ -449,98 +450,7 @@ static struct ins instructions_x86[] = { { .name = "retq", .ops = &ret_ops, }, }; -static struct ins instructions_arm[] = { - { .name ="add" , .ops = &mov_ops, }, - { .name ="addl" , .ops = &mov_ops, }, - { .name ="addq" , .ops = &mov_ops, }, - { .name ="addw" , .ops = &mov_ops, }, - { .name ="and" , .ops = &mov_ops, }, - { .name ="b" , .ops = &jump_ops, },/* might also be a call */ - { .name ="bcc" , .ops = &jump_ops, }, - { .name ="bcs" , .ops = &jump_ops, }, - { .name ="beq" , .ops = &jump_ops, }, - { .name ="bge" , .ops = &jump_ops, }, - { .name ="bgt" , .ops = &jump_ops, }, - { .name ="bhi" , .ops = &jump_ops, }, - { .name ="bl" , .ops = &call_ops, }, - { .name ="bls" , .ops = &jump_ops, }, - { .name ="blt" , .ops = &jump_ops, }, - { .name ="blx" , .ops = &call_ops, }, - { .name ="bne" , .ops = &jump_ops, }, - { .name ="bts" , .ops = &mov_ops, }, - { .name ="call" , .ops = &call_ops, }, - { .name ="callq" , .ops = &call_ops, }, - { .name ="cmp" , .ops = &mov_ops, }, - { .name ="cmpb" , .ops = &mov_ops, }, - { .name ="cmpl" , .ops = &mov_ops, }, - { .name ="cmpq" , .ops = &mov_ops, }, - { .name ="cmpw" , .ops = &mov_ops, }, - { .name ="cmpxch" , .ops = &mov_ops, }, - { .name ="dec" , .ops = &dec_ops, }, - { .name ="decl" , .ops = &dec_ops, }, - { .name ="imul" , .ops = &mov_ops, }, - { .name ="inc" , .ops = &dec_ops, }, - { .name ="incl" , .ops = &dec_ops, }, - { .name ="ja" , .ops = &jump_ops, }, - { .name ="jae" , .ops = &jump_ops, }, - { .name ="jb" , .ops = &jump_ops, }, - { .name ="jbe" , .ops = &jump_ops, }, - { .name ="jc" , .ops = &jump_ops, }, - { .name ="jcxz" , .ops = &jump_ops, }, - { .name ="je" , .ops = &jump_ops, }, - { .name ="jecxz" , .ops = &jump_ops, }, - { .name ="jg" , .ops = &jump_ops, }, - { .name ="jge" , .ops = &jump_ops, }, - { .name ="jl" , .ops = &jump_ops, }, - { .name ="jle" , .ops = &jump_ops, }, - { .name ="jmp" , .ops = &jump_ops, }, - { .name ="jmpq" , .ops = &jump_ops, }, - { .name ="jna" , .ops = &jump_ops, }, - { .name ="jnae" , .ops = &jump_ops, }, - { .name ="jnb" , .ops = &jump_ops, }, - { .name ="jnbe" , .ops = &jump_ops, }, - { .name ="jnc" , .ops = &jump_ops, }, - { .name ="jne" , .ops = &jump_ops, }, - { .name ="jng" , .ops = &jump_ops, }, - { .name ="jnge" , .ops = &jump_ops, }, - { .name ="jnl" , .ops = &jump_ops, }, - { .name ="jnle" , .ops = &jump_ops, }, - { .name ="jno" , .ops = &jump_ops, }, - { .name ="jnp" , .ops = &jump_ops, }, - { .name ="jns" , .ops = &jump_ops, }, - { .name ="jnz" , .ops = &jump_ops, }, - { .name ="jo" , .ops = &jump_ops, }, - { .name ="jp" , .ops = &jump_ops, }, - { .name ="jpe" , .ops = &jump_ops, }, - { .name ="jpo" , .ops = &jump_ops, }, - { .name ="jrcxz" , .ops = &jump_ops, }, - { .name ="js" , .ops = &jump_ops, }, - { .name ="jz" , .ops = &jump_ops, }, - { .name ="lea" , .ops = &mov_ops, }, - { .name ="lock" , .ops = &lock_ops, }, - { .name ="mov" , .ops = &mov_ops, }, - { .name ="movb" , .ops = &mov_ops, }, - { .name ="movdqa" ,.ops = &mov_ops, }, - { .name ="movl" , .ops = &mov_ops, }, - { .name ="movq" , .ops = &mov_ops, }, - { .name ="movslq" , .ops = &mov_ops, }, - { .name ="movzbl" , .ops = &mov_ops, }, - { .name ="movzwl" , .ops = &mov_ops, }, - { .name ="nop" , .ops = &nop_ops, }, - { .name ="nopl" , .ops = &nop_ops, }, - { .name ="nopw" , .ops = &nop_ops, }, - { .name ="or" , .ops = &mov_ops, }, - { .name ="orl" , .ops = &mov_ops, }, - { .name ="test" , .ops = &mov_ops, }, - { .name ="testb" , .ops = &mov_ops, }, - { .name ="testl" , .ops = &mov_ops, }, - { .name ="xadd" , .ops = &mov_ops, }, - { .name ="xbeginl" , .ops = &jump_ops, }, - { .name ="xbeginq" , .ops = &jump_ops, }, - { .name ="retq" , .ops = &ret_ops, }, -}; - -struct instructions_powerpc { +struct instructions_arch {struct ins *ins;struct list_head list; };@@ -560,41 +470,41 @@ static int ins__cmp(const void *a, const void *b)return strcmp (ia->name, ib->name); } -static struct ins *list_add__ins_powerpc (struct instructions_powerpc *head, +static struct ins *list_add__ins_arch (struct instructions_arch *head,const char *name,struct ins_ops *ops) { -struct instructions_powerpc *ins_powerpc; +struct instructions_arch *ins_arch;struct ins *ins; ins =zalloc (sizeof (struct ins ));if (!ins)return NULL ; - ins_powerpc =zalloc (sizeof (struct instructions_powerpc )); -if (!ins_powerpc) + ins_arch =zalloc (sizeof (struct instructions_arch )); +if (!ins_arch) goto out_free_ins; ins->name =strdup (name);if (!ins->name) - goto out_free_ins_power; + goto out_free_ins_arch; ins->ops = ops; - ins_powerpc->ins = ins; -list_add_tail (&(ins_powerpc->list), &(head->list)); + ins_arch->ins = ins; +list_add_tail (&(ins_arch->list), &(head->list));return ins; -out_free_ins_power: -zfree (&ins_powerpc); +out_free_ins_arch: +zfree (&ins_arch); out_free_ins:zfree (&ins);return NULL ; } -static struct ins *list_search__ins_powerpc (struct instructions_powerpc *head, +static struct ins *list_search__ins_arch (struct instructions_arch *head,const char *name) { -struct instructions_powerpc *pos; +struct instructions_arch *pos;list_for_each_entry (pos, &head->list, list) {if (!strcmp (pos->ins->name, name))@@ -608,7 +518,7 @@ static struct ins *ins__find_powerpc(const char *name)int i;struct ins *ins;struct ins_ops *ops; -static struct instructions_powerpc head; +static struct instructions_arch head;static bool list_initialized;/* @@ -629,7 +539,7 @@ static struct ins *ins__find_powerpc(const char *name)/* * Return if we already have object of 'struct ins' for this instruction */ - ins =list_search__ins_powerpc (&head, name); + ins =list_search__ins_arch (&head, name);if (ins)return ins;@@ -666,7 +576,44 @@ static struct ins *ins__find_powerpc(const char *name)* Add instruction to list so next time no need to * allocate memory for it. */ -return list_add__ins_powerpc (&head, name, ops); +return list_add__ins_arch (&head, name, ops); +} + +static struct ins *ins__find_arm (const char *name) +{ +struct ins *ins; +struct ins_ops *ops = &mov_ops; +static struct instructions_arch head; +static bool list_initialized; +regmatch_t match[2 ]; +int ret; + +if (!list_initialized) { +INIT_LIST_HEAD (&head.list); + list_initialized = true; + } + +/* +* Return if we already have object of 'struct ins' for this instruction +*/ + ins =list_search__ins_arch (&head, name); +if (ins) +return ins; + + ret =regexec (&arm_call_insn, name,2 , match,0 ); +if (!ret) { + ops = &call_ops; + }else { + ret =regexec (&arm_jump_insn, name,2 , match,0 ); +if (!ret) + ops = &jump_ops; + } + +/* +* Add instruction to list so next time no need to +* allocate memory for it. +*/ +return list_add__ins_arch (&head, name, ops); }static void ins__sort (struct ins *instructions,int nmemb)@@ -686,15 +633,26 @@ static const char *annotate__norm_arch(char *arch)return normalize_arch (arch); } +#define ARM_CONDS "(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl|vc|vs)" +static struct ins *ins__find (const char *name,const char *norm_arch) {static bool sorted;struct ins *instructions; -int nmemb; +int nmemb, ret;if (!sorted) {ins__sort (instructions_x86,ARRAY_SIZE (instructions_x86)); -ins__sort (instructions_arm,ARRAY_SIZE (instructions_arm)); +if (!strcmp (norm_arch,NORM_ARM )) { + ret =regcomp (&arm_call_insn, +"^blx?" ARM_CONDS "?$" ,REG_EXTENDED ); + ret |=regcomp (&arm_jump_insn, +"^bx?" ARM_CONDS "?$" ,REG_EXTENDED ); +if (ret) { +pr_err ("regcomp failed\n" ); +return NULL ; + } + } sorted = true; }@@ -702,8 +660,7 @@ static struct ins *ins__find(const char *name, const char *norm_arch) instructions = instructions_x86; nmemb =ARRAY_SIZE (instructions_x86); }else if (!strcmp (norm_arch,NORM_ARM )) { - instructions = instructions_arm; - nmemb =ARRAY_SIZE (instructions_arm); +return ins__find_arm (name); }else if (!strcmp (norm_arch,NORM_POWERPC )) {return ins__find_powerpc (name); }else {Note that, for ARM, in order to match return instructions, 'lr' must be found to be the operand of the branch instruction, which is not contained in the 'name' variable passed to
ins__find().Kim
PATCH 1/1 perf annotate: cross arch annotate support fixes for ARM
For ARM we remove the list that contains non-arm insns, and instead add more maintainable branch instruction regex logic.
--- tools/perf/util/annotate.c | 177 +++++++++++++++++---------------------------- 1 file changed, 67 insertions(+), 110 deletions(-)
tools/perf/util/annotate.c +67 -110
@@ -26,6 +26,7 @@const char *disassembler_style;const char *objdump_path;static regex_t file_lineno; +static regex_t arm_call_insn, arm_jump_insn;static struct ins *ins__find (const char *name,const char *norm_arch);static int disasm_line__parse (char *line,char **namep,char **rawp);
@@ -449,98 +450,7 @@ static struct ins instructions_x86[] = { { .name = "retq", .ops = &ret_ops, }, }; -static struct ins instructions_arm[] = { - { .name ="add" , .ops = &mov_ops, }, - { .name ="addl" , .ops = &mov_ops, }, - { .name ="addq" , .ops = &mov_ops, }, - { .name ="addw" , .ops = &mov_ops, }, - { .name ="and" , .ops = &mov_ops, }, - { .name ="b" , .ops = &jump_ops, },/* might also be a call */ - { .name ="bcc" , .ops = &jump_ops, }, - { .name ="bcs" , .ops = &jump_ops, }, - { .name ="beq" , .ops = &jump_ops, }, - { .name ="bge" , .ops = &jump_ops, }, - { .name ="bgt" , .ops = &jump_ops, }, - { .name ="bhi" , .ops = &jump_ops, }, - { .name ="bl" , .ops = &call_ops, }, - { .name ="bls" , .ops = &jump_ops, }, - { .name ="blt" , .ops = &jump_ops, }, - { .name ="blx" , .ops = &call_ops, }, - { .name ="bne" , .ops = &jump_ops, }, - { .name ="bts" , .ops = &mov_ops, }, - { .name ="call" , .ops = &call_ops, }, - { .name ="callq" , .ops = &call_ops, }, - { .name ="cmp" , .ops = &mov_ops, }, - { .name ="cmpb" , .ops = &mov_ops, }, - { .name ="cmpl" , .ops = &mov_ops, }, - { .name ="cmpq" , .ops = &mov_ops, }, - { .name ="cmpw" , .ops = &mov_ops, }, - { .name ="cmpxch" , .ops = &mov_ops, }, - { .name ="dec" , .ops = &dec_ops, }, - { .name ="decl" , .ops = &dec_ops, }, - { .name ="imul" , .ops = &mov_ops, }, - { .name ="inc" , .ops = &dec_ops, }, - { .name ="incl" , .ops = &dec_ops, }, - { .name ="ja" , .ops = &jump_ops, }, - { .name ="jae" , .ops = &jump_ops, }, - { .name ="jb" , .ops = &jump_ops, }, - { .name ="jbe" , .ops = &jump_ops, }, - { .name ="jc" , .ops = &jump_ops, }, - { .name ="jcxz" , .ops = &jump_ops, }, - { .name ="je" , .ops = &jump_ops, }, - { .name ="jecxz" , .ops = &jump_ops, }, - { .name ="jg" , .ops = &jump_ops, }, - { .name ="jge" , .ops = &jump_ops, }, - { .name ="jl" , .ops = &jump_ops, }, - { .name ="jle" , .ops = &jump_ops, }, - { .name ="jmp" , .ops = &jump_ops, }, - { .name ="jmpq" , .ops = &jump_ops, }, - { .name ="jna" , .ops = &jump_ops, }, - { .name ="jnae" , .ops = &jump_ops, }, - { .name ="jnb" , .ops = &jump_ops, }, - { .name ="jnbe" , .ops = &jump_ops, }, - { .name ="jnc" , .ops = &jump_ops, }, - { .name ="jne" , .ops = &jump_ops, }, - { .name ="jng" , .ops = &jump_ops, }, - { .name ="jnge" , .ops = &jump_ops, }, - { .name ="jnl" , .ops = &jump_ops, }, - { .name ="jnle" , .ops = &jump_ops, }, - { .name ="jno" , .ops = &jump_ops, }, - { .name ="jnp" , .ops = &jump_ops, }, - { .name ="jns" , .ops = &jump_ops, }, - { .name ="jnz" , .ops = &jump_ops, }, - { .name ="jo" , .ops = &jump_ops, }, - { .name ="jp" , .ops = &jump_ops, }, - { .name ="jpe" , .ops = &jump_ops, }, - { .name ="jpo" , .ops = &jump_ops, }, - { .name ="jrcxz" , .ops = &jump_ops, }, - { .name ="js" , .ops = &jump_ops, }, - { .name ="jz" , .ops = &jump_ops, }, - { .name ="lea" , .ops = &mov_ops, }, - { .name ="lock" , .ops = &lock_ops, }, - { .name ="mov" , .ops = &mov_ops, }, - { .name ="movb" , .ops = &mov_ops, }, - { .name ="movdqa" ,.ops = &mov_ops, }, - { .name ="movl" , .ops = &mov_ops, }, - { .name ="movq" , .ops = &mov_ops, }, - { .name ="movslq" , .ops = &mov_ops, }, - { .name ="movzbl" , .ops = &mov_ops, }, - { .name ="movzwl" , .ops = &mov_ops, }, - { .name ="nop" , .ops = &nop_ops, }, - { .name ="nopl" , .ops = &nop_ops, }, - { .name ="nopw" , .ops = &nop_ops, }, - { .name ="or" , .ops = &mov_ops, }, - { .name ="orl" , .ops = &mov_ops, }, - { .name ="test" , .ops = &mov_ops, }, - { .name ="testb" , .ops = &mov_ops, }, - { .name ="testl" , .ops = &mov_ops, }, - { .name ="xadd" , .ops = &mov_ops, }, - { .name ="xbeginl" , .ops = &jump_ops, }, - { .name ="xbeginq" , .ops = &jump_ops, }, - { .name ="retq" , .ops = &ret_ops, }, -}; - -struct instructions_powerpc { +struct instructions_arch {struct ins *ins;struct list_head list; };
@@ -560,41 +470,41 @@ static int ins__cmp(const void *a, const void *b)return strcmp (ia->name, ib->name); } -static struct ins *list_add__ins_powerpc (struct instructions_powerpc *head, +static struct ins *list_add__ins_arch (struct instructions_arch *head,const char *name,struct ins_ops *ops) { -struct instructions_powerpc *ins_powerpc; +struct instructions_arch *ins_arch;struct ins *ins; ins =zalloc (sizeof (struct ins ));if (!ins)return NULL ; - ins_powerpc =zalloc (sizeof (struct instructions_powerpc )); -if (!ins_powerpc) + ins_arch =zalloc (sizeof (struct instructions_arch )); +if (!ins_arch) goto out_free_ins; ins->name =strdup (name);if (!ins->name) - goto out_free_ins_power; + goto out_free_ins_arch; ins->ops = ops; - ins_powerpc->ins = ins; -list_add_tail (&(ins_powerpc->list), &(head->list)); + ins_arch->ins = ins; +list_add_tail (&(ins_arch->list), &(head->list));return ins; -out_free_ins_power: -zfree (&ins_powerpc); +out_free_ins_arch: +zfree (&ins_arch); out_free_ins:zfree (&ins);return NULL ; } -static struct ins *list_search__ins_powerpc (struct instructions_powerpc *head, +static struct ins *list_search__ins_arch (struct instructions_arch *head,const char *name) { -struct instructions_powerpc *pos; +struct instructions_arch *pos;list_for_each_entry (pos, &head->list, list) {if (!strcmp (pos->ins->name, name))
@@ -608,7 +518,7 @@ static struct ins *ins__find_powerpc(const char *name)int i;struct ins *ins;struct ins_ops *ops; -static struct instructions_powerpc head; +static struct instructions_arch head;static bool list_initialized;/*
@@ -629,7 +539,7 @@ static struct ins *ins__find_powerpc(const char *name)/* * Return if we already have object of 'struct ins' for this instruction */ - ins =list_search__ins_powerpc (&head, name); + ins =list_search__ins_arch (&head, name);if (ins)return ins;
@@ -666,7 +576,44 @@ static struct ins *ins__find_powerpc(const char *name)* Add instruction to list so next time no need to * allocate memory for it. */ -return list_add__ins_powerpc (&head, name, ops); +return list_add__ins_arch (&head, name, ops); +} + +static struct ins *ins__find_arm (const char *name) +{ +struct ins *ins; +struct ins_ops *ops = &mov_ops; +static struct instructions_arch head; +static bool list_initialized; +regmatch_t match[2 ]; +int ret; + +if (!list_initialized) { +INIT_LIST_HEAD (&head.list); + list_initialized = true; + } + +/* +* Return if we already have object of 'struct ins' for this instruction +*/ + ins =list_search__ins_arch (&head, name); +if (ins) +return ins; + + ret =regexec (&arm_call_insn, name,2 , match,0 ); +if (!ret) { + ops = &call_ops; + }else { + ret =regexec (&arm_jump_insn, name,2 , match,0 ); +if (!ret) + ops = &jump_ops; + } + +/* +* Add instruction to list so next time no need to +* allocate memory for it. +*/ +return list_add__ins_arch (&head, name, ops); }static void ins__sort (struct ins *instructions,int nmemb)
@@ -686,15 +633,26 @@ static const char *annotate__norm_arch(char *arch)return normalize_arch (arch); } +#define ARM_CONDS "(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl|vc|vs)" +static struct ins *ins__find (const char *name,const char *norm_arch) {static bool sorted;struct ins *instructions; -int nmemb; +int nmemb, ret;if (!sorted) {ins__sort (instructions_x86,ARRAY_SIZE (instructions_x86)); -ins__sort (instructions_arm,ARRAY_SIZE (instructions_arm)); +if (!strcmp (norm_arch,NORM_ARM )) { + ret =regcomp (&arm_call_insn, +"^blx?" ARM_CONDS "?$" ,REG_EXTENDED ); + ret |=regcomp (&arm_jump_insn, +"^bx?" ARM_CONDS "?$" ,REG_EXTENDED ); +if (ret) { +pr_err ("regcomp failed\n" ); +return NULL ; + } + } sorted = true; }
@@ -702,8 +660,7 @@ static struct ins *ins__find(const char *name, const char *norm_arch) instructions = instructions_x86; nmemb =ARRAY_SIZE (instructions_x86); }else if (!strcmp (norm_arch,NORM_ARM )) { - instructions = instructions_arm; - nmemb =ARRAY_SIZE (instructions_arm); +return ins__find_arm (name); }else if (!strcmp (norm_arch,NORM_POWERPC )) {return ins__find_powerpc (name); }else {
Signature · 1 line
2.9.3
PATCH v6 3/7 perf annotate: Add support for powerpc
In reply to Ravi BangoriaFrom: "Naveen N. Rao" <[email protected]>
Current perf can disassemble annotated function but it does not have parsing logic for powerpc instructions. So all navigation options are not available for powerpc.
Apart from that, Powerpc has long list of branch instructions and hardcoding them in table appears to be error-prone. So, add function to find instruction instead of creating table. This function dynamically create table (list of 'struct ins'), and instead of creating object every time, first check if list already contain object for that instruction.
---
Changes in v6:
- No change
tools/perf/util/annotate.c | 116 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+)
tools/perf/util/annotate.c +116 -0
@@ -535,6 +535,11 @@ static struct ins instructions_arm[] = { { .name = "retq", .ops = &ret_ops, }, }; +struct instructions_powerpc { +struct ins *ins; +struct list_head list; +}; +static int ins__key_cmp (const void *name,const void *insp) {const struct ins *ins = insp;
@@ -550,6 +555,115 @@ static int ins__cmp(const void *a, const void *b)return strcmp (ia->name, ib->name); } +static struct ins *list_add__ins_powerpc (struct instructions_powerpc *head, +const char *name,struct ins_ops *ops) +{ +struct instructions_powerpc *ins_powerpc; +struct ins *ins; + + ins =zalloc (sizeof (struct ins )); +if (!ins) +return NULL ; + + ins_powerpc =zalloc (sizeof (struct instructions_powerpc )); +if (!ins_powerpc) + goto out_free_ins; + + ins->name =strdup (name); +if (!ins->name) + goto out_free_ins_power; + + ins->ops = ops; + ins_powerpc->ins = ins; +list_add_tail (&(ins_powerpc->list), &(head->list)); + +return ins; + +out_free_ins_power: +zfree (&ins_powerpc); +out_free_ins: +zfree (&ins); +return NULL ; +} + +static struct ins *list_search__ins_powerpc (struct instructions_powerpc *head, +const char *name) +{ +struct instructions_powerpc *pos; + +list_for_each_entry (pos, &head->list, list) { +if (!strcmp (pos->ins->name, name)) +return pos->ins; + } +return NULL ; +} + +static struct ins *ins__find_powerpc (const char *name) +{ +int i; +struct ins *ins; +struct ins_ops *ops; +static struct instructions_powerpc head; +static bool list_initialized; + +/* +* - Interested only if instruction starts with 'b'. +* - Few start with 'b', but aren't branch instructions. +*/ +if (name[0 ] !='b' || + !strncmp (name,"bcd" ,3 ) || + !strncmp (name,"brinc" ,5 ) || + !strncmp (name,"bper" ,4 )) +return NULL ; + +if (!list_initialized) { +INIT_LIST_HEAD (&head.list); + list_initialized = true; + } + +/* +* Return if we already have object of 'struct ins' for this instruction +*/ + ins =list_search__ins_powerpc (&head, name); +if (ins) +return ins; + + ops = &jump_ops; + + i =strlen (name) -1 ; +if (i <0 ) +return NULL ; + +/* ignore optional hints at the end of the instructions */ +if (name[i] =='+' || name[i] =='-' ) + i--; + +if (name[i] =='l' || (name[i] =='a' && name[i-1 ] =='l' )) { +/* +* if the instruction ends up with 'l' or 'la', then +* those are considered 'calls' since they update LR. +* ... except for 'bnl' which is branch if not less than +* and the absolute form of the same. +*/ +if (strcmp (name,"bnl" ) &&strcmp (name,"bnl+" ) && +strcmp (name,"bnl-" ) &&strcmp (name,"bnla" ) && +strcmp (name,"bnla+" ) &&strcmp (name,"bnla-" )) + ops = &call_ops; + } +if (name[i] =='r' && name[i-1 ] =='l' ) +/* +* instructions ending with 'lr' are considered to be +* return instructions +*/ + ops = &ret_ops; + +/* +* Add instruction to list so next time no need to +* allocate memory for it. +*/ +return list_add__ins_powerpc (&head, name, ops); +} +static void ins__sort (struct ins *instructions,int nmemb) {qsort (instructions, nmemb,sizeof (struct ins ), ins__cmp);
@@ -585,6 +699,8 @@ static struct ins *ins__find(const char *name, const char *norm_arch) }else if (!strcmp (norm_arch,NORM_ARM )) { instructions = instructions_arm; nmemb =ARRAY_SIZE (instructions_arm); + }else if (!strcmp (norm_arch,NORM_POWERPC )) { +return ins__find_powerpc (name); }else {pr_err ("perf annotate not supported by %s arch\n" , norm_arch);return NULL ;
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerRe: [PATCH v6 3/7] perf annotate: Add support for powerpc
Em Fri, Aug 19, 2016 at 06:29:34PM +0530, Ravi Bangoria escreveu:
Quoted 14 lines
From: "Naveen N. Rao" <[email protected]>
tools/perf/util/annotate.c +12
-0+static struct ins *ins__find_powerpc (const char *name) +{ +int i; +struct ins *ins; +struct ins_ops *ops; +static struct instructions_powerpc head; +static bool list_initialized; + +/* +* - Interested only if instruction starts with 'b'. +* - Few start with 'b', but aren't branch instructions. +*/
tools/perf/util/annotate.c static int ins__cmp(const void *a, const void *b) · line 622
Quoted 10 lines
tools/perf/util/annotate.c +10
-0+if (name[0 ] !='b' || + !strncmp (name,"bcd" ,3 ) || + !strncmp (name,"brinc" ,5 ) || + !strncmp (name,"bper" ,4 )) +return NULL ; + +if (!list_initialized) { +INIT_LIST_HEAD (&head.list); + list_initialized = true; + }
Why not ditch list_initialized and instead just declare the list as:
static struct instructions_powerpc head = {
.list = LIST_HEAD_INIT(head.list),
}
Just like the kernel sources do? See for instance:
net/core/net_namespace.c
struct net init_net = {
.dev_base_head = LIST_HEAD_INIT(init_net.dev_base_head),
};
Quoted 58 lines
tools/perf/util/annotate.c +46
-0+ +/* +* Return if we already have object of 'struct ins' for this instruction +*/ + ins =list_search__ins_powerpc (&head, name); +if (ins) +return ins; + + ops = &jump_ops; + + i =strlen (name) -1 ; +if (i <0 ) +return NULL ; + +/* ignore optional hints at the end of the instructions */ +if (name[i] =='+' || name[i] =='-' ) + i--; + +if (name[i] =='l' || (name[i] =='a' && name[i-1 ] =='l' )) { +/* +* if the instruction ends up with 'l' or 'la', then +* those are considered 'calls' since they update LR. +* ... except for 'bnl' which is branch if not less than +* and the absolute form of the same. +*/ +if (strcmp (name,"bnl" ) &&strcmp (name,"bnl+" ) && +strcmp (name,"bnl-" ) &&strcmp (name,"bnla" ) && +strcmp (name,"bnla+" ) &&strcmp (name,"bnla-" )) + ops = &call_ops; + } +if (name[i] =='r' && name[i-1 ] =='l' ) +/* +* instructions ending with 'lr' are considered to be +* return instructions +*/ + ops = &ret_ops; + +/* +* Add instruction to list so next time no need to +* allocate memory for it. +*/ +return list_add__ins_powerpc (&head, name, ops); +} +static void ins__sort (struct ins *instructions,int nmemb) {qsort (instructions, nmemb,sizeof (struct ins ), ins__cmp);@@ -585,6 +699,8 @@ static struct ins *ins__find(const char *name, const char *norm_arch) }else if (!strcmp (norm_arch,NORM_ARM )) { instructions = instructions_arm; nmemb =ARRAY_SIZE (instructions_arm); + }else if (!strcmp (norm_arch,NORM_POWERPC )) { +return ins__find_powerpc (name); }else {pr_err ("perf annotate not supported by %s arch\n" , norm_arch);return NULL ;Signature · 1 line
2.5.5
PATCH v6 4/7 perf annotate: Do not ignore call instruction with indirect target
In reply to Ravi BangoriaDo not ignore call instruction with indirect target when its already identified as a call. This is an extension of commit e8ea1561952b ("perf annotate: Use raw form for register indirect call instructions") to generalize annotation for all instructions with indirect calls.
This is needed for certain powerpc call instructions that use address in a register (such as bctrl, btarl, ...).
Apart from that, when kcore is used to disassemble function, all call instructions were ignored. This patch will fix it as a side effect by not ignoring them. For example,
Before (with kcore):
mov %r13,%rdi
callq 0xffffffff811a7e70
^ jmpq 64
mov %gs:0x7ef41a6e(%rip),%alAfter (with kcore):
mov %r13,%rdi
> callq 0xffffffff811a7e70
^ jmpq 64
mov %gs:0x7ef41a6e(%rip),%al---
Changes in v6:
- No change
tools/perf/util/annotate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
tools/perf/util/annotate.c +2 -6
@@ -81,16 +81,12 @@ static int call__parse(struct ins_operands *ops, const char *norm_arch)return ops->target.name ==NULL ?-1 :0 ; indirect_call: - tok =strchr (endptr,'(' ); -if (tok !=NULL ) { + tok =strchr (endptr,'*' ); +if (tok ==NULL ) { ops->target.addr =0 ;return 0 ; } - tok =strchr (endptr,'*' ); -if (tok ==NULL ) -return -1 ; - ops->target.addr =strtoull (tok +1 ,NULL ,16 );return 0 ; }
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerRe: [PATCH v6 4/7] perf annotate: Do not ignore call instruction with indirect target
Em Fri, Aug 19, 2016 at 06:29:35PM +0530, Ravi Bangoria escreveu:
Quoted 18 lines
Do not ignore call instruction with indirect target when its already identified as a call. This is an extension of commit
e8ea1561952b("perf annotate: Use raw form for register indirect call instructions") to generalize annotation for all instructions with indirect calls.This is needed for certain powerpc call instructions that use address in a register (such as bctrl, btarl, ...).
Apart from that, when kcore is used to disassemble function, all call instructions were ignored. This patch will fix it as a side effect by not ignoring them. For example,
Before (with kcore):
mov %r13,%rdi callq 0xffffffff811a7e70 ^ jmpq 64 mov %gs:0x7ef41a6e(%rip),%al
Quoted 5 lines
After (with kcore):
mov %r13,%rdi > callq 0xffffffff811a7e70 ^ jmpq 64 mov %gs:0x7ef41a6e(%rip),%al
Ok, makes sense, but then now I have the -> and can't press enter to go to that function, in fact for the case I'm using as a test, the vsnprintf kernel function, I get:
│ 56: test %al,%al ▒
│ ↓ je 81 ▒
│ lea -0x38(%rbp),%rsi ▒
│ mov %r15,%rdi ▒
│ → callq 0xffffffff993e3230 That 0xffffffff993e3230 should've been resolved to:
[root@jouet ~]# grep ffffffff993e3230 /proc/kallsyms ffffffff993e3230 t format_decode
Trying to investigate why it doesn't...
- Arnaldo
Quoted 35 lines
Suggested-by Michael Ellerman <[email protected]>[Suggested about 'bctrl' instruction]Signed-off-by Ravi Bangoria <[email protected]>---
Changes in v6:
- No changetools/perf/util/annotate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)tools/perf/util/annotate.c +2
-6@@ -81,16 +81,12 @@ static int call__parse(struct ins_operands *ops, const char *norm_arch)return ops->target.name ==NULL ?-1 :0 ; indirect_call: - tok =strchr (endptr,'(' ); -if (tok !=NULL ) { + tok =strchr (endptr,'*' ); +if (tok ==NULL ) { ops->target.addr =0 ;return 0 ; } - tok =strchr (endptr,'*' ); -if (tok ==NULL ) -return -1 ; - ops->target.addr =strtoull (tok +1 ,NULL ,16 );return 0 ; }Signature · 1 line
2.5.5
Re: [PATCH v6 4/7] perf annotate: Do not ignore call instruction with indirect target
Hi Arnaldo,
Quoted 34 lines · Arnaldo Carvalho de Melo
Em Fri, Aug 19, 2016 at 06:29:35PM +0530, Ravi Bangoria escreveu:
Quoted 18 lines
Do not ignore call instruction with indirect target when its already identified as a call. This is an extension of commit
e8ea1561952b("perf annotate: Use raw form for register indirect call instructions") to generalize annotation for all instructions with indirect calls.This is needed for certain powerpc call instructions that use address in a register (such as bctrl, btarl, ...).
Apart from that, when kcore is used to disassemble function, all call instructions were ignored. This patch will fix it as a side effect by not ignoring them. For example,
Before (with kcore):
mov %r13,%rdi callq 0xffffffff811a7e70 ^ jmpq 64 mov %gs:0x7ef41a6e(%rip),%alQuoted 5 lines
After (with kcore):
mov %r13,%rdi > callq 0xffffffff811a7e70 ^ jmpq 64 mov %gs:0x7ef41a6e(%rip),%alOk, makes sense, but then now I have the -> and can't press enter to go to that function, in fact for the case I'm using as a test, the vsnprintf kernel function, I get:
│ 56: test %al,%al ▒ │ ↓ je 81 ▒ │ lea -0x38(%rbp),%rsi ▒ │ mov %r15,%rdi ▒ │ → callq 0xffffffff993e3230
Quoted 6 lines
That
0xffffffff993e3230should've been resolved to:[root@jouet ~]# grep
ffffffff993e3230/proc/kallsymsffffffff993e3230tformat_decodeTrying to investigate why it doesn't...
I investigated this.
If this example is with kcore, then it's expected. Because, perf annotate does not inspect kallsyms when it can't find symbol name from disassembly itself.
For example, disassembly of finish_task_switch,
with kcore:
ffffffff810cf1b0: mov $0x1,%esi ffffffff810cf1b5: mov $0x4,%edi ffffffff810cf1ba: callq 0xffffffff811aced0 ffffffff810cf1bf: andb $0xfb,0x4c4(%rbx) ffffffff810cf1c6: jmpq 0xffffffff810cf0e9 ffffffff810cf1cb: mov %rbx,%rsi ffffffff810cf1ce: mov %r13,%rdi ffffffff810cf1d1: callq 0xffffffff811a7e70 ffffffff810cf1d6: jmpq 0xffffffff810cf0e4
with debuginfo:
ffffffff810cf1b0: mov $0x1,%esi ffffffff810cf1b5: mov $0x4,%edi ffffffff810cf1ba: callq ffffffff811aced0 <___perf_sw_event> ffffffff810cf1bf: andb $0xfb,0x4c4(%rbx) ffffffff810cf1c6: jmpq ffffffff810cf0e9 <finish_task_switch+0x69> ffffffff810cf1cb: mov %rbx,%rsi ffffffff810cf1ce: mov %r13,%rdi ffffffff810cf1d1: callq ffffffff811a7e70 <__perf_event_task_sched_in> ffffffff810cf1d6: jmpq ffffffff810cf0e4 <finish_task_switch+0x64>
call__parse tries to find symbol from angle brackets which is not present in case of kcore.
-Ravi
Quoted 37 lines
- Arnaldo
Quoted 35 lines
Suggested-by Michael Ellerman <[email protected]>[Suggested about 'bctrl' instruction]Signed-off-by Ravi Bangoria <[email protected]>---
Changes in v6:
- No changetools/perf/util/annotate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)tools/perf/util/annotate.c +2
-6@@ -81,16 +81,12 @@ static int call__parse(struct ins_operands *ops, const char *norm_arch)return ops->target.name ==NULL ?-1 :0 ; indirect_call: - tok =strchr (endptr,'(' ); -if (tok !=NULL ) { + tok =strchr (endptr,'*' ); +if (tok ==NULL ) { ops->target.addr =0 ;return 0 ; } - tok =strchr (endptr,'*' ); -if (tok ==NULL ) -return -1 ; - ops->target.addr =strtoull (tok +1 ,NULL ,16 );return 0 ; }Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerRe: [PATCH v6 4/7] perf annotate: Do not ignore call instruction with indirect target
Em Tue, Sep 20, 2016 at 08:05:03PM +0530, Ravi Bangoria escreveu:
Quoted 40 lines · Arnaldo Carvalho de Melo
Quoted 39 lines
Em Fri, Aug 19, 2016 at 06:29:35PM +0530, Ravi Bangoria escreveu:
Quoted 18 lines
Do not ignore call instruction with indirect target when its already identified as a call. This is an extension of commit
e8ea1561952b("perf annotate: Use raw form for register indirect call instructions") to generalize annotation for all instructions with indirect calls.This is needed for certain powerpc call instructions that use address in a register (such as bctrl, btarl, ...).
Apart from that, when kcore is used to disassemble function, all call instructions were ignored. This patch will fix it as a side effect by not ignoring them. For example,
Before (with kcore):
mov %r13,%rdi callq 0xffffffff811a7e70 ^ jmpq 64 mov %gs:0x7ef41a6e(%rip),%alQuoted 5 lines
After (with kcore):
mov %r13,%rdi > callq 0xffffffff811a7e70 ^ jmpq 64 mov %gs:0x7ef41a6e(%rip),%alOk, makes sense, but then now I have the -> and can't press enter to go to that function, in fact for the case I'm using as a test, the vsnprintf kernel function, I get:
│ 56: test %al,%al │ ↓ je 81 │ lea -0x38(%rbp),%rsi │ mov %r15,%rdi │ → callq 0xffffffff993e3230That
0xffffffff993e3230should've been resolved to:[root@jouet ~]# grep
ffffffff993e3230/proc/kallsymsffffffff993e3230tformat_decode
Quoted 8 lines
Quoted 1 line
Trying to investigate why it doesn't...
I investigated this.
If this example is with kcore, then it's expected. Because, perf annotate does not inspect kallsyms when it can't find symbol name from disassembly itself.
For example, disassembly of
finish_task_switch,
Yeah, that was the case, up to yesterday, please take a look at my perf/core branch, specifically this patch:
I'll do that for other instructions as well, like with 'mov $0xabcdef,%rax' that will try to resolve that address to a variable.
Will try to continue processing your (and others) patches first tho :-)
- Arnaldo
Quoted 67 lines
with kcore:
ffffffff810cf1b0: mov $0x1,%esi ffffffff810cf1b5: mov $0x4,%edi ffffffff810cf1ba: callq 0xffffffff811aced0 ffffffff810cf1bf: andb $0xfb,0x4c4(%rbx) ffffffff810cf1c6: jmpq 0xffffffff810cf0e9 ffffffff810cf1cb: mov %rbx,%rsi ffffffff810cf1ce: mov %r13,%rdi ffffffff810cf1d1: callq 0xffffffff811a7e70 ffffffff810cf1d6: jmpq 0xffffffff810cf0e4with debuginfo:
ffffffff810cf1b0: mov $0x1,%esi ffffffff810cf1b5: mov $0x4,%edi ffffffff810cf1ba: callq ffffffff811aced0 <___perf_sw_event> ffffffff810cf1bf: andb $0xfb,0x4c4(%rbx) ffffffff810cf1c6: jmpq ffffffff810cf0e9 <finish_task_switch+0x69> ffffffff810cf1cb: mov %rbx,%rsi ffffffff810cf1ce: mov %r13,%rdi ffffffff810cf1d1: callq ffffffff811a7e70 <__perf_event_task_sched_in> ffffffff810cf1d6: jmpq ffffffff810cf0e4 <finish_task_switch+0x64>
call__parsetries to find symbol from angle brackets which is not present in case of kcore.-Ravi
Quoted 37 lines
- Arnaldo
Quoted 35 lines
Suggested-by Michael Ellerman <[email protected]>[Suggested about 'bctrl' instruction]Signed-off-by Ravi Bangoria <[email protected]>---
Changes in v6:
- No changetools/perf/util/annotate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)tools/perf/util/annotate.c +2
-6@@ -81,16 +81,12 @@ static int call__parse(struct ins_operands *ops, const char *norm_arch)return ops->target.name ==NULL ?-1 :0 ; indirect_call: - tok =strchr (endptr,'(' ); -if (tok !=NULL ) { + tok =strchr (endptr,'*' ); +if (tok ==NULL ) { ops->target.addr =0 ;return 0 ; } - tok =strchr (endptr,'*' ); -if (tok ==NULL ) -return -1 ; - ops->target.addr =strtoull (tok +1 ,NULL ,16 );return 0 ; }Signature · 1 line
2.5.5
tip-bot for Ravi Bangoria
merge bot[tip:perf/core] perf annotate: Do not ignore call instruction with indirect target
In reply to Ravi Bangoriaperf annotate: Do not ignore call instruction with indirect target
Commit-ID: 88a7fcf961a27fbd248e3c914fc9df8327f7cdbb Gitweb: http://git.kernel.org/tip/88a7fcf961a27fbd248e3c914fc9df8327f7cdbb Author: Ravi Bangoria <[email protected]> AuthorDate: Fri, 19 Aug 2016 18:29:35 +0530 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 20 Sep 2016 12:28:29 -0300
perf annotate: Do not ignore call instruction with indirect target
Do not ignore call instruction with indirect target when its already identified as a call. This is an extension of commit e8ea1561952b ("perf
annotate: Use raw form for register indirect call instructions") to generalize annotation for all instructions with indirect calls.
This is needed for certain powerpc call instructions that use address in a register (such as bctrl, btarl, ...).
Apart from that, when kcore is used to disassemble function, all call instructions were ignored. This patch will fix it as a side effect by not ignoring them. For example,
Before (with kcore):
mov %r13,%rdi
callq 0xffffffff811a7e70
^ jmpq 64
mov %gs:0x7ef41a6e(%rip),%alAfter (with kcore):
mov %r13,%rdi
> callq 0xffffffff811a7e70
^ jmpq 64
mov %gs:0x7ef41a6e(%rip),%al--- tools/perf/util/annotate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
tools/perf/util/annotate.c +2 -6
@@ -82,16 +82,12 @@ static int call__parse(struct ins_operands *ops)return ops->target.name ==NULL ?-1 :0 ; indirect_call: - tok =strchr (endptr,'(' ); -if (tok !=NULL ) { + tok =strchr (endptr,'*' ); +if (tok ==NULL ) { ops->target.addr =0 ;return 0 ; } - tok =strchr (endptr,'*' ); -if (tok ==NULL ) -return -1 ; - ops->target.addr =strtoull (tok +1 ,NULL ,16 );return 0 ; }
PATCH v6 5/7 perf annotate: Show raw form for jump instruction with indirect target
In reply to Ravi BangoriaFor jump instructions that does not include target address as direct operand, use raw value for that. This is needed for certain powerpc jump instructions that use target address in a register (such as bctr, btar, ...).
---
Changes in v6:
- No changes
tools/perf/util/annotate.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/annotate.c +3 -0
@@ -131,6 +131,9 @@ static int jump__parse(struct ins_operands *ops,static int jump__scnprintf (struct ins *ins,char *bf,size_t size,struct ins_operands *ops) { +if (!ops->target.addr) +return ins__raw_scnprintf (ins, bf, size, ops); +return scnprintf (bf, size,"%-6.6s %" PRIx64, ins->name, ops->target.offset); }
Signature · 1 line
2.5.5
PATCH v6 6/7 perf annotate: Support jump instruction with target as second operand
In reply to Ravi BangoriaCurrent perf is not able to parse jump instruction when second operand contains target address. Arch like powerpc has such instructions. For example, 'beq cr7,10173e60'.
---
Changes in v6:
- No changes
tools/perf/util/annotate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/util/annotate.c +5 -1
@@ -117,8 +117,12 @@ static int jump__parse(struct ins_operands *ops, const char *norm_arch __maybe_unused) {const char *s =strchr (ops->raw,'+' ); +const char *c =strchr (ops->raw,',' ); - ops->target.addr =strtoull (ops->raw,NULL ,16 ); +if (c++ !=NULL ) + ops->target.addr =strtoull (c,NULL ,16 ); +else + ops->target.addr =strtoull (ops->raw,NULL ,16 );if (s++ !=NULL ) ops->target.offset =strtoull (s,NULL ,16 );
Signature · 1 line
2.5.5
PATCH v6 7/7 perf annotate: Fix jump target outside of function address range
In reply to Ravi BangoriaIf jump target is outside of function range, perf is not handling it correctly. Especially when target address is lesser than function start address, target offset will be negative. But, target address declared to be unsigned, converts negative number into 2's complement. See below example. Here target of 'jumpq' instruction at 34cf8 is 34ac0 which is lesser than function start address(34cf0).
34ac0 - 34cf0 = -0x230 = 0xfffffffffffffdd0
Objdump output:
0000000000034cf0 <__sigaction>:
__GI___sigaction():
34cf0: lea -0x20(%rdi),%eax
34cf3: cmp -bashx1,%eax
34cf6: jbe 34d00 <__sigaction+0x10>
34cf8: jmpq 34ac0 <__GI___libc_sigaction>
34cfd: nopl (%rax)
34d00: mov 0x386161(%rip),%rax # 3bae68 <_DYNAMIC+0x2e8>
34d07: movl -bashx16,%fs:(%rax)
34d0e: mov -bashxffffffff,%eax
34d13: retqperf annotate before applying patch:
__GI___sigaction /usr/lib64/libc-2.22.so
lea -0x20(%rdi),%eax
cmp -bashx1,%eax
V jbe 10
V jmpq fffffffffffffdd0
nop
10: mov _DYNAMIC+0x2e8,%rax
movl -bashx16,%fs:(%rax)
mov -bashxffffffff,%eax
retqperf annotate after applying patch:
__GI___sigaction /usr/lib64/libc-2.22.so
lea -0x20(%rdi),%eax
cmp -bashx1,%eax
V jbe 10
^ jmpq 34ac0 <__GI___libc_sigaction>
nop
10: mov _DYNAMIC+0x2e8,%rax
movl -bashx16,%fs:(%rax)
mov -bashxffffffff,%eax
retq---
Changes in v6:
- No changes
tools/perf/ui/browsers/annotate.c | 5 +++-- tools/perf/util/annotate.c | 14 +++++++++----- tools/perf/util/annotate.h | 5 +++-- 3 files changed, 15 insertions(+), 9 deletions(-)
tools/perf/ui/browsers/annotate.c +3 -2
@@ -215,7 +215,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, intui_browser__set_color (browser, color);if (dl->ins && dl->ins->ops->scnprintf) {if (ins__is_jump (dl->ins)) { -bool fwd = dl->ops.target.offset > (u64 )dl->offset; +bool fwd = dl->ops.target.offset > dl->offset;ui_browser__write_graph (browser, fwd ?SLSMG_DARROW_CHAR :SLSMG_UARROW_CHAR );
@@ -245,7 +245,8 @@ static bool disasm_line__is_valid_jump(struct disasm_line *dl, struct symbol *sy {if (!dl || !dl->ins || !ins__is_jump (dl->ins) || !disasm_line__has_offset (dl) - || dl->ops.target.offset >=symbol__size (sym)) + || dl->ops.target.offset <0 + || dl->ops.target.offset >= (s64 )symbol__size (sym))return false;return true;
tools/perf/util/annotate.c +9 -5
@@ -124,10 +124,12 @@ static int jump__parse(struct ins_operands *ops,else ops->target.addr =strtoull (ops->raw,NULL ,16 ); -if (s++ !=NULL ) +if (s++ !=NULL ) { ops->target.offset =strtoull (s,NULL ,16 ); -else - ops->target.offset =UINT64_MAX ; + ops->target.offset_avail = true; + }else { + ops->target.offset_avail = false; + }return 0 ; }
@@ -135,7 +137,7 @@ static int jump__parse(struct ins_operands *ops,static int jump__scnprintf (struct ins *ins,char *bf,size_t size,struct ins_operands *ops) { -if (!ops->target.addr) +if (!ops->target.addr || ops->target.offset <0 )return ins__raw_scnprintf (ins, bf, size, ops);return scnprintf (bf, size,"%-6.6s %" PRIx64, ins->name, ops->target.offset);
@@ -1304,9 +1306,11 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,if (dl ==NULL )return -1 ; -if (dl->ops.target.offset ==UINT64_MAX ) +if (!disasm_line__has_offset (dl)) { dl->ops.target.offset = dl->ops.target.addr -map__rip_2objdump (map, sym->start); + dl->ops.target.offset_avail = true; + }/* kcore has no symbols, so add the call target name */ if (dl->ins &&ins__is_call (dl->ins) && !dl->ops.target.name) {
tools/perf/util/annotate.h +3 -2
@@ -19,7 +19,8 @@ struct ins_operands {char *raw;char *name;u64 addr; -u64 offset; +s64 offset; +bool offset_avail; } target; union { struct {
@@ -67,7 +68,7 @@ struct disasm_line {static inline bool disasm_line__has_offset (const struct disasm_line *dl) { -return dl->ops.target.offset !=UINT64_MAX ; +return dl->ops.target.offset_avail; }void disasm_line__free (struct disasm_line *dl);
Signature · 1 line
2.5.5
Hello,
Any update on this?
-Ravi
Quoted 56 lines · Ravi Bangoria
Currently Perf annotate support code navigation (branches and calls) only when run on the same architecture where perf.data was recorded. But, for example, record on powerpc server and annotate on client's x86 desktop is not supported.
This patchset enables cross arch annotate. Currently I've used x86 and arm instructions which are already available and added support for powerpc.
Additionally this patch series also contains few other related fixes.
Patches are prepared on top of acme/perf/core and tested it with x86 and powerpc only.
Note for arm:
I don't have arm test machine. As suggested by Russell in one of the review comment, I've copied all instructions from default table to arm table. This way it want break tool on arm but cleanup is needed for x86 specific instructions added in arm table.Example:
Record on powerpc:
$ ./perf record -aReport -> Annotate on x86:
$ ./perf report -i perf.data.powerpc --vmlinux vmlinux.powerpcChanges in v6:
- Instead of adding only those instructions defined in #ifdef__arm__, add all instructions from default table to arm table.v5 link:
https://lkml.org/lkml/2016/8/19/35Naveen N. Rao (1):
perf annotate: Add support for powerpcRavi Bangoria (6):
perf: Define macro for normalized arch names
perf annotate: Add cross arch annotate support
perf annotate: Do not ignore call instruction with indirect target perf annotate: Show raw form for jump instruction with indirect target perf annotate: Support jump instruction with target as second operand perf annotate: Fix jump target outside of function address rangetools/perf/arch/common.c | 36 ++-- tools/perf/arch/common.h | 11 ++ tools/perf/builtin-top.c | 2 +- tools/perf/ui/browsers/annotate.c | 8 +- tools/perf/ui/gtk/annotate.c | 2 +- tools/perf/util/annotate.c | 330 +++++++++++++++++++++++++++++++------ tools/perf/util/annotate.h | 10 +- tools/perf/util/unwind-libunwind.c | 4 +- 8 files changed, 327 insertions(+), 76 deletions(-)