Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf annotate: Allow arches to have a init routine and a priv area

Arches like ARM will want to use regular expressions when deciding what
instructions to associate with what ins_ops, provide infrastructure for
that.

Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Chris Riyder <chris.ryder@arm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kim Phillips <kim.phillips@arm.com>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Taeung Song <treeze.taeung@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-7dmnk9el2ipu3nxog092k9z5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+11
+11
tools/perf/util/annotate.c
··· 39 39 size_t nr_instructions_allocated; 40 40 struct ins_ops *(*associate_instruction_ops)(struct arch *arch, const char *name); 41 41 bool sorted_instructions; 42 + bool initialized; 43 + void *priv; 44 + int (*init)(struct arch *arch); 42 45 struct { 43 46 char comment_char; 44 47 char skip_functions_char; ··· 1358 1355 arch = arch__find(arch_name); 1359 1356 if (arch == NULL) 1360 1357 return -ENOTSUP; 1358 + 1359 + if (arch->init) { 1360 + err = arch->init(arch); 1361 + if (err) { 1362 + pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name); 1363 + return err; 1364 + } 1365 + } 1361 1366 1362 1367 pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, 1363 1368 symfs_filename, sym->name, map->unmap_ip(map, sym->start),