lkml.org 
[lkml]   [2019]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] fgraph: record function return value
    On Sat, 12 Jan 2019 14:57:01 +0800
    Changbin Du <changbin.du@gmail.com> wrote:

    > This patch adds a new trace option 'funcgraph-retval' and is disabled by
    > default. When this option is enabled, fgraph tracer will show the return
    > value of each function. This is useful to find/analyze a original error
    > source in a call graph.
    >
    > One limitation is that kernel doesn't know the prototype of functions. So
    > fgraph assumes all functions have a retvalue of type int. You must ignore
    > the value of *void* function. And if the retvalue looks like an error code
    > then both hexadecimal and decimal number are displayed.
    >
    > In this patch, only x86 and ARM platforms are supported.
    >
    > Here is example showing the error is caused by vmx_create_vcpu() and the
    > error code is -5 (-EIO).
    >
    > with echo 1 > /sys/kernel/debug/tracing/options/funcgraph-retval
    >
    > 3) | kvm_vm_ioctl() {
    > 3) | mutex_lock() {
    > 3) | _cond_resched() {
    > 3) 0.234 us | rcu_all_qs(); /* ret=0x80000000 */
    > 3) 0.704 us | } /* ret=0x0 */
    > 3) 1.226 us | } /* ret=0x0 */
    > 3) 0.247 us | mutex_unlock(); /* ret=0xffff8880738ed040 */
    > 3) | kvm_arch_vcpu_create() {
    > 3) | vmx_create_vcpu() {
    > 3) + 17.969 us | kmem_cache_alloc(); /* ret=0xffff88813a980040 */
    > 3) + 15.948 us | kmem_cache_alloc(); /* ret=0xffff88813aa99200 */
    > 3) 0.653 us | allocate_vpid.part.88(); /* ret=0x1 */
    > 3) 6.964 us | kvm_vcpu_init(); /* ret=0xfffffffb */
    > 3) 0.323 us | free_vpid.part.89(); /* ret=0x1 */
    > 3) 9.985 us | kmem_cache_free(); /* ret=0x80000000 */
    > 3) 9.491 us | kmem_cache_free(); /* ret=0x80000000 */
    > 3) + 69.858 us | } /* ret=0xfffffffffffffffb/-5 */
    > 3) + 70.631 us | } /* ret=0xfffffffffffffffb/-5 */
    > 3) | mutex_lock() {
    > 3) | _cond_resched() {
    > 3) 0.199 us | rcu_all_qs(); /* ret=0x80000000 */
    > 3) 0.594 us | } /* ret=0x0 */
    > 3) 1.067 us | } /* ret=0x0 */
    > 3) 0.337 us | mutex_unlock(); /* ret=0xffff8880738ed040 */
    > 3) + 92.730 us | } /* ret=0xfffffffffffffffb/-5 */
    >
    > Signed-off-by: Changbin Du <changbin.du@gmail.com>
    > ---
    >

    Hi Changbin,

    I'm rewriting a lot of the function graph tracer code to have
    kretprobes be able to work on top of it. It's still a work in progress.
    It would be easier to add something to that work when its done than to
    do it now.

    Thanks!

    -- Steve

    \
     
     \ /
      Last update: 2019-01-14 17:23    [W:3.048 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site