20 Apr, 2017

3 commits


29 Sep, 2016

1 commit

  • Match linkage name with mangled name if exists. The linkage_name is used
    for storing mangled name of the object.

    Thus, this allows 'perf probe' to find appropriate probe point from
    mangled symbol as below.

    E.g. without this fix:
    ----
    $ perf probe -x /usr/lib64/libstdc++.so.6 \
    -D _ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv
    Probe point '_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv'
    not found.
    Error: Failed to add events.
    ----

    With this fix, perf probe can find the correct one.
    ----
    $ perf probe -x /usr/lib64/libstdc++.so.6 \
    -D _ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv
    p:probe_libstdc/_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv
    /usr/lib64/libstdc++.so.6.0.22:0x8ca60
    ----

    Committer notes:

    After the fix, setting it for real (no -D/--definition, that amounts to
    a --dry-run):

    # perf probe -x /usr/lib64/libstdc++.so.6 _ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv
    Added new event:
    probe_libstdc:_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv (on _ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv in /usr/lib64/libstdc++.so.6.0.22)

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

    perf record -e probe_libstdc:_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv -aR sleep 1

    # perf probe -l probe_libstdc:*
    probe_libstdc:_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv (on is_open@libstdc++-v3/include/fstream in /usr/lib64/libstdc++.so.6.0.22)
    #

    Reported-by: Thomas Gleixner
    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/147464493162.29804.16715053505069382443.stgit@devbox
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

01 Sep, 2016

1 commit

  • Move generic dwarf related functions from util/probe-finder.c to
    util/dwarf-aux.c. Functions name and their prototype are also changed
    accordingly. No functionality changes.

    Suggested-and-Acked-by: Masami Hiramatsu
    Signed-off-by: Ravi Bangoria
    Cc: Alexander Shishkin
    Cc: Hemant Kumar
    Cc: Naveen N. Rao
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1472546377-25612-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     

10 May, 2016

1 commit


06 Apr, 2016

1 commit

  • If not, tell the user that:

    config/Makefile:273: Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157

    And return -ENOTSUPP in die_get_var_range(), failing features that
    need it, like the one pointed out above.

    This fixes the build on older systems, such as Ubuntu 12.04.5.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Vinson Lee
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-9l7luqkq4gfnx7vrklkq4obs@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

24 Mar, 2016

1 commit


14 Aug, 2015

1 commit

  • The commit 75186a9b09e4 (perf probe: Fix to show lines of sys_ functions
    correctly) introduced a bug by a missed brace around if block. This
    fixes to add it.

    Signed-off-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Fixes: 75186a9b09e4 ("perf probe: Fix to show lines of sys_ functions correctly")
    Link: http://lkml.kernel.org/r/20150812215541.9088.62425.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

13 Aug, 2015

1 commit

  • "perf probe --lines sys_poll" shows only the first line of sys_poll,
    because the SYSCALL_DEFINE macro:

    ----
    SYSCALL_DEFINE*(foo,...)
    {
    body;
    }
    ----

    is expanded as below (on debuginfo)

    ----

    static inline int SYSC_foo(...)
    {
    body;
    }
    int SyS_foo(...)
    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/20150812012406.11811.94691.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

16 May, 2015

1 commit

  • Replacing %lu format strings for Dwarf_Addr type with PRIu64 as it fits
    for Dwarf_Addr (defined as uint64_t) type and works also on both 32/64
    bits.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: He Kuang
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1431706991-15646-1-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

14 May, 2015

1 commit

  • perf probe currently errors out if there are any tail calls to probed
    functions:

    [root@rhel71be]# perf probe do_fork
    Failed to find probe point in any functions.
    Error: Failed to add events.

    Fix this by teaching perf to ignore tail calls.

    Without patch:

    [root@rhel71be perf]# ./perf probe -v do_fork
    probe-definition(0): do_fork symbol:do_fork file:(null) line:0 offset:0
    return:0 lazy:(null)
    0 arguments
    Looking at the vmlinux_path (7 entries long)
    symsrc__init: build id mismatch for /boot/vmlinux.
    Using /usr/lib/debug/lib/modules/3.10.0-201.el7.ppc64/vmlinux for symbols
    Open Debuginfo file:
    /usr/lib/debug/lib/modules/3.10.0-201.el7.ppc64/vmlinux
    Try to find probe point from debuginfo.
    found inline addr: 0xc0000000000bb9b0
    Probe point found: do_fork+0
    found inline addr: 0xc0000000000bbe20
    Probe point found: kernel_thread+48
    found inline addr: 0xc0000000000bbe5c
    Probe point found: sys_fork+28
    found inline addr: 0xc0000000000bbfac
    Probe point found: sys_vfork+44
    found inline addr: 0xc0000000000bc27c
    Failed to find probe point in any functions.
    An error occurred in debuginfo analysis (-2).
    Error: Failed to add events. Reason: No such file or directory (Code: -2)

    With patch:

    [root@rhel71be perf]# ./perf probe -v do_fork
    probe-definition(0): do_fork symbol:do_fork file:(null) line:0 offset:0
    return:0 lazy:(null)
    0 arguments
    Looking at the vmlinux_path (7 entries long)
    symsrc__init: build id mismatch for /boot/vmlinux.
    Using /usr/lib/debug/lib/modules/3.10.0-201.el7.ppc64/vmlinux for symbols
    Open Debuginfo file:
    /usr/lib/debug/lib/modules/3.10.0-201.el7.ppc64/vmlinux
    Try to find probe point from debuginfo.
    found inline addr: 0xc0000000000bb9b0
    Probe point found: do_fork+0
    found inline addr: 0xc0000000000bbe20
    Probe point found: kernel_thread+48
    found inline addr: 0xc0000000000bbe5c
    Probe point found: sys_fork+28
    found inline addr: 0xc0000000000bbfac
    Probe point found: sys_vfork+44
    found inline addr: 0xc0000000000bc27c
    Ignoring tail call from SyS_clone
    Found 4 probe_trace_events.
    Opening /sys/kernel/debug/tracing/kprobe_events write=1
    No kprobe blacklist support, ignored
    Added new events:
    Writing event: p:probe/do_fork _text+768432
    Failed to write event: Invalid argument
    Error: Failed to add events. Reason: Invalid argument (Code: -22)

    [Ignore the error about failure to write event - this kernel is missing
    a patch to resolve _text properly]

    The reason to ignore tail calls is that the address does not belong to
    any function frame. In the example above, the address in SyS_clone is
    0xc0000000000bc27c, but looking at the debug-info:

    : Abbrev Number: 133 (DW_TAG_subprogram)
    DW_AT_external : 1
    DW_AT_name : (indirect string, offset: 0x3cea3): SyS_clone
    DW_AT_decl_file : 7
    DW_AT_decl_line : 1689
    DW_AT_prototyped : 1
    DW_AT_type :
    DW_AT_low_pc : 0xc0000000000bc270
    DW_AT_high_pc : 0xc
    DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
    DW_AT_GNU_all_call_sites: 1
    DW_AT_sibling :

    : Abbrev Number: 125 (DW_TAG_GNU_call_site)
    DW_AT_low_pc : 0xc0000000000bc27c
    DW_AT_GNU_tail_call: 1
    DW_AT_abstract_origin:

    The frame ends at 0xc0000000000bc27c. I suppose this is why this
    particular call is a "tail" call. FWIW, systemtap seems to ignore these
    as well and requires users to explicitly place probes at these call
    sites if necessary. I print out the caller so that users know.

    Signed-off-by: Naveen N. Rao
    Acked-by: Masami Hiramatsu
    Link: http://lkml.kernel.org/r/1430394151-15928-1-git-send-email-naveen.n.rao@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naveen N. Rao
     

12 May, 2015

2 commits

  • It is not easy for users to get the accurate byte offset or the line
    number where a local variable can be probed.

    With '--range' option, local variables in the scope of the probe point
    are showed with a byte offset range, and can be added according to this
    range information.

    For example, there are some variables in the function
    generic_perform_write():


    0 ssize_t generic_perform_write(struct file *file,
    1 struct iov_iter *i, loff_t pos)
    2 {
    3 struct address_space *mapping = file->f_mapping;
    4 const struct address_space_operations *a_ops = mapping->a_ops;
    ...
    42 status = a_ops->write_begin(file, mapping, pos, bytes, flags,
    &page, &fsdata);
    44 if (unlikely(status < 0))

    But we fail when we try to probe the variable 'a_ops' at line 42 or 44.

    $ perf probe --add 'generic_perform_write:42 a_ops'
    Failed to find the location of a_ops at this address.
    Perhaps, it has been optimized out.

    This is because the source code do not match the assembly, so a variable
    may not be available in the source code line where it appears.

    After this patch, we can lookup the accurate byte offset range of a
    variable, 'INV' indicates that this variable is not valid at the given
    point, but available in the scope:

    $ perf probe --vars 'generic_perform_write:42' --range
    Available variables at generic_perform_write:42
    @
    [INV] ssize_t written @
    [INV] struct address_space_operations* a_ops @
    [VAL] (unknown_type) fsdata @
    [VAL] loff_t pos @
    [VAL] long int status @
    [VAL] long unsigned int bytes @
    [VAL] struct address_space* mapping @
    [VAL] struct iov_iter* i @
    [VAL] struct page* page @

    Then it is more clear for us to add a probe with this variable:

    $ perf probe --add 'generic_perform_write+170 a_ops'
    Added new event:
    probe:generic_perform_write (on generic_perform_write+170 with a_ops)

    Signed-off-by: He Kuang
    Acked-by: Masami Hiramatsu
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1431336304-16863-2-git-send-email-hekuang@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    He Kuang
     
  • Use struct strbuf instead of bare char[] to remove the length limitation
    of variables in variable_list, so they will not disappear due to
    overlength, and make preparation for adding more description for
    variables.

    Signed-off-by: He Kuang
    Acked-by: Masami Hiramatsu
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1431336304-16863-1-git-send-email-hekuang@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    He Kuang
     

09 May, 2015

1 commit

  • Support glob wildcards for function name when adding new probes. This
    will allow us to build caches of function-entry level information with
    $params.

    e.g.
    ----
    # perf probe --no-inlines --add 'kmalloc* $params'
    Added new events:
    probe:kmalloc_slab (on kmalloc* with $params)
    probe:kmalloc_large_node (on kmalloc* with $params)
    probe:kmalloc_order_trace (on kmalloc* with $params)

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

    perf record -e probe:kmalloc_order_trace -aR sleep 1

    # perf probe --list
    probe:kmalloc_large_node (on kmalloc_large_node@mm/slub.c with size flags node)
    probe:kmalloc_order_trace (on kmalloc_order_trace@mm/slub.c with size flags order)
    probe:kmalloc_slab (on kmalloc_slab@mm/slab_common.c with size flags)
    ----

    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/20150508010335.24812.19972.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

03 Apr, 2015

1 commit

  • Fix 'perf probe' to track down unnamed union/structure members.

    perf probe did not track down the tree of unnamed union/structure
    members, since it just failed to find given "name" in a parent
    structure/union. To solve this issue, I've introduced 2 changes.

    - Fix die_find_member() to track down the type-DIE if it is
    unnamed, and if it contains the specified member, returns the
    unnamed member.
    (note that we don't return found member, since unnamed member
    has the offset in the parent structure)
    - Fix convert_variable_fields() to track down the unnamed union/
    structure (one-by-one).

    With this patch, perf probe can access unnamed fields:
    -----
    #./perf probe -nfx ./perf lock__delete ops 'locked_ops=ops->locked.ops'
    Added new event:
    probe_perf:lock__delete (on lock__delete in /home/mhiramat/ksrc/linux-3/tools/perf/perf with ops locked_ops=ops->locked.ops)

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

    perf record -e probe_perf:lock__delete -aR sleep 1
    -----

    Reported-by: Arnaldo Carvalho de Melo
    Report-Link: https://lkml.org/lkml/2015/3/5/431
    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/20150402073312.14482.37942.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

06 Feb, 2015

1 commit

  • Fix to handle optimized no-inline functions which have only function
    definition but no actual instance at that point.

    To fix this problem, we need to find actual instance of the function.

    Without this patch:
    ----
    # perf probe -a __up
    Failed to get entry address of __up.
    Error: Failed to add events.
    # perf probe -L __up
    Specified source line is not found.
    Error: Failed to show lines.
    ----

    With this patch:
    ----
    # perf probe -a __up
    Added new event:
    probe:__up (on __up)

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

    perf record -e probe:__up -aR sleep 1

    # perf probe -L __up

    0 static noinline void __sched __up(struct semaphore *sem)
    {
    struct semaphore_waiter *waiter = list_first_entry(&sem->wait_
    struct semaphore_waite
    4 list_del(&waiter->list);
    5 waiter->up = true;
    6 wake_up_process(waiter->task);
    7 }
    ----

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

    Masami Hiramatsu
     

04 Jun, 2014

1 commit

  • Fix perf probe to find correct variable DIE which has location or
    external instance by tracking down the lexical blocks.

    Current die_find_variable() expects that the all variable DIEs
    which has DW_TAG_variable have a location. However, since recent
    dwarf information may have declaration variable DIEs at the
    entry of function (subprogram), die_find_variable() returns it.

    To solve this problem, it must track down the DIE tree to find
    a DIE which has an actual location or a reference for external
    instance.

    e.g. finding a DIE which origin is ;

    : Abbrev Number: 95 (DW_TAG_subprogram)
    DW_AT_abstract_origin:
    DW_AT_low_pc : 0x1850
    [...]
    : Abbrev Number: 119 (DW_TAG_variable) DW_AT_abstract_origin:
    : Abbrev Number: 119 (DW_TAG_variable)
    [...]
    : Abbrev Number: 105 (DW_TAG_lexical_block)
    DW_AT_ranges : 0xaa0
    : Abbrev Number: 96 (DW_TAG_variable) DW_AT_abstract_origin:
    DW_AT_location : 0x486c (location list)

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Arnaldo Carvalho de Melo
    Cc: Arnaldo Carvalho de Melo
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/20140529121930.30879.87092.stgit@ltc230.yrl.intra.hitachi.co.jp
    Signed-off-by: Jiri Olsa

    Masami Hiramatsu
     

05 Oct, 2013

1 commit

  • Fix to find the correct (as much as possible) line information for
    listing probes. Without this fix, perf probe --list action will show
    incorrect line information as below;

    probe:getname_flags (on getname_flags@ksrc/linux-3/fs/namei.c)
    probe:getname_flags_1 (on getname:-89@x86/include/asm/current.h)
    probe:getname_flags_2 (on user_path_at_empty:-2054@x86/include/asm/current.h)

    The minus line number is obviously wrong, and current.h is not related
    to the probe point. Deeper investigation discovered that there were 2
    issues related to this bug, and minor typos too.

    The 1st issue is the rack of considering about nested inlined functions,
    which causes the wrong (relative) line number.

    The 2nd issue is that the dwarf line info is not correct at those
    points. It points 14th line of current.h.

    Since it seems that the line info includes somewhat unreliable
    information, this fixes perf to try to find correct line information
    from both of debuginfo and line info as below.

    1) Probe address is the entry of a function instance

    In this case, the line is set as the function declared line.

    2) Probe address is the entry of an expanded inline function block

    In this case, the line is set as the function call-site line.
    This means that the line number is relative from the entry line
    of caller function (which can be an inlined function if nested)

    3) Probe address is inside a function instance or an expanded
    inline function block

    In this case, perf probe queries the line number from lineinfo
    and verify the function declared file is same as the file name
    queried from lineinfo.

    If the file name is different, it is a failure case. The probe
    address is shown as symbol+offset.

    4) Probe address is not in the any function instance

    This is a failure case, the probe address is shown as
    symbol+offset.

    With this fix, perf probe -l shows correct probe lines as below;

    probe:getname_flags (on getname_flags@ksrc/linux-3/fs/namei.c)
    probe:getname_flags_1 (on getname:2@ksrc/linux-3/fs/namei.c)
    probe:getname_flags_2 (on user_path_at_empty:4@ksrc/linux-3/fs/namei.c)

    Changes at v2:
    - Fix typos in the function comments. (Thanks to Namhyung Kim)
    - Use die_find_top_inlinefunc instead of die_find_inlinefunc_next.

    Signed-off-by: Masami Hiramatsu
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20130930092144.1693.11058.stgit@udc4-manage.rcp.hitachi.co.jp
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

19 Sep, 2013

1 commit

  • The commit ba28c59bc9ed8fb7b9a753cd88ee54a2c4f6265b fixed a declaration
    entry bug in probe_point_search_cb(). There are same bugs in line
    finder and call_probe_finder(). This introduces a new dwarf utility
    function to determine given DIE is a function definition, not
    declaration.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Prashanth Nageshappa
    Cc: Srikar Dronamraju
    Cc: Steven Rostedt
    Cc: yrl.pp-manager.tt@hitachi.com
    Link: http://lkml.kernel.org/r/20120423032435.8737.80064.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

27 Sep, 2012

1 commit

  • …ing accessible variables

    When showing accessible variables, an enum type variable was printed in
    "variable-name" format. Change this format into "enum variable-name".

    Signed-off-by: Hyeoncheol Lee <hyc.lee@gmail.com>
    Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Link: http://lkml.kernel.org/r/1348713399-4541-1-git-send-email-hyc.lee@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

    Hyeoncheol Lee
     

12 Aug, 2011

5 commits

  • With gcc4.6, some instances of concrete inlined function looks redundant
    and broken, because it appears inside of a concrete instance and its
    call_file and call_line are same as the original abstruct's decl_file
    and decl_line respectively.

    e.g.
    [ d1aa] subprogram
    external (flag) Yes
    name (strp) "add_timer"
    decl_file (data1) 2 ;here is original
    decl_line (data2) 847 ;line and file
    prototyped (flag) Yes
    inline (data1) inlined (1)
    sibling (ref4) [ d1c6]
    ...
    [ 11d84] subprogram
    abstract_origin (ref4) [ d1aa] ; concrete instance
    low_pc (addr) .text+0x000000000000246f
    high_pc (addr) .text+0x000000000000248b
    frame_base (block1) [ 0] call_frame_cfa
    sibling (ref4) [ 11dd9]
    [ 11d9f] formal_parameter
    abstract_origin (ref4) [ d1b9]
    location (data4) location list [ 701b]
    [ 11da8] inlined_subroutine
    abstract_origin (ref4) [ d1aa] ; redundant instance
    low_pc (addr) .text+0x000000000000247e
    high_pc (addr) .text+0x0000000000002480
    call_file (data1) 2 ; call line and file
    call_line (data2) 847 ; are same as above

    Those redundant instances leads unwilling results;

    e.g. find probe points inside of functions even if we specify
    a function entry as below;

    $ perf probe -V add_timer
    Available variables at add_timer
    @
    struct timer_list* timer
    @
    (No matched variables)

    So, this filters out those redundant instances based on call-site and
    decl-site information.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: yrl.pp-manager.tt@hitachi.com
    Link: http://lkml.kernel.org/r/20110811110317.19900.59525.stgit@fedora15
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • gcc 4.6 generates a concrete out-of-line instance when there is a
    function which is implicitly inlined somewhere but also has its own
    instance. The concrete out-of-line instance means that it has an
    abstract origin of the function which is referred by not only
    inlined-subroutines but also a concrete subprogram.

    Since current dwarf_func_inline_instances() can find only instances of
    inlined-subroutines, this introduces new die_walk_instances() to find
    both of subprogram and inlined-subroutines.

    e.g. without this,
    Available variables at sched_group_rt_period
    @
    struct task_group* tg

    perf probe failed to find actual subprogram instance of
    sched_group_rt_period().

    With this,

    Available variables at sched_group_rt_period
    @
    struct task_group* tg
    @
    struct task_group* tg

    Now it found the sched_group_rt_period() itself.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: yrl.pp-manager.tt@hitachi.com
    Link: http://lkml.kernel.org/r/20110811110311.19900.63997.stgit@fedora15
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Fix perf probe to search local variables in appropriate local inlined
    function scope. For example, pre_schedule() has only 2 local variables,
    as below;

    $ perf probe -L pre_schedule

    0 static inline void pre_schedule(struct rq *rq, struct task_struct *prev)
    {
    2 if (prev->sched_class->pre_schedule)
    3 prev->sched_class->pre_schedule(rq, prev);
    }

    However, current perf probe shows 4 local variables on pre_schedule(),
    because it searches variables in the caller(schedule()) scope.

    $ perf probe -V pre_schedule
    Available variables at pre_schedule
    @
    int cpu
    long unsigned int* switch_count
    struct rq* rq
    struct task_struct* prev

    This patch fixes this issue by searching variables in the local scope of
    the instance of inlined function. Here is the result.

    $ perf probe -V pre_schedule
    Available variables at pre_schedule
    @
    struct rq* rq
    struct task_struct* prev

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: yrl.pp-manager.tt@hitachi.com
    Link: http://lkml.kernel.org/r/20110811110259.19900.85664.stgit@fedora15
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Fix perf probe to walk through the lines of all nested inlined function
    call sites and declared lines when a whole CU is passed to the line
    walker.

    The die_walk_lines() can have two different type of DIEs, subprogram (or
    inlined-subroutine) DIE and CU DIE.

    If a caller passes a subprogram DIE, this means that the walker walk on
    lines of given subprogram. In this case, it just needs to search on
    direct children of DIE tree for finding call-site information of inlined
    function which directly called from given subprogram.

    On the other hand, if a caller passes a CU DIE to the walker, this means
    that the walker have to walk on all lines in the source files included
    in given CU DIE. In this case, it has to search whole DIE trees of all
    subprograms to find the call-site information of all nested inlined
    functions.

    Without this patch:

    $ perf probe --line kernel/cpu.c:151-157

    static int cpu_notify(unsigned long val, void *v)
    {
    154 return __cpu_notify(val, v, -1, NULL);
    }

    With this:
    $ perf probe --line kernel/cpu.c:151-157

    152 static int cpu_notify(unsigned long val, void *v)
    {
    154 return __cpu_notify(val, v, -1, NULL);
    }

    As you can see, --line option with source line range shows the declared
    lines as probe-able.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: yrl.pp-manager.tt@hitachi.com
    Link: http://lkml.kernel.org/r/20110811110241.19900.34994.stgit@fedora15
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Fix line walker to check whether a given DIE is CU or not.

    Actually this function accepts CU, subprogram and inlined_subroutine
    DIEs.

    Without this fix, perf probe always fails to analyze lines on inlined
    functions;

    $ perf probe -L pre_schedule
    Debuginfo analysis failed. (-2)
    Error: Failed to show lines. (-2)

    This fixes that bug, as below.

    $ perf probe -L pre_schedule

    0 static inline void pre_schedule(struct rq *rq, struct task_struct *prev
    {
    2 if (prev->sched_class->pre_schedule)
    3 prev->sched_class->pre_schedule(rq, prev);
    }

    /* rq->lock is NOT held, but preemption is disabled */

    Changes from v1:
    - Update against current tip tree.(Fix dwarf-aux.c)

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Masami Hiramatsu
    Cc: Paul Mackerras
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: yrl.pp-manager.tt@hitachi.com
    Link: http://lkml.kernel.org/r/20110811110235.19900.20614.stgit@fedora15
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

16 Jul, 2011

1 commit

  • Move dwarf library related routines to dwarf-aux.{c,h}.
    This includes several minor changes.
    - Add simple documents for each API.
    - Rename die_find_real_subprogram() to die_find_realfunc()
    - Rename line_walk_handler_t to line_walk_callback_t.
    - Minor cleanups.

    Signed-off-by: Masami Hiramatsu
    Cc: Peter Zijlstra
    Cc: Frederic Weisbecker
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: Arnaldo Carvalho de Melo
    Link: http://lkml.kernel.org/r/20110627072727.6528.57647.stgit@fedora15
    Signed-off-by: Steven Rostedt

    Masami Hiramatsu