]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
perf annotate: Remove arch::cpuid_parse callback
authorJiri Olsa <jolsa@kernel.org>
Wed, 11 Oct 2017 15:01:24 +0000 (17:01 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 23 Oct 2017 14:20:54 +0000 (11:20 -0300)
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>
tools/perf/arch/arm/annotate/instructions.c
tools/perf/arch/arm64/annotate/instructions.c
tools/perf/arch/powerpc/annotate/instructions.c
tools/perf/arch/s390/annotate/instructions.c
tools/perf/arch/x86/annotate/instructions.c
tools/perf/util/annotate.c

index 1ce0872b1726d7e4c56a7ded64de3513f404ee7b..6dfec7c2369681b894530a280b94b44adb971b69 100644 (file)
@@ -1,3 +1,4 @@
+#include <linux/compiler.h>
 #include <sys/types.h>
 #include <regex.h>
 
@@ -23,7 +24,7 @@ static struct ins_ops *arm__associate_instruction_ops(struct arch *arch, const c
        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;
        int err;
index 8f1908756cb69bd6b452aec963650b5bebe2ffea..a2c32be4132a5eb9e15e32c59ca02616068d526b 100644 (file)
@@ -1,3 +1,4 @@
+#include <linux/compiler.h>
 #include <sys/types.h>
 #include <regex.h>
 
@@ -25,7 +26,7 @@ static struct ins_ops *arm64__associate_instruction_ops(struct arch *arch, const
        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;
        int err;
index 3c4004db81b954b753bd150d7efa002103d7958b..b6b0ef5952d01682cfbc9eabed20554657b7a3d7 100644 (file)
@@ -1,3 +1,5 @@
+#include <linux/compiler.h>
+
 static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, const char *name)
 {
        int i;
@@ -46,7 +48,7 @@ static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, con
        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) {
                arch->initialized = true;
index 745b4b1b8b21eefe3525144741d1d64c02a7a25d..b8676ccbed76d0e2d3bce98fc7f32a89edb77660 100644 (file)
@@ -1,3 +1,5 @@
+#include <linux/compiler.h>
+
 static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *name)
 {
        struct ins_ops *ops = NULL;
@@ -19,7 +21,7 @@ static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *na
        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) {
                arch->initialized = true;
index d84b72063a30e33847e28891c16b9158bb0b8406..563cd4564041469da5f12d3611c194f5cfd9c39f 100644 (file)
@@ -122,3 +122,17 @@ static int x86__cpuid_parse(struct arch *arch, char *cpuid)
 
        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;
+}
index 4397a8b6e6cd902ac082e0539614ea2c5dd1374a..08164162c34564a1471d6d82d33a8ed87cff007f 100644 (file)
@@ -49,10 +49,9 @@ struct arch {
        void            *priv;
        unsigned int    model;
        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,
                                        const char *ins2);
-       int             (*cpuid_parse)(struct arch *arch, char *cpuid);
        struct          {
                char comment_char;
                char skip_functions_char;
@@ -132,10 +131,10 @@ static struct arch architectures[] = {
        },
        {
                .name = "x86",
+               .init = x86__annotate_init,
                .instructions = x86__instructions,
                .nr_instructions = ARRAY_SIZE(x86__instructions),
                .ins_is_fused = x86__ins_is_fused,
-               .cpuid_parse = x86__cpuid_parse,
                .objdump =  {
                        .comment_char = '#',
                },
@@ -1447,16 +1446,13 @@ int symbol__disassemble(struct symbol *sym, struct map *map,
                *parch = arch;
 
        if (arch->init) {
-               err = arch->init(arch);
+               err = arch->init(arch, cpuid);
                if (err) {
                        pr_err("%s: failed to initialize %s arch priv area\n", __func__, arch->name);
                        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__,
                 symfs_filename, sym->name, map->unmap_ip(map, sym->start),
                 map->unmap_ip(map, sym->end));