19 Oct, 2009

2 commits

  • Use the kernel bitmap library for internal perf tools uses.

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

    Frederic Weisbecker
     
  • When we count both branches and branch-misses it is useful to
    print out the percentage of branch-misses:

    # perf stat -e branches -e branch-misses /bin/true

    Performance counter stats for '/bin/true':

    401684 branches # 0.000 M/sec
    23301 branch-misses # 5.801 %

    Signed-off-by: Anton Blanchard
    Cc: paulus@samba.org
    Cc: a.p.zijlstra@chello.nl
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Anton Blanchard
     

17 Oct, 2009

1 commit

  • In each case, if the NULL test on thread is needed, then the
    dereference should be after the NULL test.

    A simplified version of the semantic match that detects this
    problem is as follows (http://coccinelle.lip6.fr/):

    //
    @match exists@
    expression x, E;
    identifier fld;
    @@

    * x->fld
    ... when != \(x = E\|&x\)
    * x == NULL
    //

    Signed-off-by: Julia Lawall
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Julia Lawall
     

15 Oct, 2009

37 commits

  • Now that we can filter based on fields via perf record, people
    will start using filter expressions and will expect them to
    be obvious.

    The primary way to see which fields are available is by looking
    at the trace output, such as:

    gcc-18676 [000] 343.011728: irq_handler_entry: irq=0 handler=timer
    cc1-18677 [000] 343.012727: irq_handler_entry: irq=0 handler=timer
    cc1-18677 [000] 343.032692: irq_handler_entry: irq=0 handler=timer
    cc1-18677 [000] 343.033690: irq_handler_entry: irq=0 handler=timer
    cc1-18677 [000] 343.034687: irq_handler_entry: irq=0 handler=timer
    cc1-18677 [000] 343.035686: irq_handler_entry: irq=0 handler=timer
    cc1-18677 [000] 343.036684: irq_handler_entry: irq=0 handler=timer

    While 'irq==0' filters work, the 'handler==' filter expression
    does not work:

    $ perf record -R -f -a -e irq:irq_handler_entry --filter handler=timer sleep 1
    Error: failed to set filter with 22 (Invalid argument)

    The problem is that while an 'irq' field exists and is recognized
    as a filter field - 'handler' does not exist - its name is 'name'
    in the output.

    To solve this, we need to synchronize the printout and the field
    names, wherever possible.

    In cases where the printout prints a non-field, we enclose
    that information in square brackets, such as:

    perf-1380 [013] 724.903505: softirq_exit: vec=9 [action=RCU]
    perf-1380 [013] 724.904482: softirq_exit: vec=1 [action=TIMER]

    This way users can use filter expressions more intuitively: all
    fields that show up as 'primary' (non-bracketed) information is
    filterable.

    This patch harmonizes the field names for all irq, bkl, power,
    sched and timer events.

    We might in fact think about dropping the print format bit of
    generic tracepoints altogether, and just print the fields that
    are being recorded.

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

    Ingo Molnar
     
  • Américo Wang noticed that we have a locking imbalance in the
    error paths of ftrace_profile_set_filter(), causing potential
    leakage of event_mutex.

    Also clean up other error codepaths related to event_mutex
    while at it.

    Plus fix an initialized variable in the subsystem filter code.

    Reported-by: Américo Wang
    Cc: Li Zefan
    Cc: Peter Zijlstra
    Cc: Frederic Weisbecker
    Cc: Steven Rostedt
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • Add a new option "--filter " to perf record, and
    it should be right after "-e trace_point":

    #./perf record -R -f -e irq:irq_handler_entry --filter irq==18
    ^C
    # ./perf trace
    perf-4303 ... irq_handler_entry: irq=18 handler=eth0
    init-0 ... irq_handler_entry: irq=18 handler=eth0
    init-0 ... irq_handler_entry: irq=18 handler=eth0
    init-0 ... irq_handler_entry: irq=18 handler=eth0
    init-0 ... irq_handler_entry: irq=18 handler=eth0

    See Documentation/trace/events.txt for the syntax of filter
    expressions.

    Signed-off-by: Li Zefan
    Acked-by: Peter Zijlstra
    Acked-by: Frederic Weisbecker
    Cc: Steven Rostedt
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Li Zefan
     
  • - Add an ioctl to allocate a filter for a perf event.

    - Free the filter when the associated perf event is to be freed.

    - Do the filtering in perf_swevent_match().

    Signed-off-by: Li Zefan
    Acked-by: Peter Zijlstra
    Acked-by: Frederic Weisbecker
    Cc: Steven Rostedt
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Li Zefan
     
  • "==" will always do a full match, and "~" will do a glob match.

    In the future, we may add "=~" for regex match.

    Signed-off-by: Li Zefan
    Acked-by: Peter Zijlstra
    Acked-by: Frederic Weisbecker
    Cc: Steven Rostedt
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Li Zefan
     
  • Change:
    for_each_pred
    for_each_subsystem
    To:
    for_each_subsystem
    for_each_pred

    This change also prepares for later patches.

    Signed-off-by: Li Zefan
    Acked-by: Peter Zijlstra
    Acked-by: Frederic Weisbecker
    Cc: Steven Rostedt
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Li Zefan
     
  • Merge reason: to add event filter support we need the following
    commits from the tracing tree:

    3f6fe06: tracing/filters: Unify the regex parsing helpers
    1889d20: tracing/filters: Provide basic regex support
    737f453: tracing/filters: Cleanup useless headers

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • The (char *) for all the static strings was a fix for the
    symptom and not the disease. The real issue was that the
    function prototypes needed to be declared "const char *".

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

    Steven Rostedt
     
  • The opterators '-' and '+' are not handled in the trace print
    format.

    To do: '++' and '--'.

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

    Steven Rostedt
     
  • Add the irqs disabled, preemption count, need resched, and other
    info that is shown in the latency format of ftrace.

    # perf trace -l
    perf-16457 2..s2. 53636.260344: kmem_cache_free: call_site=ffffffff811198f
    perf-16457 2..s2. 53636.264330: kmem_cache_free: call_site=ffffffff811198f
    perf-16457 2d.s4. 53636.300006: kmem_cache_free: call_site=ffffffff810d889

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

    Steven Rostedt
     
  • The ftrace output events can have either arguments or no
    arguments. The parser needs to be able to handle both.

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

    Steven Rostedt
     
  • The bprintk parsing was broken in more ways than one.

    The file parsing was incorrect, and the words used by the
    arguments are always 4 bytes aligned, even on 64-bit machines.

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

    Steven Rostedt
     
  • Even though an event may fail to parse, we should not kill the
    entire report. The trace should still be able to show what it
    can.

    If an event fails to parse, a warning is printed, and the output
    continues.

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

    Steven Rostedt
     
  • The trace format files now have a "signed" field. But we should
    still be able to handle the kernels that do not have this field.

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

    Steven Rostedt
     
  • New lines between args in the trace format can break the
    parsing. This should not be the case.

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

    Steven Rostedt
     
  • The '*' is currently only treated as a multiplication, and it
    needs to be handled as a typecast pointer.

    This is the version used by trace-cmd.

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

    Steven Rostedt
     
  • The array used by the ftrace stack events (caller[x]) causes
    issues with the parser. This adds code to handle the case, but
    it also assumes that the array is of type long.

    Note, this is a special case used (currently) only by the ftrace
    user and kernel stack records.

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

    Steven Rostedt
     
  • The code to handle the '' ops was all in place, but
    they were not in the switch statement to consider them as valid
    ops.

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

    Steven Rostedt
     
  • The handling of backslashes was broken. It would stop parsing
    when encountering one. Also, '\n', '\t', '\r' and '\\' were not
    converted.

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

    Steven Rostedt
     
  • kmem_alloc ftrace event format had a string that was broken up
    by two tokens. "string 1" "string 2". This patch lets the parser
    be able to handle the concatenation.

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

    Steven Rostedt
     
  • Merge reason: pick up tools/perf/ changes from upstream.

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
    firewire: sbp2: provide fallback if mgt_ORB_timeout is missing
    ieee1394: add documentation entry to MAINTAINERS
    ieee1394: update URLs in debugging-via-ohci1394.txt

    Linus Torvalds
     
  • * branch 'tty-fixes':
    tty: use the new 'flush_delayed_work()' helper to do ldisc flush
    workqueue: add 'flush_delayed_work()' to run and wait for delayed work
    Make flush_to_ldisc properly handle parallel calls

    Linus Torvalds
     
  • …it/frob/linux-2.6-roland

    * 'topic/x86-lds-nits' of git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-roland:
    x86: linker script syntax nits

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
    watchdog: Fix rio watchdog probe function
    sparc64: Set IRQF_DISABLED on LDC channel IRQs.
    sparc64: Fix D-cache flushing on swapin from SW devices.
    sparc64: Fix niagara2 perf IRQ bits.

    Linus Torvalds
     
  • * 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6:
    [S390] sclp_vt220 build fix
    [S390] cio: change misleading console logic
    [S390] call home support: fix proc handler
    [S390] dasd: use idal for device characteristics
    [S390] Add highgprs facility to /proc/cpuinfo
    [S390] dasd: fix locking bug
    [S390] tape390: Fix request queue handling in block driver
    [S390] hypfs: Use subcode 6 if subcode 7 is not available

    Linus Torvalds
     
  • * 'sh/for-2.6.32' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
    sh: Fix a TRACE_IRQS_OFF typo.
    sh: Optimize the setup_rt_frame() I-cache flush.
    sh: Populate initial secondary CPU info from boot_cpu_data.
    sh: Tidy up SMP cpuinfo.
    sh: Use boot_cpu_data for FPU tests in sigcontext paths.
    sh: ftrace: Fix up syscall tracepoint support.
    sh: force dcache flush if dcache_dirty bit set.
    sh: update die() output.

    Linus Torvalds
     
  • …/git/tip/linux-2.6-tip

    * 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    oprofile: warn on freeing event buffer too early
    oprofile: fix race condition in event_buffer free
    lockdep: Use cpu_clock() for lockstat

    Linus Torvalds
     
  • …/git/tip/linux-2.6-tip

    * 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    perf events: Update MAINTAINERS entry file patterns
    perf tools: Remove static debugfs path from parse-events
    perf tools: Fix the NO_64BIT build on pure 64-bit systems
    perf tools: Fix const char type propagation

    Linus Torvalds
     
  • …l/git/tip/linux-2.6-tip

    * 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    sched: Fix missing kernel-doc notation
    Revert "x86, timers: Check for pending timers after (device) interrupts"
    sched: Update the clock of runqueue select_task_rq() selected

    Linus Torvalds
     
  • …nel/git/tip/linux-2.6-tip

    * 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    tracing/filters: Fix memory leak when setting a filter
    tracing: fix trace_vprintk call

    Linus Torvalds
     
  • …git/tip/linux-2.6-tip

    * 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86/paravirt: Use normal calling sequences for irq enable/disable
    x86: fix kernel panic on 32 bits when profiling
    x86: Fix Suspend to RAM freeze on Acer Aspire 1511Lmi laptop
    x86, vmi: Mark VMI deprecated and schedule it for removal

    Linus Torvalds
     
  • The linker scripts grew some use of weirdly wrong linker script syntax.
    It happens to work, but it's not what the syntax is documented to be.
    Clean it up to use the official syntax.

    Signed-off-by: Roland McGrath
    CC: Ian Lance Taylor

    Roland McGrath
     
  • The Unit_Characteristics entry of an SBP-2 unit directory is not
    mandatory as far as I can tell. If it is missing, we would probably
    fail to log in into the target because firewire-sbp2 would not wait for
    status after it sent the login request.

    The fix moves the cleanup of tgt->mgt_orb_timeout into a place where it
    is executed exactly once before login, rather than 0..n times depending
    on the target's config ROM. With targets with one or more
    Unit_Characteristics entries, the result is the same as before.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • set_cmdline_ftrace is a better match against what does this function:
    apply a tracer name from the kernel command line.

    Reported-by: Steven Rostedt
    Signed-off-by: Frederic Weisbecker
    Cc: Li Zefan

    Frederic Weisbecker
     
  • We are using strncpy in the wrong way to copy the ftrace_graph_filter
    boot param because we pass the buffer size instead of the max string
    size it can contain (buffer size - 1). The end result might not be
    NULL terminated as we are abusing the max string size.

    Lets use strlcpy() instead.

    Reported-by: Li Zefan
    Signed-off-by: Frederic Weisbecker
    Cc: Steven Rostedt

    Frederic Weisbecker
     
  • This way all flush_to_ldisc work is always done through the workqueues,
    and we thus have a single point of serialization.

    Signed-off-by: Linus Torvalds

    Linus Torvalds