13 Jul, 2016

40 commits

  • That is not present on some libelf implementations, such as the one used
    in Alpine Linux: libelf-0.8.13.

    This ends up disabling the SDT code, that relies on this function.

    One alternative would be to provide an weak fallback implementation or
    the open coded variant used by the buildid sysfs notes reading code.

    Cc: Adrian Hunter
    Cc: Ananth N Mavinakayanahalli
    Cc: Brendan Gregg
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-82lh22ybedy9b9lych8xj12g@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • That doesn't have -I to match lines.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-7nz9hnbk7a9p91ou927ye5yh@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We've decided not to access kernel source files because changes there
    could break the tooling side, this is one more step in that direction.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-ar0hupkxl45h5hk09l2rprj3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • So that we don't end up using the kernel one when building out of tree,
    via a detached tarball.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Fixes: 737ef7d32cb4 ("tools include: Copy linux/stringify.h from the kernel")
    Link: http://lkml.kernel.org/n/tip-t8yn1d7y0magk889ymc8jlai@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We use it in bitops/__ffs.h and bitops/atomic.h, that we also got from
    the kernel, but were getting it from either newer systems that carry it
    in /usr/include, or from the kernel sources, that we decided not to
    touch from tools/ code. Fix it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-lwqvgbuitjmrdpjmjp6zqnyx@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Sounds like a compiler bug, but to silence it, initialize those
    variables to NULL.

    Noticed on:

    Target: x86_64-alpine-linux-musl
    Configured with: /home/buildozer/aports/main/gcc/src/gcc-5.3.0/configure
    --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
    --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl
    --target=x86_64-alpine-linux-musl --with-pkgversion='Alpine 5.3.0'
    --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch
    --disable-multilib --disable-nls --disable-werror --disable-symvers
    --enable-__cxa_atexit --enable-esp --enable-cloog-backend
    --enable-languages=c,c++,objc,java,fortran,ada --disable-libssp
    --disable-libmudflap --disable-libsanitizer --enable-shared
    --enable-threads --enable-tls --with-system-zlib
    Thread model: posix
    gcc version 5.3.0 (Alpine 5.3.0)

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-zyvsjvbl45o7hzcuz78wu2xi@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • This one can be safely defined to be Elf64_Nhdr, as it is in elfutils's
    libelf, but not on musl libc, as both Elf64_Nhdr and Elf32_Nhdr have
    the same layout.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-w8z8614l03lc8bip4ijbywbt@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • All we need from it is already conditionally defined, and this header
    file is not present in older systems, so ditch it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-3jxpz9gwahk4e7ltqtnr1rjg@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-6qkuhv2mrcxmpy5sasc3c9tf@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • On systems where sysconf(_SC_LEVEL1_DCACHE_LINESIZE) is not available,
    such as musl LIBC and Android's bionic libc.

    Cc: Adrian Hunter
    Cc: Chris Phlipot
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-772obxzby758g7m2wmzcejxz@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Those kernel files were being directly accessed, which we're not
    allowing anymore to avoid that changes in the kernel side break tooling.

    Warn if these copies drift from the original files.

    Cc: Adrian Hunter
    Cc: Alexander Yarygin
    Cc: Christoffer Dall
    Cc: David Ahern
    Cc: Eric Auger
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Marc Zyngier
    Cc: Namhyung Kim
    Cc: Naveen N. Rao
    Cc: Srikar Dronamraju
    Cc: Wang Nan
    Cc: Yunlong Song
    Link: http://lkml.kernel.org/n/tip-mnopguymhnwzjhw3mowllvsy@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Noticed while making a copy of these files to tools/ where those kernel
    files were being directly accessed, which we're not allowing anymore to
    avoid that changes in the kernel side break tooling.

    Cc: Christoffer Dall
    Cc: Eric Auger
    Cc: Marc Zyngier
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-82thftcdhj2j5wt6ir4vuyhk@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-ogtjqc0hxm961djgiwboe2q7@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Not used anymore, IIRC it was for useless PROC_FS_MAGIC procfs checks,
    but those are long gone.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-v027did3kvj0vz7bofgzkw29@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Which is just a wrapper for sys_getcpu and is not present in at least
    musl libc.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-kblef7svmhr0g93kkx78envg@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To allow the build to complete on older systems, where those files are
    either not uptodate, lacking some recent additions or not present at
    all.

    And check if the copy drifts from the kernel.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-3jz31pz4nw526uko5da9e7o3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The prototype for epoll_wait() is available in older distros, so use it
    instead of epoll_pwait() (removing the last NULL arg, the sigmask,
    makes it the same thing anyway) to avoid breaking the build.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-pwiwizloxt0jujy8em80qut3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To allow the build to complete on older systems, where those files are
    either not uptodate, lacking some recent additions or not present at
    all.

    And check if the copy drifts from the kernel.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-sxf7rpow2blsno5f7t6n0sqz@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To allow the build to complete on older systems, where those files are
    either not uptodate, lacking some recent additions or not present at
    all.

    And check if the copy drifts from the kernel, as in this synthetic test:

    BUILD: Doing 'make -j4' parallel build
    Warning: tools/include/linux/bpf.h differs from kernel
    Warning: tools/include/linux/bpf_common.h differs from kernel

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-5plvi2gq4x469dcyybiu226q@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We can't access kernel files directly from tools/, so copy the required
    bits, and make sure that we detect when the original files, in the
    kernel, gets modified.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-z7e76274ch5j4nugv048qacb@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We shouldn't use headers from the kernel sources directly, instead we
    should use the system's headers or in cases where that isn't possible,
    like with perf_event.h, where the introduction of kernel features such
    as perf_event_attr.{write_backwards,sample_max_stack} and
    PERF_EVENT_IOC_PAUSE_OUTPUT take some time to become available in
    /usr/include/linux/perf_event.h we need a copy.

    Do it and check for source code drift, emitting a warning when changes
    are detected.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-v6aks5un3s5pehory6f42nrl@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • As it uses PERF_REGS_MAX, fix it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-2t232w0kcqu97xod8t2at2h0@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Since these files use __maybe_unused, and that is defined in
    linux/compiler.h, include it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Davidlohr Bueso
    Cc: Hitoshi Mitake
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-1llbf59ut6xon6ti88jm0n9j@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To make it portable to non-glibc systems, that follow the XSI variant
    instead of the GNU specific one that gets in place when _GNU_SOURCE is
    defined.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-bozcszy93tpgw9ad6qm3dhpx@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Better to whitelist it for libraries that require it (glibc) than
    blacklist it with the ones that don't (uclibc, musl libc, etc).

    Cc: Adrian Hunter
    Cc: Alexey Brodkin
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Vineet Gupta
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-52ih0m63a2n63tanpy6yj682@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To make it portable to non-glibc systems, that follow the XSI variant
    instead of the GNU specific one that gets in place when _GNU_SOURCE is
    defined.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-mixgnh3iyajuqogn2opsocdy@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To make it portable to non-glibc systems, that follow the XSI variant
    instead of the GNU specific one that gets in place when _GNU_SOURCE is
    defined.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-c1gn8x978qfop65m510wy43o@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • They were in tools/include/linux/kernel.h, requiring that it in turn
    included stdio.h, which is way too heavy.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-855h8olnkot9v0dajuee1lo3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • So that we don't have to carry a string.h header in evsel.h

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-2lwpm2aytdvvgo626zuat6et@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The cache.h header doesn't use any of the definitions in some of the
    headers it includes, ditch them and fix the fallout, where files were
    getting stuff they needed just because they were including it, sometimes
    not using what it really exports at all.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-l6r2bmj8h1g3e01wr981on0n@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • It uses isatty(), so needs unistd.h, include it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-ivwuz8f68tb3sdcpguo9wmvx@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Another case of a file using definitions and getting them by chance,
    from indirect header inclusion, fix it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-o3l1vi4gw2w6xyc6z4ig938s@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • It uses poll() but was getting the needed header by chance, do it
    explicitely.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-76b3c5imnl6p69j4lqewzu9l@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • It was getting all sort of needed stuff by sheer luck, via indirect
    includes, fix it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-tvjgo39t8k0ye6dntv3knran@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • No need to include stdio.h from quote.h, also forward declare strbuf.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-k3kbcxhctpxvz6ckve3kv6c1@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We were only indirectly and by luck getting types, etc needed for this
    file, fix it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-gr8ejvzm7ojk6zwpeplyx9zu@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • And remove the empty tools/arch/x86/include/asm/unistd_{32,64}.h files
    introduced by eae7a755ee81 ("perf tools, x86: Build perf on older
    user-space as well").

    This way we get closer to mirroring the kernel for cases where __NR_
    can't be found for some include path/_GNU_SOURCE/whatever scenario.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-kpj6m3mbjw82kg6krk2z529e@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We should try avoiding that perf.h header, it includes way too much
    stuff, making it difficult to use things like setting _GNU_SOURCE only
    on a small set of headers.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Davidlohr Bueso
    Cc: Hitoshi Mitake
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-lb6eg9w1kzrwhv0gm3ho0h54@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • These were only defined if _GNU_SOURCE was set in older glibc versions,
    check that and provide the defines in such cases.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-b8esouhpg4tk6vi4n3d7ipch@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • This one was only defined if _GNU_SOURCE was set in older glibc
    versions, check that and provide the define in such cases.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-ilsgsysr6s3mru7rf2befnu5@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo