diff options
author | Jiri Olsa <jolsa@kernel.org> | 2017-10-11 11:01:24 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-10-23 10:20:54 -0400 |
commit | 696e2457e9fd285034cd30cd8c93ece5e6cfe35a (patch) | |
tree | 5b5b512cb3ac15953d10b7ab719054f228311675 | |
parent | 98ad761bd3989a71be2b100002be923466617394 (diff) |
perf annotate: Remove arch::cpuid_parse callback
There's no need for extra cpuid_parse arch callback, it can be handled
directly in init callback.
Adding the init function to x86 to cover the cpuid initialization.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20171011150158.11895-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/arch/arm/annotate/instructions.c | 3 | ||||
-rw-r--r-- | tools/perf/arch/arm64/annotate/instructions.c | 3 | ||||
-rw-r--r-- | tools/perf/arch/powerpc/annotate/instructions.c | 4 | ||||
-rw-r--r-- | tools/perf/arch/s390/annotate/instructions.c | 4 | ||||
-rw-r--r-- | tools/perf/arch/x86/annotate/instructions.c | 14 | ||||
-rw-r--r-- | tools/perf/util/annotate.c | 10 |
6 files changed, 27 insertions, 11 deletions
diff --git a/tools/perf/arch/arm/annotate/instructions.c b/tools/perf/arch/arm/annotate/instructions.c index 1ce0872b1726..6dfec7c23696 100644 --- a/tools/perf/arch/arm/annotate/instructions.c +++ b/tools/perf/arch/arm/annotate/instructions.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/compiler.h> | ||
1 | #include <sys/types.h> | 2 | #include <sys/types.h> |
2 | #include <regex.h> | 3 | #include <regex.h> |
3 | 4 | ||
@@ -23,7 +24,7 @@ static struct ins_ops *arm__associate_instruction_ops(struct arch *arch, const c | |||
23 | return ops; | 24 | return ops; |
24 | } | 25 | } |
25 | 26 | ||
26 | static int arm__annotate_init(struct arch *arch) | 27 | static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused) |
27 | { | 28 | { |
28 | struct arm_annotate *arm; | 29 | struct arm_annotate *arm; |
29 | int err; | 30 | int err; |
diff --git a/tools/perf/arch/arm64/annotate/instructions.c b/tools/perf/arch/arm64/annotate/instructions.c index 8f1908756cb6..a2c32be4132a 100644 --- a/tools/perf/arch/arm64/annotate/instructions.c +++ b/tools/perf/arch/arm64/annotate/instructions.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/compiler.h> | ||
1 | #include <sys/types.h> | 2 | #include <sys/types.h> |
2 | #include <regex.h> | 3 | #include <regex.h> |
3 | 4 | ||
@@ -25,7 +26,7 @@ static struct ins_ops *arm64__associate_instruction_ops(struct arch *arch, const | |||
25 | return ops; | 26 | return ops; |
26 | } | 27 | } |
27 | 28 | ||
28 | static int arm64__annotate_init(struct arch *arch) | 29 | static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused) |
29 | { | 30 | { |
30 | struct arm64_annotate *arm; | 31 | struct arm64_annotate *arm; |
31 | int err; | 32 | int err; |
diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/arch/powerpc/annotate/instructions.c index 3c4004db81b9..b6b0ef5952d0 100644 --- a/tools/perf/arch/powerpc/annotate/instructions.c +++ b/tools/perf/arch/powerpc/annotate/instructions.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #include <linux/compiler.h> | ||
2 | |||
1 | static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, const char *name) | 3 | static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, const char *name) |
2 | { | 4 | { |
3 | int i; | 5 | int i; |
@@ -46,7 +48,7 @@ static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, con | |||
46 | return ops; | 48 | return ops; |
47 | } | 49 | } |
48 | 50 | ||
49 | static int powerpc__annotate_init(struct arch *arch) | 51 | static int powerpc__annotate_init(struct arch *arch, char *cpuid __maybe_unused) |
50 | { | 52 | { |
51 | if (!arch->initialized) { | 53 | if (!arch->initialized) { |
52 | arch->initialized = true; | 54 | arch->initialized = true; |
diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch/s390/annotate/instructions.c index 745b4b1b8b21..b8676ccbed76 100644 --- a/tools/perf/arch/s390/annotate/instructions.c +++ b/tools/perf/arch/s390/annotate/instructions.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #include <linux/compiler.h> | ||
2 | |||
1 | static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *name) | 3 | static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *name) |
2 | { | 4 | { |
3 | struct ins_ops *ops = NULL; | 5 | struct ins_ops *ops = NULL; |
@@ -19,7 +21,7 @@ static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *na | |||
19 | return ops; | 21 | return ops; |
20 | } | 22 | } |
21 | 23 | ||
22 | static int s390__annotate_init(struct arch *arch) | 24 | static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused) |
23 | { | 25 | { |
24 | if (!arch->initialized) { | 26 | if (!arch->initialized) { |
25 | arch->initialized = true; | 27 | arch->initialized = true; |
diff --git a/tools/perf/arch/x86/annotate/instructions.c b/tools/perf/arch/x86/annotate/instructions.c index d84b72063a30..563cd4564041 100644 --- a/tools/perf/arch/x86/annotate/instructions.c +++ b/tools/perf/arch/x86/annotate/instructions.c | |||
@@ -122,3 +122,17 @@ static int x86__cpuid_parse(struct arch *arch, char *cpuid) | |||
122 | 122 | ||
123 | return -1; | 123 | return -1; |
124 | } | 124 | } |
125 | |||
126 | static int x86__annotate_init(struct arch *arch, char *cpuid) | ||
127 | { | ||
128 | int err = 0; | ||
129 | |||
130 | if (arch->initialized) | ||
131 | return 0; | ||
132 | |||
133 | if (cpuid) | ||
134 | err = x86__cpuid_parse(arch, cpuid); | ||
135 | |||
136 | arch->initialized = true; | ||
137 | return err; | ||
138 | } | ||
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 4397a8b6e6cd..08164162c345 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -49,10 +49,9 @@ struct arch { | |||
49 | void *priv; | 49 | void *priv; |
50 | unsigned int model; | 50 | unsigned int model; |
51 | unsigned int family; | 51 | unsigned int family; |
52 | int (*init)(struct arch *arch); | 52 | int (*init)(struct arch *arch, char *cpuid); |
53 | bool (*ins_is_fused)(struct arch *arch, const char *ins1, | 53 | bool (*ins_is_fused)(struct arch *arch, const char *ins1, |
54 | const char *ins2); | 54 | const char *ins2); |
55 | int (*cpuid_parse)(struct arch *arch, char *cpuid); | ||
56 | struct { | 55 | struct { |
57 | char comment_char; | 56 | char comment_char; |
58 | char skip_functions_char; | 57 | char skip_functions_char; |
@@ -132,10 +131,10 @@ static struct arch architectures[] = { | |||
132 | }, | 131 | }, |
133 | { | 132 | { |
134 | .name = "x86", | 133 | .name = "x86", |
134 | .init = x86__annotate_init, | ||
135 | .instructions = x86__instructions, | 135 | .instructions = x86__instructions, |
136 | .nr_instructions = ARRAY_SIZE(x86__instructions), | 136 | .nr_instructions = ARRAY_SIZE(x86__instructions), |
137 | .ins_is_fused = x86__ins_is_fused, | 137 | .ins_is_fused = x86__ins_is_fused, |
138 | .cpuid_parse = x86__cpuid_parse, | ||
139 | .objdump = { | 138 | .objdump = { |
140 | .comment_char = '#', | 139 | .comment_char = '#', |
141 | }, | 140 | }, |
@@ -1447,16 +1446,13 @@ int symbol__disassemble(struct symbol *sym, struct map *map, | |||
1447 | *parch = arch; | 1446 | *parch = arch; |
1448 | 1447 | ||
1449 | if (arch->init) { | 1448 | if (arch->init) { |
1450 | err = arch->init(arch); | 1449 | err = arch->init(arch, cpuid); |
1451 | if (err) { | 1450 | if (err) { |
1452 | pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name); | 1451 | pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name); |
1453 | return err; | 1452 | return err; |
1454 | } | 1453 | } |
1455 | } | 1454 | } |
1456 | 1455 | ||
1457 | if (arch->cpuid_parse && cpuid) | ||
1458 | arch->cpuid_parse(arch, cpuid); | ||
1459 | |||
1460 | pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, | 1456 | pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, |
1461 | symfs_filename, sym->name, map->unmap_ip(map, sym->start), | 1457 | symfs_filename, sym->name, map->unmap_ip(map, sym->start), |
1462 | map->unmap_ip(map, sym->end)); | 1458 | map->unmap_ip(map, sym->end)); |