01 May, 2010

2 commits

  • commit e9e94e3bd862d31777335722e747e97d9821bc1d
    "perf trace: Ignore "overwrite" field if present in
    /events/header_page" makes perf trace launching spurious warnings
    about unexpected tokens read:

    Warning: Error: expected type 6 but read 4

    This change tries to handle the overcommit field in the header_page
    file whenever this field is present or not.

    The problem is that if this field is not present, we try to find it
    and give up in the middle of the line when we realize we are actually
    dealing with another field, which is the "data" one. And this failure
    abandons the file pointer in the middle of the "data" description
    line:

    field: u64 timestamp; offset:0; size:8; signed:0;
    field: local_t commit; offset:8; size:8; signed:1;
    field: char data; offset:16; size:4080; signed:1;
    ^^^
    Here

    What happens next is that we want to read this line to parse the data
    field, but we fail because the pointer is not in the beginning of the
    line.

    We could probably fix that by rewinding the pointer. But in fact we
    don't care much about these headers that only concern the ftrace
    ring-buffer. We don't use them from perf.

    Just skip this part of perf.data, but don't remove it from recording
    to stay compatible with olders perf.data

    Signed-off-by: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Stephane Eranian
    Cc: Steven Rostedt

    Frederic Weisbecker
     
  • -f, -c 1, -R are now useless for trace events recording, moreover
    -M is useless and event hurts.

    Remove them from the documentation examples and from record scripts.

    Signed-off-by: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Tom Zanussi

    Frederic Weisbecker
     

30 Apr, 2010

2 commits

  • 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
     
  • Created when writing the first 'perf test' regression testing routine.

    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

5 commits


27 Apr, 2010

6 commits


24 Apr, 2010

9 commits

  • asciidoc does not allow the "===" to be longer than the line
    above it.
    Also fix a couple types and formatting errors.

    Signed-off-by: William Cohen
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    William Cohen
     
  • To ensure sample events time reordering is reliable, add a -d option
    to perf trace to check that automatically.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Hitoshi Mitake
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Tom Zanussi

    Frederic Weisbecker
     
  • Use the new generic sample events reordering from perf timechart,
    this drops the ad hoc sample reordering it was using before.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Hitoshi Mitake
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Tom Zanussi
    Cc: Arjan van de Ven

    Frederic Weisbecker
     
  • Use the new generic sample events reordering from perf trace.
    Before that, the displayed traces were ordered as they were
    in the input as recorded by perf record (not time ordered).

    This makes eventually perf trace displaying the events as beeing
    time ordered.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Hitoshi Mitake
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Tom Zanussi

    Frederic Weisbecker
     
  • Use the new generic sample events reordering from perf kmem,
    this drops the need of multiplexing the buffers on record time,
    improving the scalability of perf kmem.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Hitoshi Mitake
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Tom Zanussi
    Cc: Pekka Enberg
    Cc: Li Zefan

    Frederic Weisbecker
     
  • Use the new generic sample events reordering from perf sched,
    this drops the need of multiplexing the buffers on record time,
    improving the scalability of perf sched.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Hitoshi Mitake
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Tom Zanussi

    Frederic Weisbecker
     
  • The sample events recorded by perf record are not time ordered
    because we have one buffer per cpu for each event (even demultiplexed
    per task/per cpu for task bound events). But when we read trace events
    we want them to be ordered by time because many state machines are
    involved.

    There are currently two ways perf tools deal with that:

    - use -M to multiplex every buffers (perf sched, perf kmem)
    But this creates a lot of contention in SMP machines on
    record time.

    - use a post-processing time reordering (perf timechart, perf lock)
    The reordering used by timechart is simple but doesn't scale well
    with huge flow of events, in terms of performance and memory use
    (unusable with perf lock for example).
    Perf lock has its own samples reordering that flushes its memory
    use in a regular basis and that uses a sorting based on the
    previous event queued (a new event to be queued is close to the
    previous one most of the time).

    This patch proposes to export perf lock's samples reordering facility
    to the session layer that reads the events. So if a tool wants to
    get ordered sample events, it needs to set its
    struct perf_event_ops::ordered_samples to true and that's it.

    This prepares tracing based perf tools to get rid of the need to
    use buffers multiplexing (-M) or to implement their own
    reordering.

    Also lower the flush period to 2 as it's sufficient already.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Hitoshi Mitake
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Tom Zanussi

    Frederic Weisbecker
     
  • The parse_single_tracepoint_event() was setting some attributes
    before it validated the event was indeed a tracepoint event. This
    caused problems with other initialization routines like in the
    builtin-top.c module whereby sample_period is not set if not 0.

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

    Stephane Eranian
     
  • Previous state machine of perf lock was really broken.
    This patch improves it a little.

    This patch prepares the list of state machine that represents
    lock sequences for each threads.

    These state machines can be one of these sequences:

    1) acquire -> acquired -> release
    2) acquire -> contended -> acquired -> release
    3) acquire (w/ try) -> release
    4) acquire (w/ read) -> release

    The case of 4) is a little special.
    Double acquire of read lock is allowed, so the state machine
    counts read lock number, and permits double acquire and release.

    But, things are not so simple. Something in my model is still wrong.
    I counted the number of lock instances with bad sequence,
    and ratio is like this (case of tracing whoami): bad:233, total:2279

    version 2:
    * threads are now identified with tid, not pid
    * prepared SEQ_STATE_READ_ACQUIRED for read lock.
    * bunch of struct lock_seq_stat is now linked list
    * debug information enhanced (this have to be removed someday)
    e.g.
    | === output for debug===
    |
    | bad:233, total:2279
    | bad rate:0.000000
    | histogram of events caused bad sequence
    | acquire: 165
    | acquired: 0
    | contended: 0
    | release: 68

    Signed-off-by: Hitoshi Mitake
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    Cc: Jens Axboe
    Cc: Jason Baron
    Cc: Xiao Guangrong
    Cc: Ingo Molnar
    LKML-Reference:
    [rename SEQ_STATE_UNINITED to SEQ_STATE_UNINITIALIZED]
    Signed-off-by: Frederic Weisbecker

    Hitoshi Mitake
     

22 Apr, 2010

2 commits

  • This adds mappings from the register numbers from DWARF to the
    register names used in the PowerPC Regs and Stack Access API. This
    allows perf probe to be used to record variable contents on PowerPC.

    This requires the functionality represented by the config symbol
    HAVE_REGS_AND_STACK_ACCESS_API in order to function, although it will
    compile without it. That functionality is added for PowerPC in commit
    359e4284 ("powerpc: Add kprobe-based event tracer").

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

    Ian Munsie
     
  • 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
     

21 Apr, 2010

1 commit

  • When we run into dry run mode, we want to make
    write_kprobe_trace_event to succeed on writing the event. Let's
    initialize it to 0.

    Fixes the following build error:
    util/probe-event.c:1266: attention : «ret» may be used uninitialized in this function
    util/probe-event.c:1266: note: «ret» was declared here

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

    Frederic Weisbecker
     

19 Apr, 2010

1 commit


15 Apr, 2010

12 commits

  • Ingo Molnar
     
  • Conflicts:
    tools/perf/builtin-record.c

    Merge reason: add the live tracing feature, resolve conflict.

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • Trace events are mostly used for tracing and then require not to
    be lost when possible. As opposite to hardware events that really
    require to trigger after a given sample period, trace events mostly
    need to trigger everytime.

    It is a frustrating experience to trace with perf and realize we
    lost a lot of events because we forgot the "-c 1" option.

    Then default sample_period to 1 for trace events but let the user
    override it.

    Signed-off-by: Frederic Weisbecker
    Cc: Arnaldo Carvalho de Melo
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: Thomas Gleixner

    Frederic Weisbecker
     
  • Trace events are mostly used for tracing rather than simple
    counting. Don't bother anymore with adding -R when using them,
    just record raw samples of trace events every time.

    Signed-off-by: Frederic Weisbecker
    Cc: Arnaldo Carvalho de Melo
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: Thomas Gleixner

    Frederic Weisbecker
     
  • Force the overwriting mode by default if append mode is not explicit.
    Adding -f every time one uses perf on a daily basis quickly becomes a
    burden.

    Keep the -f among the options though to avoid breaking some random
    users scripts.

    Signed-off-by: Frederic Weisbecker
    Cc: Arnaldo Carvalho de Melo
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: Thomas Gleixner

    Frederic Weisbecker
     
  • Checking if a tracing field is an array with a dynamic length
    requires to check the field type and seek the "__data_loc"
    string that prepends the actual type, as can be found in a trace
    event format file:

    field:__data_loc char[] name; offset:16; size:4; signed:1;

    But we actually use strcmp() to check if the field type fully
    matches "__data_loc", which may fail as we trip over the rest of
    the type.

    To fix this, use strncmp to only check if it starts with
    "__data_loc".

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Frederic Weisbecker
    Cc: Arnaldo Carvalho de Melo
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Tom Zanussi
    Cc: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     
  • Function entry line should be shown as probe-able line,
    because each function has declared line attribute.

    LKML-Reference:
    Signed-off-by: Masami Hiramatsu
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • DW_OP_plus_uconst can be used for DW_AT_data_member_location.
    This patch adds DW_OP_plus_uconst support when getting
    structure member offset.

    Commiter note:

    Fixed up the size_t format specifier in one case:

    cc1: warnings being treated as errors
    util/probe-finder.c: In function ‘die_get_data_member_location’:
    util/probe-finder.c:270: error: format ‘%d’ expects type ‘int’, but argument 4 has type ‘size_t’
    make: *** [/home/acme/git/build/perf/util/probe-finder.o] Error 1

    LKML-Reference:
    Signed-off-by: Masami Hiramatsu
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Line range should reject the range if the number of lines is 0
    (e.g. "sched.c:1024+0"), and it should show the lines include
    the end of line number (e.g. "sched.c:1024-2048" should show
    2048th line).

    LKML-Reference:
    Signed-off-by: Masami Hiramatsu
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Since line_finder.lno_s/e are signed int but line_range.start/end
    are unsigned int, it is possible to be overflow when converting
    line_range->start/end to line_finder->lno_s/e.
    This changes line_range.start/end and line_list.line to signed int
    and adds overflow checks when setting line_finder.lno_s/e.

    LKML-Reference:
    Signed-off-by: Masami Hiramatsu
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Fix mis-estimation size for making a short filename.
    Since the buffer size is 32 bytes and there are '@' prefix and
    '\0' termination, maximum shorten filename length should be
    30. This means, before searching '/', it should be 31 bytes.

    LKML-Reference:
    Signed-off-by: Masami Hiramatsu
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Instead of using debugfs_path, use debugfs_find_mountpoint()
    to find actual debugfs path.

    LKML-Reference:
    Signed-off-by: Masami Hiramatsu
    Reported-by: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Frederic Weisbecker
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu