• Masami Hiramatsu's avatar
    perf probe: Fix to show calling lines of inlined functions · 86c0bf85
    Masami Hiramatsu authored
    Fix to show calling lines of inlined functions (where an inline function
    is called).
    
    die_walk_lines() filtered out the lines inside inlined functions based
    on the address. However this also filtered out the lines which call
    those inlined functions from the target function.
    
    To solve this issue, check the call_file and call_line attributes and do
    not filter out if it matches to the line information.
    
    Without this fix, perf probe -L doesn't show some lines correctly.
    (don't see the lines after 17)
    
      # perf probe -L vfs_read
      <vfs_read@/home/mhiramat/ksrc/linux/fs/read_write.c:0>
            0  ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
            1  {
            2         ssize_t ret;
    
            4         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) {
           13                 if (count > MAX_RW_COUNT)
                                      count =  MAX_RW_COUNT;
           15                 ret = __vfs_read(file, buf, count, pos);
           16                 if (ret > 0) {
                                      fsnotify_access(file);
                                      add_rchar(current, ret);
                              }
    
    With this fix:
    
      # perf probe -L vfs_read
      <vfs_read@/home/mhiramat/ksrc/linux/fs/read_write.c:0>
            0  ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
            1  {
            2         ssize_t ret;
    
            4         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) {
           13                 if (count > MAX_RW_COUNT)
                                      count =  MAX_RW_COUNT;
           15                 ret = __vfs_read(file, buf, count, pos);
           16                 if (ret > 0) {
           17                         fsnotify_access(file);
           18                         add_rchar(current, ret);
                              }
           20                 inc_syscr(current);
                      }
    
    Fixes: 4cc9cec6 ("perf probe: Introduce lines walker interface")
    Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Link: http://lore.kernel.org/lkml/157241937995.32002.17899884017011512577.stgit@devnote2Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    86c0bf85
dwarf-aux.c 33.7 KB