• Arnaldo Carvalho de Melo's avatar
    perf top: Do not bail out when perf_env__read_cpuid() returns ENOSYS · 61208e6e
    Arnaldo Carvalho de Melo authored
    'perf top' stopped working on hw architectures that do not provide a
    get_cpuid() implementation and thus fallback to the weak get_cpuid()
    default function.
    
    This is done because at annotation time we may need it in the arch
    specific annotation init routine, but that is only being used by arches
    that do provide a get_cpuid() implementation:
    
      $ find tools/  -name "*.[ch]" | xargs grep 'evlist->env'
      tools/perf/builtin-top.c:	top.evlist->env = &perf_env;
      tools/perf/util/evsel.c:		return evsel->evlist->env;
      tools/perf/util/s390-cpumsf.c:	sf->machine_type = s390_cpumsf_get_type(session->evlist->env->cpuid);
      tools/perf/util/header.c:	session->evlist->env = &header->env;
      tools/perf/util/sample-raw.c:	const char *arch_pf = perf_env__arch(evlist->env);
      $
    
      $ find tools/perf/arch  -name "*.[ch]" | xargs grep -w get_cpuid
      tools/perf/arch/x86/util/auxtrace.c:	ret = get_cpuid(buffer, sizeof(buffer));
      tools/perf/arch/x86/util/header.c:get_cpuid(char *buffer, size_t sz)
      tools/perf/arch/powerpc/util/header.c:get_cpuid(char *buffer, size_t sz)
      tools/perf/arch/s390/util/header.c: * Implementation of get_cpuid().
      tools/perf/arch/s390/util/header.c:int get_cpuid(char *buffer, size_t sz)
      tools/perf/arch/s390/util/header.c:	if (buf && get_cpuid(buf, 128))
      $
    
    For 'report' or 'script', i.e. tools working on perf.data files, that is
    setup while reading the header, its just top that needs to explicitely
    read it at tool start.
    
    Fixes: 608127f7 ("perf top: Initialize perf_env->cpuid, needed by the per arch annotation init routine")
    Reported-by: default avatarJohn Garry <john.garry@huawei.com>
    Analysed-by: default avatarJiri Olsa <jolsa@kernel.org>
    Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
    Tested-by: default avatarMark Rutland <mark.rutland@arm.com>
    Tested-by: John Garry <john.garry@huawei.com> # arm64
    Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Will Deacon <will@kernel.org>
    Link: https://lkml.kernel.org/n/tip-lxwjr0cd2eggzx04a780ffrv@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    61208e6e
builtin-top.c 45.3 KB