23 Jan, 2011

1 commit

  • The -Wstack-protector and -Wvolatile-register-var warnings, for
    instance, are not supported by gcc 3.4.6.

    So fix by doing the same check we already do for -fstack-protector-all.

    With this and the other patches in this series, perf builds unmodified
    on, for instance, RHEL4.

    Cc: Eric Dumazet
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

07 Jan, 2011

1 commit

  • It seems that some gcc versions build by default with frame pointers
    and some others omit them.

    Just build the tools with frame pointers as the callchains can be an
    important part of the perf workflow.

    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker
    Signed-off-by: Arnaldo Carvalho de Melo

    Frederic Weisbecker
     

04 Jan, 2011

1 commit

  • Out of ad-hoc code and global arrays with hard coded sizes.

    This is the first step on having a library that will be first
    used on regression tests in the 'perf test' tool.

    [acme@felicio linux]$ size /tmp/perf.before
    text data bss dec hex filename
    1273776 97384 5104416 6475576 62cf38 /tmp/perf.before
    [acme@felicio linux]$ size /tmp/perf.new
    text data bss dec hex filename
    1275422 97416 1392416 2765254 2a31c6 /tmp/perf.new

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

07 Dec, 2010

1 commit

  • When we build perf we place all of the .o files from the library files
    (util, arch/x/util, etc) into libperf.a which is then linked into perf.

    The problem is that the linker will by default only consider .o files
    within the .a archive if they are necessary to satisfy an unresolved
    symbol. As weak functions are not unresolved, it will not consider a .o
    file from the archive containing the strong versions of weak functions
    unless it requires it for another reason.

    This patch adds the --whole-archive flags to the linker when passing in
    the libperf.a file to ensure that it will consider every .o file in the
    archive, not just what it believes that it needs. The end result is that
    weak functions can now be overridden by strong variants of them in the
    libperf.a file.

    Cc: "tom.leiming"
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ian Munsie
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Munsie
     

01 Dec, 2010

1 commit


26 Nov, 2010

1 commit

  • …_64.S memcpy routines via 'perf bench mem'

    This patch ports arch/x86/lib/memcpy_64.S to perf bench mem
    memcpy for benchmarking memcpy() in userland with tricky and
    dirty way.

    util/include/asm/cpufeature.h, util/include/asm/dwarf2.h, and
    util/include/linux/linkage.h are mostly dummy files with small
    wrappers, so that we are able to include memcpy_64.S
    unmodified.

    Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
    Cc: h.mitake@gmail.com
    Cc: Miao Xie <miaox@cn.fujitsu.com>
    Cc: Ma Ling <ling.ma@intel.com>
    Cc: Zhao Yakui <yakui.zhao@intel.com>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Andi Kleen <andi@firstfloor.org>
    LKML-Reference: <1290668693-27068-2-git-send-email-mitake@dcl.info.waseda.ac.jp>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

    Hitoshi Mitake
     

20 Nov, 2010

1 commit

  • This change removes the use of hardcoded absolute "/usr/include/elfutils" paths
    from the perf build. The problem with hardcoded paths is that it prevents them
    from being overridden by $prefix or by -I in CFLAGS (e.g., for cross-compiling
    purposes).

    Instead, just include the "elfutils/" subdirectory as a relative path when
    files are needed from that directory.

    Tested by building perf:
    - Cross-compiled for ARM on x86_64
    - Built natively on x86_64
    - Built on x86_64 with /usr/include/elfutils moved to another location
    and manually included in CFLAGS

    Acked-by: Masami Hiramatsu
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    LKML-Reference:
    Signed-off-by: Robert Morell
    Signed-off-by: Arnaldo Carvalho de Melo

    Robert Morell
     

17 Nov, 2010

1 commit


05 Oct, 2010

1 commit


04 Oct, 2010

1 commit

  • The patch ecafda6 introduced a problem where all object files would be
    always rebuilt, fix it by using:

    http://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html

    Reported-by: Arnaldo Carvalho de Melo
    Cc: Bernd Petrovitsch
    Signed-off-by: Kusanagi Kouichi
    Signed-off-by: Arnaldo Carvalho de Melo

    Kusanagi Kouichi
     

26 Aug, 2010

1 commit

  • External shared libraries should never be appended to the LDFLAGS as this
    messes the linking order. As EXTLIBS collects those libraries, it seems that
    perl and python libraries should also be appended to EXTLIBS.

    Also fix the broken linking order.

    This is a refresh of a patch by Ozan Çağlayan and improved by both Tom Zanussi
    and Kirill A. Shutemov.

    Cc: Ozan Çağlayan
    Tested-by: Kirill A. Shutemov
    Tested-by: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Tom Zanussi
     

25 Aug, 2010

1 commit


21 Aug, 2010

1 commit

  • Some Linux distributions like ALT Linux provides patched glibc with
    contains strlcpy(). It's confilcts with strlcpy() from perf.

    Let's add check for strlcpy().

    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    LKML-Reference:
    Signed-off-by: Kirill A. Shutemov
    Signed-off-by: Arnaldo Carvalho de Melo

    Kirill A. Shutemov
     

19 Aug, 2010

1 commit

  • Parts of the build process were generating files outside the specified
    O= directory, causing the build to fail on systems where the sources are
    in a read only file system.

    Fix it by using $(OUTPUT) on these locations.

    Also check that $(OUTPUT) actually exists, just like the top level
    kernel Makefile does. Otherwise the failure message emitted is
    completely misleading.

    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Kusanagi Kouichi
    Signed-off-by: Arnaldo Carvalho de Melo

    Kusanagi Kouichi
     

17 Aug, 2010

1 commit

  • POSIX sh does not specify the brace expansion, so fix it by replacing the
    global $(shell ...) lines quite at the top creating the output directories with
    real rules.

    Cc: Ingo Molnar
    Cc: Kusanagi Kouichi
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Bernd Petrovitsch
    Signed-off-by: Arnaldo Carvalho de Melo

    Bernd Petrovitsch
     

11 Aug, 2010

6 commits


07 Aug, 2010

1 commit


02 Jul, 2010

1 commit


18 Jun, 2010

1 commit

  • Fix a typo introduced by recent Makefile changes, in f9af3a4. Without it, Perl
    scripting support won't get compiled in.

    Cc: Frédéric Weisbecker
    Cc: Ingo Molnar
    Cc: Stephane Eranian
    LKML-Reference:
    Signed-off-by: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Tom Zanussi
     

10 Jun, 2010

1 commit

  • Moving the tests to a separate file, feature-tests.mak and using a try-cc
    function similar to the try-run in Kbuild.

    This also makes the output more quiet as we can stop using the INTERMEDIATE
    target to remove the .perf.dev.null file needed for some gcc versions where
    /dev/null can't be used as the output file name.

    As the tests get shorter by uninlining the source code used to test for
    features, we can more properly use identation.

    The feature tests itself can be made more clear and reused, like when trying to
    see what is needed to have bfd_demangle.

    We also get a bit closer to reusing scripts/Kbuild.include, reducing the
    distance from the kernel build system.

    Tests performed:

    [root@emilia perf]# make -j9 O=/tmp/perf
    PERF_VERSION = 0.0.2.PERF
    GEN /tmp/perf/common-cmds.h
    * new build flags or prefix
    GEN perf-archive
    CC /tmp/perf/builtin-annotate.o
    CC /tmp/perf/bench/sched-messaging.o
    CC /tmp/perf/builtin-diff.o

    CC /tmp/perf/scripts/python/Perf-Trace-Util/Context.o
    CC /tmp/perf/perf.o
    CC /tmp/perf/builtin-help.o
    AR /tmp/perf/libperf.a
    LINK /tmp/perf/perf
    [root@emilia perf]#

    If we uninstall, for instance newt-devel we get:

    [root@emilia perf]# rpm -e newt-devel
    [root@emilia perf]# make -j9 O=/tmp/perf
    Makefile:564: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
    * new build flags or prefix
    GEN perf-archive
    CC /tmp/perf/perf.o
    CC /tmp/perf/builtin-annotate.o

    AR /tmp/perf/libperf.a
    LINK /tmp/perf/perf
    [root@emilia perf]#

    And then binutils-devel:

    [root@emilia perf]# make -j9 O=/tmp/perf
    Makefile:564: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
    Makefile:632: No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling
    * new build flags or prefix
    GEN perf-archive
    CC /tmp/perf/perf.o

    AR /tmp/perf/libperf.a
    LINK /tmp/perf/perf
    [root@emilia perf]#

    And then strictly required devel packages:

    [root@emilia perf]# rpm -e elfutils-libelf-devel elfutils-devel
    [root@emilia perf]# make -j9 O=/tmp/perf
    Makefile:509: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
    Makefile:542: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel. Stop.
    [root@emilia perf]#

    After installing everything back on:

    [root@emilia perf]# yum install elfutils-devel binutils-devel newt-devel

    Installed:
    binutils-devel.x86_64 0:2.20.51.0.2-5.11.el6
    elfutils-devel.x86_64 0:0.147-1.el6
    elfutils-libelf-devel.x86_64 0:0.147-1.el6
    newt-devel.x86_64 0:0.52.11-1.el6

    Complete!
    [root@emilia perf]# make -j9
    PERF_VERSION = 0.0.2.PERF
    GEN common-cmds.h
    * new build flags or prefix
    GEN perf-archive
    CC builtin-annotate.o

    AR libperf.a
    LINK perf
    [root@emilia perf]# make -j9
    [root@emilia perf]#

    Thanks to Sam for pointing me to try-run.

    Cc: David S. Miller
    Cc: Frédéric Weisbecker
    Cc: Ingo Molnar
    Cc: Michal Marek
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Sam Ravnborg
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

18 May, 2010

2 commits


15 May, 2010

1 commit


12 May, 2010

1 commit

  • Now we don't anymore use popen to run 'perf annotate' for the selected
    symbol, instead we collect per address samplings when processing samples
    in 'perf report' if we're using the newt browser, then we use this data
    directly to do annotation.

    Done this way we can actually traverse the objdump_line objects
    directly, matching the addresses to the collected samples and colouring
    them appropriately using lower level slang routines.

    The new ui_browser class will be reused for the main, callchain aware,
    histogram browser, when it will be made generic and don't assume that
    the objects are always instances of the objdump_line class maintained
    using list_heads.

    Cc: Frédéric Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

11 May, 2010

2 commits

  • For Fedora, I want to force perf to link against libiberty.a for
    cplus_demangle, rather than libbfd.a for bfd_demangle due to licensing insanity
    on binutils. (libiberty is LGPL2, libbfd is GPL3.)

    If we just rely on autodetection, we'll end up with libbfd linked against us,
    since they're both in binutils-static in the buildroot.

    Cc: Ingo Molnar
    LKML-Reference:
    Signed-off-by: Kyle McMartin
    Signed-off-by: Arnaldo Carvalho de Melo

    Kyle McMartin
     
  • Check whether elfutils is older than 0.138 (from which version checking
    routine has been introduced). And if so, set NO_DWARF because it is hard
    to check the API dependency without version checking.

    Signed-off-by: Masami Hiramatsu
    Reported-by: Robert Richter
    Cc: Robert Richter
    Cc: Ingo Molnar
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

03 May, 2010

1 commit

  • Currently, perf 'live mode' writes build-ids at the end of the
    session, which isn't actually useful for processing live mode events.

    What would be better would be to have the build-ids sent before any of
    the samples that reference them, which can be done by processing the
    event stream and retrieving the build-ids on the first hit. Doing
    that in perf-record itself, however, is off-limits.

    This patch introduces perf-inject, which does the same job while
    leaving perf-record untouched. Normal mode perf still records the
    build-ids at the end of the session as it should, but for live mode,
    perf-inject can be injected in between the record and report steps
    e.g.:

    perf record -o - ./hackbench 10 | perf inject -v -b | perf report -v -i -

    perf-inject reads a perf-record event stream and repipes it to stdout.
    At any point the processing code can inject other events into the
    event stream - in this case build-ids (-b option) are read and
    injected as needed into the event stream.

    Build-ids are just the first user of perf-inject - potentially
    anything that needs userspace processing to augment the trace stream
    with additional information could make use of this facility.

    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Cc: Frédéric Weisbecker
    LKML-Reference:
    Signed-off-by: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Tom Zanussi
     

02 May, 2010

1 commit

  • We need to refactor code to be explicitely shared by the kernel and at
    least the tools/ userspace programs, so, till we do that, copy the bare
    minimum bitmap/bitops code needed by tools/perf.

    Reported-by: "H. Peter Anvin"
    Cc: Frédéric Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

30 Apr, 2010

1 commit

  • First an example with the first internal test:

    [acme@doppio linux-2.6-tip]$ perf test
    1: vmlinux symtab matches kallsyms: Ok

    So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
    successful.

    If we run it in verbose mode, we'll see details about errors and extra warnings
    for non-fatal problems:

    [acme@doppio linux-2.6-tip]$ perf test -v
    1: vmlinux symtab matches kallsyms:
    --- start ---
    Looking at the vmlinux_path (5 entries long)
    No build_id in vmlinux, ignoring it
    No build_id in /boot/vmlinux, ignoring it
    No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
    Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
    Maps only in vmlinux:
    ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
    ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
    ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
    ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
    ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
    ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
    Maps in vmlinux with a different name in kallsyms:
    ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
    ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
    *ffffffffff600100-ffffffffff60012f 0 [kernel].2
    ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
    ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
    Maps only in kallsyms:
    ffffffffff600130-ffffffffff6003ff 0 [kernel].4
    ---- end ----
    vmlinux symtab matches kallsyms: Ok
    [acme@doppio linux-2.6-tip]$

    In the above case we only know the name of the non contiguous kernel ranges in
    the address space when reading the symbol information from the ELF symtab in
    vmlinux.

    The /proc/kallsyms file lack this, we only notice they are separate because
    there are modules after the kernel and after that more kernel functions, so we
    need to have a module rbtree backed by the module .ko path to get symtabs in
    the vmlinux case.

    The tool uses it to match by address to emit appropriate warning, but don't
    considers this fatal.

    The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
    these cases just as extra info in verbose mode.

    The end of the sections also aren't in kallsyms, so we the symbols layer does
    another pass and sets the end addresses as the next map start minus one, which
    sometimes pads, causing harmless mismatches.

    But at least the symbols match, tested it by copying /proc/kallsyms to
    /tmp/kallsyms and doing changes to see if they were detected.

    This first test also should serve as a first stab at documenting the
    symbol library by providing a self contained example that exercises it
    together with comments about what is being done.

    More tests to check if actions done on a monitored app, like doing mmaps, etc,
    makes the kernel generate the expected events should be added next.

    Cc: Frédéric Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

28 Apr, 2010

1 commit


27 Apr, 2010

1 commit

  • The headers required for DWARF support are provided by the libdw-dev
    package in Debian-based distros. This patch corrects the elfutils-dev
    package name to libdw-dev in the Makefile error message when libdw.h is
    not found.

    Signed-off-by: Stefan Hajnoczi
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Stefan Hajnoczi
     

22 Apr, 2010

1 commit

  • The perf userspace tool included some architecture specific code to map
    registers from the DWARF register number into the names used by the regs
    and stack access API.

    This moves the architecture specific code out into a separate
    arch/x86 directory along with the infrastructure required to use it.

    Signed-off-by: Ian Munsie
    Acked-by: Masami Hiramatsu
    Signed-off-by: Paul Mackerras

    Ian Munsie
     

19 Apr, 2010

1 commit


10 Apr, 2010

1 commit


04 Apr, 2010

1 commit