18 May, 2010

1 commit

  • …git/tip/linux-2.6-tip

    * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (311 commits)
    perf tools: Add mode to build without newt support
    perf symbols: symbol inconsistency message should be done only at verbose=1
    perf tui: Add explicit -lslang option
    perf options: Type check all the remaining OPT_ variants
    perf options: Type check OPT_BOOLEAN and fix the offenders
    perf options: Check v type in OPT_U?INTEGER
    perf options: Introduce OPT_UINTEGER
    perf tui: Add workaround for slang < 2.1.4
    perf record: Fix bug mismatch with -c option definition
    perf options: Introduce OPT_U64
    perf tui: Add help window to show key associations
    perf tui: Make <- exit menus too
    perf newt: Add single key shortcuts for zoom into DSO and threads
    perf newt: Exit browser unconditionally when CTRL+C, q or Q is pressed
    perf newt: Fix the 'A'/'a' shortcut for annotate
    perf newt: Make <- exit the ui_browser
    x86, perf: P4 PMU - fix counters management logic
    perf newt: Make <- zoom out filters
    perf report: Report number of events, not samples
    perf hist: Clarify events_stats fields usage
    ...

    Fix up trivial conflicts in kernel/fork.c and tools/perf/builtin-record.c

    Linus Torvalds
     

11 May, 2010

1 commit

  • The raw_field_ptr() helper, used to retrieve the address of a field
    inside a trace event, treats every strings as if they were dynamic
    ie: having a secondary level of indirection to retrieve their
    contents.

    FIELD_IS_STRING doesn't mean FIELD_IS_DYNAMIC, we only need to
    compute the secondary dereference for the latter case.

    This fixes perf sched segfaults, bad cmdline report and may be
    some other bugs.

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

    Frederic Weisbecker
     

01 May, 2010

1 commit

  • 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
     

15 Apr, 2010

1 commit

  • 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
     

14 Apr, 2010

1 commit

  • Parsing an option from the command line with OPT_BOOLEAN on a
    bool data type would not work on a big-endian machine due to the
    manner in which the boolean was being cast into an int and
    incremented. For example, running 'perf probe --list' on a
    PowerPC machine would fail to properly set the list_events bool
    and would therefore print out the usage information and
    terminate.

    This patch makes OPT_BOOLEAN work as expected with a bool
    datatype. For cases where the original OPT_BOOLEAN was
    intentionally being used to increment an int each time it was
    passed in on the command line, this patch introduces OPT_INCR
    with the old behaviour of OPT_BOOLEAN (the verbose variable is
    currently the only such example of this).

    I have reviewed every use of OPT_BOOLEAN to verify that a true
    C99 bool was passed. Where integers were used, I verified that
    they were only being used for boolean logic and changed them to
    bools to ensure that they would not be mistakenly used as ints.
    The major exception was the verbose variable which now uses
    OPT_INCR instead of OPT_BOOLEAN.

    Signed-off-by: Ian Munsie
    Acked-by: David S. Miller
    Cc: # NOTE: wont apply to .3[34].x cleanly, please backport
    Cc: Git development list
    Cc: Ian Munsie
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    Cc: KOSAKI Motohiro
    Cc: Hitoshi Mitake
    Cc: Rusty Russell
    Cc: Frederic Weisbecker
    Cc: Eric B Munson
    Cc: Valdis.Kletnieks@vt.edu
    Cc: WANG Cong
    Cc: Thiago Farina
    Cc: Masami Hiramatsu
    Cc: Xiao Guangrong
    Cc: Jaswinder Singh Rajput
    Cc: Arjan van de Ven
    Cc: OGAWA Hirofumi
    Cc: Mike Galbraith
    Cc: Tom Zanussi
    Cc: Anton Blanchard
    Cc: John Kacur
    Cc: Li Zefan
    Cc: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ian Munsie
     

08 Apr, 2010

1 commit

  • That is not used in perf where we have the LOST events.

    Without this patch we get:

    [root@doppio ~]# perf lock report | head -3
    Warning: Error: expected 'data' but read 'overwrite'

    So, to make the same perf command work with kernels with and without
    this field, introduce variants for the parsing routines to not warn the
    user in such case.

    Discussed-with: Steven Rostedt
    Cc: Frédéric Weisbecker
    Cc: Hitoshi Mitake
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

24 Feb, 2010

1 commit


31 Jan, 2010

1 commit

  • This patch is required to test the next patch for perf lock.

    At 064739bc4b3d7f424b2f25547e6611bcf0132415 ,
    support for the modifier "__data_loc" of format is added.

    But, when I wanted to parse format of lock_acquired (or some
    event else), raw_field_ptr() did not returned correct pointer.

    So I modified raw_field_ptr() like this patch. Then
    raw_field_ptr() works well.

    Signed-off-by: Hitoshi Mitake
    Acked-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Tom Zanussi
    Cc: Steven Rostedt
    LKML-Reference:
    [ v3: fixed minor stylistic detail ]
    Signed-off-by: Ingo Molnar

    Hitoshi Mitake
     

10 Dec, 2009

1 commit

  • Memset should be given the size of the structure, not the size
    of the pointer.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    type T;
    T *x;
    expression E;
    @@

    memset(x, E, sizeof(
    + *
    x))
    //

    Signed-off-by: Julia Lawall
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Julia Lawall
     

07 Dec, 2009

1 commit

  • - util/header.c
    "len" is aligned to 64. So, it tries to write the out of
    long_name buffer.

    So, this use "zero_buf" to write aligned area.

    - util/trace-event-read.c
    "size" is not including nul byte. So, this allocates it, and set '\0'.

    - util/trace-event-parse.c
    It needs parens to calc correct size.

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

    OGAWA Hirofumi
     

28 Nov, 2009

3 commits

  • The Perl scripting support for perf trace allows most of a trace
    event's data to be accessed directly as handler arguments, but
    not all of it e.g. the less common fields aren't passed in. To
    give scripts access to the other fields and/or any other data or
    metadata in the main perf executable that might be useful, a way
    to access the C data in perf from Perl is needed; this patch
    uses the Perl XS facility to do it for the common_xxx event
    fields not passed to handler functions.

    Context.pm exports three functions to Perl scripts that access
    fields for the current event by calling back into perf:
    common_pc(), common_flags() and common_lock_depth(). Support
    for common_flags() field values was added to Core.pm and a
    script used to sanity check these and other basic scripting
    features, check-perf-trace.pl, was also added.

    Signed-off-by: Tom Zanussi
    Cc: fweisbec@gmail.com
    Cc: rostedt@goodmis.org
    Cc: anton@samba.org
    Cc: hch@infradead.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tom Zanussi
     
  • Implement trace_scripting_ops to make Perl a supported perf
    trace scripting language.

    Additionally adds code that allows Perl trace scripts to access
    the 'flag' and 'symbolic' (__print_flags(), __print_symbolic())
    field information parsed from the trace format files.

    Also adds the Perl implementation of the generate_script()
    trace_scripting_op, which creates a ready-to-run perf trace Perl
    script based on existing trace data. Scripts generated by this
    implementation print out all the fields for each event mentioned
    in perf.data (and will detect and generate the proper scripting
    code for 'flag' and 'symbolic' fields), and will additionally
    generate handlers for the special 'trace_unhandled',
    'trace_begin' and 'trace_end' handlers. Script authors can
    simply remove the printing code to implement their own custom
    event handling.

    Signed-off-by: Tom Zanussi
    Cc: fweisbec@gmail.com
    Cc: rostedt@goodmis.org
    Cc: anton@samba.org
    Cc: hch@infradead.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tom Zanussi
     
  • It's useful to know whether a field is a flag or symbolic field
    for e.g. when generating scripts - it allows us to translate
    those fields specially rather than literally as plain numeric
    values.

    Signed-off-by: Tom Zanussi
    Cc: fweisbec@gmail.com
    Cc: rostedt@goodmis.org
    Cc: anton@samba.org
    Cc: hch@infradead.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tom Zanussi
     

25 Nov, 2009

1 commit

  • Commit 13999e59343b042b0807be2df6ae5895d29782a0 (perf tools:
    Handle the case with and without the "signed" trace field)
    removed code to set the FIELD_IS_SIGNED flag that was originally
    added by commit 26a50744b21fff65bd754874072857bee8967f4d
    (tracing/events: Add 'signed' field to format files).

    This adds it back.

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

    Tom Zanussi
     

21 Oct, 2009

1 commit

  • The second argument in the strtok_r() function is not to be used
    generically and can have different implementations. Currently
    the function parsing of the perf trace code uses the second
    argument to copy data from. This can crash the tool or just have
    unpredictable results.

    The correct solution is to use strsep() which has a defined
    result.

    I also added a check to see if the result was correct, and will
    break out of the loop in case it fails to parse as expected.

    Reported-by: Arnaldo Carvalho de Melo
    Signed-off-by: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     

15 Oct, 2009

14 commits


12 Oct, 2009

1 commit

  • The following perf build warnings/errors in function
    argument types:

    builtin-sched.c:1894: warning: passing argument 1 of 'sort_dimension__add' discards qualifiers from pointer target type
    util/trace-event-parse.c:685: warning: passing argument 2 of 'read_expected' discards qualifiers from pointer target type
    util/trace-event-parse.c:741: warning: passing argument 4 of 'test_type_token' discards qualifiers from pointer target type
    util/trace-event-parse.c:706: warning: passing argument 2 of 'read_expected_item' discards qualifiers from pointer target type

    ... trigger because older GCC is not able to prove that
    sort_dimension__add() does not change the string.

    Some goes for test_type_token().

    Fix this by improving type consistency.

    Signed-off-by: Randy Dunlap
    Acked-by: Frederic Weisbecker
    Acked-by: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    [ Also remove ugly type cast now unnecessary. ]
    Signed-off-by: Ingo Molnar

    Randy Dunlap
     

06 Oct, 2009

4 commits

  • Needed for distinguishing string fields in event stream processing.

    Signed-off-by: Tom Zanussi
    Acked-by: Frederic Weisbecker
    Cc: rostedt@goodmis.org
    Cc: lizf@cn.fujitsu.com
    Cc: hch@infradead.org
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tom Zanussi
     
  • Needed to fully qualify event names for event stream processing.

    Signed-off-by: Tom Zanussi
    Acked-by: Frederic Weisbecker
    Cc: rostedt@goodmis.org
    Cc: lizf@cn.fujitsu.com
    Cc: hch@infradead.org
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tom Zanussi
     
  • The sign info used for filters in the kernel is also useful to
    applications that process the trace stream. Add it to the format
    files and make it available to userspace.

    Signed-off-by: Tom Zanussi
    Acked-by: Frederic Weisbecker
    Cc: rostedt@goodmis.org
    Cc: lizf@cn.fujitsu.com
    Cc: hch@infradead.org
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tom Zanussi
     
  • Add missing BLOCK_IOPOLL_SOFTIRQ entry.

    Signed-off-by: Tom Zanussi
    Acked-by: Frederic Weisbecker
    Cc: rostedt@goodmis.org
    Cc: lizf@cn.fujitsu.com
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tom Zanussi
     

14 Sep, 2009

1 commit

  • Finish the -M/--multiplex option implementation:

    - separate it out from group_fd

    - correctly set it via the ioctl and dont mmap counters that
    are multiplexed

    - modify the perf record event loop to deal with buffer-less
    counters.

    - remove the -g option from perf sched record

    - account for unordered events in perf sched latency

    - (add -f to perf sched record to ease measurements)

    - skip idle threads (pid==0) in latency output

    The result is better latency output by 'perf sched latency':

    -----------------------------------------------------------------------------------
    Task | Runtime ms | Switches | Average delay ms | Maximum delay ms |
    -----------------------------------------------------------------------------------
    ksoftirqd/8 | 0.071 ms | 2 | avg: 0.458 ms | max: 0.913 ms |
    at-spi-registry | 0.609 ms | 19 | avg: 0.013 ms | max: 0.023 ms |
    perf | 3.316 ms | 16 | avg: 0.013 ms | max: 0.054 ms |
    Xorg | 0.392 ms | 19 | avg: 0.011 ms | max: 0.018 ms |
    sleep | 0.537 ms | 2 | avg: 0.009 ms | max: 0.009 ms |
    -----------------------------------------------------------------------------------
    TOTAL: | 4.925 ms | 58 |
    ---------------------------------------------

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

    Ingo Molnar
     

13 Sep, 2009

2 commits

  • perf sched raises the following error when it meets a sched
    switch event:

    perf: builtin-sched.c:286: register_pid: Assertion `!(pid >= 65536)' failed.
    Abandon

    Currently in x86-64, the sched switch events have a hole in the
    middle of the structure:

    u16 common_type;
    u8 common_flags;
    u8 common_preempt_count;
    u32 common_pid;
    u32 common_tgid;

    char prev_comm[16];
    u32 prev_pid;
    u32 prev_prio;

    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     
  • Import the schedbench.c tool that i wrote some time ago to
    simulate scheduler behavior but never finished. It's a good
    basis for perf sched nevertheless.

    Most of its guts are not hooked up to the perf event loop
    yet - that will be done in the patches to come.

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

    Ingo Molnar
     

03 Sep, 2009

1 commit

  • Print out more accurate timestamps - usecs does not cut it
    anymore on fast enough boxes ;-)

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

    Ingo Molnar
     

02 Sep, 2009

1 commit

  • Older versions of GCC are rather stupid about strict aliasing:

    util/trace-event-parse.c: In function 'parse_cmdlines':
    util/trace-event-parse.c:93: warning: dereferencing type-punned pointer will break strict-aliasing rules
    util/trace-event-parse.c: In function 'parse_proc_kallsyms':
    util/trace-event-parse.c:155: warning: dereferencing type-punned pointer will break strict-aliasing rules
    util/trace-event-parse.c:157: warning: dereferencing type-punned pointer will break strict-aliasing rules
    util/trace-event-parse.c:158: warning: dereferencing type-punned pointer will break strict-aliasing rules
    util/trace-event-parse.c: In function 'parse_ftrace_printk':
    util/trace-event-parse.c:294: warning: dereferencing type-punned pointer will break strict-aliasing rules
    util/trace-event-parse.c:295: warning: dereferencing type-punned pointer will break strict-aliasing rules
    make: *** [util/trace-event-parse.o] Error 1

    Make it clear to GCC that we intend with those pointers, by passing
    them through via an explicit (void *) cast.

    We might want to add -fno-strict-aliasing as well, like the kernel
    itself does.

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

    Ingo Molnar
     

31 Aug, 2009

1 commit

  • Complete support for __str_loc type strings of ftrace events
    which have dynamic offsets values set for each of them inside
    their sammples.

    Before:
    geany-5759 [000] 0.000000: lock_release: name
    geany-5759 [000] 0.000000: lock_release: name
    geany-5759 [000] 0.000000: lock_release: name
    kondemand/0-362 [000] 0.000000: lock_release: name
    pdflush-421 [000] 0.000000: lock_release: name

    After:
    geany-5759 [000] 0.000000: lock_release: &u->lock
    geany-5759 [000] 0.000000: lock_release: key
    geany-5759 [000] 0.000000: lock_release: &group->notification_mutex
    kondemand/0-362 [000] 0.000000: lock_release: &rq->lock
    pdflush-421 [000] 0.000000: lock_release: &rq->lock

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

    Frederic Weisbecker