Commit 696e2457 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

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: default avatarJiri 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 98ad761b
#include <linux/compiler.h>
#include <sys/types.h> #include <sys/types.h>
#include <regex.h> #include <regex.h>
...@@ -23,7 +24,7 @@ static struct ins_ops *arm__associate_instruction_ops(struct arch *arch, const c ...@@ -23,7 +24,7 @@ static struct ins_ops *arm__associate_instruction_ops(struct arch *arch, const c
return ops; return ops;
} }
static int arm__annotate_init(struct arch *arch) static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
{ {
struct arm_annotate *arm; struct arm_annotate *arm;
int err; int err;
......
#include <linux/compiler.h>
#include <sys/types.h> #include <sys/types.h>
#include <regex.h> #include <regex.h>
...@@ -25,7 +26,7 @@ static struct ins_ops *arm64__associate_instruction_ops(struct arch *arch, const ...@@ -25,7 +26,7 @@ static struct ins_ops *arm64__associate_instruction_ops(struct arch *arch, const
return ops; return ops;
} }
static int arm64__annotate_init(struct arch *arch) static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
{ {
struct arm64_annotate *arm; struct arm64_annotate *arm;
int err; int err;
......
#include <linux/compiler.h>
static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, const char *name) static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, const char *name)
{ {
int i; int i;
...@@ -46,7 +48,7 @@ static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, con ...@@ -46,7 +48,7 @@ static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, con
return ops; return ops;
} }
static int powerpc__annotate_init(struct arch *arch) static int powerpc__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
{ {
if (!arch->initialized) { if (!arch->initialized) {
arch->initialized = true; arch->initialized = true;
......
#include <linux/compiler.h>
static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *name) static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *name)
{ {
struct ins_ops *ops = NULL; struct ins_ops *ops = NULL;
...@@ -19,7 +21,7 @@ static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *na ...@@ -19,7 +21,7 @@ static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *na
return ops; return ops;
} }
static int s390__annotate_init(struct arch *arch) static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
{ {
if (!arch->initialized) { if (!arch->initialized) {
arch->initialized = true; arch->initialized = true;
......
...@@ -122,3 +122,17 @@ static int x86__cpuid_parse(struct arch *arch, char *cpuid) ...@@ -122,3 +122,17 @@ static int x86__cpuid_parse(struct arch *arch, char *cpuid)
return -1; return -1;
} }
static int x86__annotate_init(struct arch *arch, char *cpuid)
{
int err = 0;
if (arch->initialized)
return 0;
if (cpuid)
err = x86__cpuid_parse(arch, cpuid);
arch->initialized = true;
return err;
}
...@@ -49,10 +49,9 @@ struct arch { ...@@ -49,10 +49,9 @@ struct arch {
void *priv; void *priv;
unsigned int model; unsigned int model;
unsigned int family; unsigned int family;
int (*init)(struct arch *arch); int (*init)(struct arch *arch, char *cpuid);
bool (*ins_is_fused)(struct arch *arch, const char *ins1, bool (*ins_is_fused)(struct arch *arch, const char *ins1,
const char *ins2); const char *ins2);
int (*cpuid_parse)(struct arch *arch, char *cpuid);
struct { struct {
char comment_char; char comment_char;
char skip_functions_char; char skip_functions_char;
...@@ -132,10 +131,10 @@ static struct arch architectures[] = { ...@@ -132,10 +131,10 @@ static struct arch architectures[] = {
}, },
{ {
.name = "x86", .name = "x86",
.init = x86__annotate_init,
.instructions = x86__instructions, .instructions = x86__instructions,
.nr_instructions = ARRAY_SIZE(x86__instructions), .nr_instructions = ARRAY_SIZE(x86__instructions),
.ins_is_fused = x86__ins_is_fused, .ins_is_fused = x86__ins_is_fused,
.cpuid_parse = x86__cpuid_parse,
.objdump = { .objdump = {
.comment_char = '#', .comment_char = '#',
}, },
...@@ -1447,16 +1446,13 @@ int symbol__disassemble(struct symbol *sym, struct map *map, ...@@ -1447,16 +1446,13 @@ int symbol__disassemble(struct symbol *sym, struct map *map,
*parch = arch; *parch = arch;
if (arch->init) { if (arch->init) {
err = arch->init(arch); err = arch->init(arch, cpuid);
if (err) { if (err) {
pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name); pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name);
return err; return err;
} }
} }
if (arch->cpuid_parse && cpuid)
arch->cpuid_parse(arch, cpuid);
pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__,
symfs_filename, sym->name, map->unmap_ip(map, sym->start), symfs_filename, sym->name, map->unmap_ip(map, sym->start),
map->unmap_ip(map, sym->end)); map->unmap_ip(map, sym->end));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment