09 May, 2015

10 commits

  • To make it generally accessible by other tools/ projects, also will be
    used in the tools/arch/*/include/asm/barrier.h files that are being
    introduced now.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-qnjdqwu3vcnt14vqmr6wu788@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We will need it for atomic.h, so move it from the ad-hoc tools/perf/
    place to a tools/ subset of the kernel arch/ hierarchy.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-zv4x77074resrkl4ayzf5e7d@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We will need it for atomic.h, so move it from the ad-hoc tools/perf/
    place to a tools/ subset of the kernel arch/ hierarchy.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-pk6f5x9vh8k2ebzhh9uj5wo2@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We will need it for atomic.h, so move it from the ad-hoc tools/perf/
    place to a tools/ subset of the kernel arch/ hierarchy.

    Other aches will follow, each in a cset.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-vy6bqmsvm6puibpay2cy4wid@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • $params is similar to $vars but matches only function parameters not
    local variables.

    Thus, this is useful for tracing function parameter changing or tracing
    function call with parameters.

    Testing it:

    # perf probe tcp_sendmsg '$params'
    Added new event:
    probe:tcp_sendmsg (on tcp_sendmsg with $params)

    You can now use it in all perf tools, such as:

    perf record -e probe:tcp_sendmsg -aR sleep 1

    # perf probe -l
    probe:tcp_sendmsg (on tcp_sendmsg@acme/git/linux/net/ipv4/tcp.c with iocb sk msg size)
    # perf record -a -e probe:*
    press some random letters to generate TCP (sshd) traffic...

    ^C[ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.223 MB perf.data (6 samples) ]

    # perf script
    sshd 6385 [2] 3.907529: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
    sshd 6385 [2] 4.138973: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
    sshd 6385 [2] 4.378966: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
    sshd 6385 [2] 4.603681: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
    sshd 6385 [2] 4.818455: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
    sshd 6385 [2] 5.043603: probe:tcp_sendmsg: iocb=0xffff8800ac4cfe70 sk=0xffff88042196c140 msg=0xffff8800ac4cfda8 size=0x24
    # cat /sys/kernel/debug/tracing/events/probe/tcp_sendmsg/format
    name: tcp_sendmsg
    ID: 1927
    format:
    field:unsigned short common_type; offset:0; size:2; signed:0;
    field:unsigned char common_flags; offset:2; size:1; signed:0;
    field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
    field:int common_pid; offset:4; size:4; signed:1;

    field:unsigned long __probe_ip; offset:8; size:8; signed:0;
    field:u64 iocb; offset:16; size:8; signed:0;
    field:u64 sk; offset:24; size:8; signed:0;
    field:u64 msg; offset:32; size:8; signed:0;
    field:u64 size; offset:40; size:8; signed:0;

    print fmt: "(%lx) iocb=0x%Lx sk=0x%Lx msg=0x%Lx size=0x%Lx", REC->__probe_ip, REC->iocb, REC->sk, REC->msg, REC->size
    #

    Do some system wide tracing of this probe + write syscalls:

    # perf trace -e write --ev probe:* --filter-pids 6385
    462.612 (0.010 ms): bash/19153 write(fd: 1, buf: 0x7f7556c78000, count: 29 ) = 29
    462.701 (0.027 ms): sshd/19152 write(fd: 3, buf: 0x7f78dd12e160, count: 68 ) ...
    462.701 ( ): probe:tcp_sendmsg:(ffffffff8163db30) iocb=0xffff8803ebec7e70 sk=0xffff88042196ab80 msg=0xffff8803ebec7da8 size=0x44)
    462.710 (0.035 ms): sshd/19152 ... [continued]: write()) = 68
    462.787 (0.009 ms): bash/19153 write(fd: 2, buf: 0x7f7556c77000, count: 22 ) = 22
    462.865 (0.002 ms): sshd/19152 write(fd: 3, buf: 0x7f78dd12e160, count: 68 ) ...
    462.865 ( ): probe:tcp_sendmsg:(ffffffff8163db30) iocb=0xffff8803ebec7e70 sk=0xffff88042196ab80 msg=0xffff8803ebec7da8 size=0x44)
    462.873 (0.010 ms): sshd/19152 ... [continued]: write()) = 68

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150506124653.4961.59806.stgit@localhost.localdomain
    [ Add some examples to the changelog message showing how to use it ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Skip the kernel symbols which is out of .text, e.g. the functions
    in .inittext. Those are found in debuginfo/kallsyms, but already
    freed from memory.

    e.g.
    ----
    # perf probe vfs_caches_init
    vfs_caches_init+0 is out of .text, skip it.
    Probe point 'vfs_caches_init' not found.
    Error: Failed to add events.
    ----

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150506124649.4961.56249.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Fix --line to check valid C-style function name and returns
    a semantic error if it is not.

    For example, previously, --line doesn't support lazy pattern
    but it doesn't recognized as a semantic error.

    ----
    # perf probe -L 'func;return*:0-10'
    Specified source line is not found.
    Error: Failed to show lines.
    ----

    With this patch, it is correctly handled as a semantic error.
    ----
    # perf probe -L 'func;return*:0-10'
    Semantic error :'func;return*' is not a valid function name.
    ...
    ----

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150506124647.4961.99473.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Fix to return 0 when positive value returned from probe command.

    At least --vars can returns a positive value if it found a point.
    ----
    # perf probe --vars vfs_read && echo succeeded! || echo failed!
    Available variables at vfs_read
    @
    char* buf
    loff_t* pos
    size_t count
    struct file* file
    failed!
    ----

    This fixes above problem.
    ----
    # perf probe --vars vfs_read && echo succeeded! || echo failed!
    Available variables at vfs_read
    @
    char* buf
    loff_t* pos
    size_t count
    struct file* file
    succeeded!
    ----

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150506124645.4961.56973.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Fix to pass O_APPEND by using bit-or with other flags, instead of
    passing it as mode.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: hemant@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/20150506124642.4961.97878.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Fix perf-probe to close probe_events file if it failed to get existing
    probe's name. This also fix the return error code to -ENOMEM.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: hemant@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/20150506124640.4961.26062.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

08 May, 2015

2 commits

  • On powerpc the perf event interrupt is not masked when interrupts are
    disabled, allowing it to function as an NMI.

    This causes problems if perf is using vmalloc. If we take a page fault
    on the vmalloc region the fault handler will fail the page fault because
    it detects we are coming in from an NMI (see do_hash_page()).

    We don't actually need or want vmalloc backed perf so just disable it on
    powerpc.

    Signed-off-by: Michael Ellerman
    Signed-off-by: Peter Zijlstra (Intel)
    Cc:
    Cc: Andrew Morton
    Cc: Anton Blanchard
    Cc: Borislav Petkov
    Cc: H. Peter Anvin
    Cc: Paul Mackerras
    Cc: Thomas Gleixner
    Cc: acme@ghostprotocols.net
    Cc: sukadev@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/1430720799-18426-1-git-send-email-mpe@ellerman.id.au
    Signed-off-by: Ingo Molnar

    Michael Ellerman
     
  • Stephane asked about PERF_COUNT_SW_CPU_MIGRATIONS and I realized it
    was borken:

    > The problem is that the task isn't actually scheduled while its being
    > migrated (obviously), and if its not scheduled, the counters aren't
    > scheduled either, so there's no observing of the fact.
    >
    > A further problem with migrations is that many migrations happen from
    > softirq context, which is nested inside the 'random' task context of
    > whoemever happens to run at that time, similarly for the wakeup
    > migrations triggered from (soft)irq context. All those end up being
    > accounted in the task that's currently running, eg. your 'ls'.

    The below cures this by marking a task as migrated and accounting it
    on the subsequent sched_in().

    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Andrew Morton
    Cc: Borislav Petkov
    Cc: H. Peter Anvin
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

06 May, 2015

23 commits

  • …it/acme/linux into perf/core

    Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

    User visible changes:

    - Improve --filter support for 'perf probe', allowing using its arguments
    on other commands, as --add, --del, etc (Masami Hiramatsu)

    - Show warning when running 'perf kmem stat' on a unsuitable perf.data file,
    i.e. one with events that are not the ones required for the stat variant
    used (Namhyung Kim).

    Infrastructure changes:

    - Auxtrace support patches, paving the way to support Intel PT and BTS (Adrian Hunter)

    - hists browser (top, report) refactorings (Namhyung Kim)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     
  • The has_children and unfolded fields don't belong to the struct
    map_symbol since they're used by the TUI only. Move those fields out of
    map_symbol since the struct is also used by other places.

    This will also help to compact the sizeof struct hist_entry.

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429687101-4360-11-git-send-email-namhyung@kernel.org
    Link: http://lkml.kernel.org/r/1430837746-5439-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Now LEFT key press action can just use do_zoom_dso/thread() code to get
    out of the current filter.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429838133-14001-2-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • The pstack_peek() is to get the topmost entry without removing it.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429838133-14001-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Currently perf_evsel__hists_browse() function spins on a huge loop and
    handles many key actions. Since it's hard to read and modify, let's
    split it out into small helper functions.

    The add_XXX_opt() functions are to register popup menu item on the
    selected entry. When it adds an item, it also saves related data into
    struct popup_action and returns 1 so that it can increase the number of
    items (nr_options).

    With this change, we can simplify the code just to call selected
    callback function without considering various conditions. A callback
    function named do_XXX is called with saved data when the item is
    selected by user.

    No functional change intended.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429687101-4360-9-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Currently perf_evsel__hists_browse() function spins on a huge loop and
    handles many key actions. Since it's hard to read and modify, let's
    split it out into small helper functions.

    This patch introduces do_XXX() functions which corresponds to each goto
    label. This way we can call such functions both from key press actions
    and popup menu actions.

    No functional change intended.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429687101-4360-8-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • The perf_session_env is to save system informantion at the recording
    time to be refered in the hist browser. So it'd be better to keep in
    the struct hist_browser. This is a preparation to later change.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429687101-4360-7-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • The struct pstack is to save currently applied thread and/or dso filters
    in the browser. So it'd be better to keep in the struct hist_browser.
    This is a preparation to later change.

    Suggested-by: Arnaldo Carvalho de Melo
    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429687101-4360-6-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • The struct hist_browser_timer is to carry perf-top related info
    throughout the hist browser code. So it'd be better to keep in the
    struct hist_browser. This is a preparation to later change.

    Suggested-by: Arnaldo Carvalho de Melo
    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429687101-4360-5-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • The options array saves strings for each popup menu item. The number of
    items can be vary according to the currently selected item. So it can
    leak some memory if it's exited from a small item. Fix it by freeing
    all items when loop terminates.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429687101-4360-4-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • The init_have_children is used to init callchain info only for TUI. So
    it'd be better to move it to the TUI-specific unnamed union member.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429687101-4360-3-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Since perf diff only supports stdio output, TUI fields are only accessed
    from perf report (or perf top). So add a new unnamed union and move
    struct hist_entry_tui and those TUI-specific fields.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429687101-4360-2-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Sometimes one can mistakenly run 'perf kmem stat' without running 'perf
    kmem record' before or with a different configuration like recording
    --slab and stat --page. Show a warning message like the one below to
    inform the user:

    # perf kmem stat --page --caller
    No page allocation events found. Have you run 'perf kmem record --page'?

    Signed-off-by: Namhyung Kim
    Acked-by: Pekka Enberg
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Joonsoo Kim
    Cc: Minchan Kim
    Cc: Peter Zijlstra
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/1430837572-31395-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • To simplify the 'perf probe' command code, consolidate some similar
    functions and use command short-name for command classification, instead
    of separate booleans.

    Signed-off-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150505152257.18790.41548.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Since params.filter will be released in cleanup_params, we don't need to
    clear it in each command.

    Signed-off-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150505022952.23399.58072.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • This allows the user to pass the filter pattern directly to the --funcs
    option as below:

    ----
    # ./perf probe -F *kmalloc
    __kmalloc
    devm_kmalloc
    mempool_kmalloc
    sg_kmalloc
    sock_kmalloc
    ----

    We previously needed to use the --filter option for that.

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150505022950.23399.22435.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • This makes perf-probe --del option to accept filter rules
    not only simple glob pattern. This simplifies the code and
    improve the flexibility.

    E.g. if we remove 2 different pattern events, we need 2
    -d options.
    ----
    # ./perf probe -d vfs\* -d malloc
    Removed event: probe_libc:malloc
    Removed event: probe:vfs_read
    ----

    This allows you to joint the 2 patterns with '|'.

    ----
    # ./perf probe -d 'vfs*|malloc'
    Removed event: probe:vfs_read
    Removed event: probe_libc:malloc
    ----

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150505022948.23399.4197.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Add a new option and support for Instruction Tracing Snapshot Mode.
    When the new option is selected, no AUX area tracing data is captured
    until a signal (SIGUSR2) is received.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-10-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Add support for making snapshots of AUX area tracing data.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-9-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Add support for the PERF_RECORD_ITRACE_START event type. This event can
    be used to determine the pid and tid that are running when Instruction
    Tracing starts. Generally that information would come from a
    sched_switch event but, at the start, no sched_switch events may yet
    have been recorded.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-8-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Add support for the PERF_RECORD_AUX event type.

    PERF_RECORD_AUX is a new kernel event that records when new data lands
    in the AUX buffer. Currently it is assumed that AUX data follows the
    same ring buffer conventions used by the perf events buffer, and
    consequently the AUX event is not processed during recording.

    It is processed during session processing so that the information in the
    'flags' member is made available.

    The format of PERF_RECORD_AUX is outlined in the linux/perf_events.h
    header file. The 'flags' are also enumerated.

    Intel PT and Intel BTS use the flag named PERF_AUX_FLAG_TRUNCATED to
    determine if data has been lost because the buffer became full as perf
    was not able to empty it fast enough.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-7-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Add AUX area tracing option 'x' to synthesize events for transactions.
    This will be used by Intel PT to synthesize an event record for each TSX
    start, commit or abort.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-6-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Add build option NO_AUXTRACE to exclude compiling support for AUX area
    tracing. Support for both recording and processing is excluded and by
    implication any future additions such as Intel PT and Intel BTS will
    also not be compiled in with this option.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-5-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

05 May, 2015

5 commits

  • We need to include all buildids when a perf.data file contains AUX area
    tracing data because we do not decode the trace for that purpose because
    it would take too long.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-4-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Add an index of AUX area tracing events within a perf.data file.

    perf record uses a special user event PERF_RECORD_FINISHED_ROUND to
    enable sorting of events in chunks instead of having to sort all events
    altogether.

    AUX area tracing events contain data that can span back to the very
    beginning of the recording period. i.e. they do not obey the rules of
    PERF_RECORD_FINISHED_ROUND.

    By adding an index, AUX area tracing events can be found in advance and
    the PERF_RECORD_FINISHED_ROUND approach works as usual.

    The index is recorded with the auxtrace feature in the perf.data file.
    A session reads the index but does not process it. An AUX area decoder
    can queue all the AUX area data in advance using
    auxtrace_queues__process_index() or otherwise process the index in some
    custom manner.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-3-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Unwittingly the itrace options for perf report ended up below the
    Overhead Calculation section. Move it back with the other options.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1430404667-10593-2-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Currently perf kmem command will select --slab if neither --slab nor
    --page is given for backward compatibility. Add kmem.default config
    option to select the default value ('page' or 'slab').

    # cat ~/.perfconfig
    [kmem]
    default = page

    # perf kmem stat

    SUMMARY (page allocator)
    ========================
    Total allocation requests : 1,518 [ 6,096 KB ]
    Total free requests : 1,431 [ 5,748 KB ]

    Total alloc+freed requests : 1,330 [ 5,344 KB ]
    Total alloc-only requests : 188 [ 752 KB ]
    Total free-only requests : 101 [ 404 KB ]

    Total allocation failures : 0 [ 0 KB ]
    ...

    Signed-off-by: Namhyung Kim
    Acked-by: Pekka Enberg
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Joonsoo Kim
    Cc: Minchan Kim
    Cc: Peter Zijlstra
    Cc: Taeung Song
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/1429592107-1807-6-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Save libtraceevent output and print it in the header.

    # perf kmem stat --page --caller
    #
    # GFP flags
    # ---------
    # 00000010: NI: GFP_NOIO
    # 000000d0: K: GFP_KERNEL
    # 00000200: NWR: GFP_NOWARN
    # 000084d0: K|R|Z: GFP_KERNEL|GFP_REPEAT|GFP_ZERO
    # 000200d2: HU: GFP_HIGHUSER
    # 000200da: HUM: GFP_HIGHUSER_MOVABLE
    # 000280da: HUM|Z: GFP_HIGHUSER_MOVABLE|GFP_ZERO
    # 002084d0: K|R|Z|NT: GFP_KERNEL|GFP_REPEAT|GFP_ZERO|GFP_NOTRACK
    # 0102005a: NF|HW|M: GFP_NOFS|GFP_HARDWALL|GFP_MOVABLE

    ---------------------------------------------------------------------------------------------------------
    Total alloc (KB) | Hits | Order | Mig.type | GFP flags | Callsite
    ---------------------------------------------------------------------------------------------------------
    60 | 15 | 0 | UNMOVABL | K|R|Z|NT | pte_alloc_one
    40 | 10 | 0 | MOVABLE | HUM|Z | handle_mm_fault
    24 | 6 | 0 | MOVABLE | HUM | do_wp_page
    24 | 6 | 0 | UNMOVABL | K | __pollwait
    ...

    Requested-by: Joonsoo Kim
    Suggested-by: Minchan Kim
    Signed-off-by: Namhyung Kim
    Acked-by: Pekka Enberg
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Joonsoo Kim
    Cc: Minchan Kim
    Cc: Peter Zijlstra
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/1429592107-1807-5-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim