• Masami Hiramatsu's avatar
    perf probe: Fall back to debuginfod query if debuginfo and source not found locally · 7cd5738d
    Masami Hiramatsu authored
    Since 'perf probe' heavily depends on debuginfo, debuginfod gives us
    many benefits on the 'perf probe' command on remote machine.
    
    Especially, this will be helpful for the embedded devices which will not
    have enough storage, or boot with a cross-build kernel whose source code
    is in the host machine.
    
    This will work as similar to commit c7a14fdc ("perf build-ids:
    Fall back to debuginfod query if debuginfo not found")
    
    Tested with:
    
      (host) $ cd PATH/TO/KBUILD/DIR/
      (host) $ debuginfod -F .
      ...
    
      (remote) # perf probe -L vfs_read
      Failed to find the path for the kernel: No such file or directory
        Error: Failed to show lines.
    
      (remote) # export DEBUGINFOD_URLS="http://$HOST_IP:8002/"
      (remote) # perf probe -L vfs_read
      <vfs_read@...>
            0  ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
               {
            2         ssize_t ret;
    
                      if (!(file->f_mode & FMODE_READ))
                              return -EBADF;
            6         if (!(file->f_mode & FMODE_CAN_READ))
                              return -EINVAL;
            8         if (unlikely(!access_ok(buf, count)))
                              return -EFAULT;
    
           11         ret = rw_verify_area(READ, file, pos, count);
           12         if (ret)
                              return ret;
                      if (count > MAX_RW_COUNT)
      ...
    
      (remote) # perf probe -a "vfs_read count"
      Added new event:
        probe:vfs_read       (on vfs_read with count)
    
      (remote) # perf probe -l
        probe:vfs_read       (on vfs_read@ksrc/linux/fs/read_write.c with count)
    Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Reviewed-by: default avatarFrank Ch. Eigler <fche@redhat.com>
    Cc: Aaron Merey <amerey@redhat.com>
    Cc: Daniel Thompson <daniel.thompson@linaro.org>
    Link: http://lore.kernel.org/lkml/160041610083.912668.13659563860278615846.stgit@devnote2Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    7cd5738d
probe-event.c 83.4 KB