Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234224 > unrolled thread

[perf probe] How to ask what variables can be collected at function return?

Started byArnaldo Carvalho de Melo <acme@kernel.org>
First post2015-09-28 17:00 +0200
Last post2015-09-30 18:50 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [perf probe] How to ask what variables can be collected at function  return? Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-28 17:00 +0200
    RE: [perf probe] How to ask what variables can be collected at  function return? 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-30 10:10 +0200
      Re: [perf probe] How to ask what variables can be collected at  function return? Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-30 15:20 +0200
        RE: [perf probe] How to ask what variables can be collected at  function return? 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-30 18:50 +0200

#1234224 — [perf probe] How to ask what variables can be collected at function return?

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-28 17:00 +0200
Subject[perf probe] How to ask what variables can be collected at function return?
Message-ID<qdI4i-2z9-1@gated-at.bofh.it>
How to figure out which variables can I collect at function return?
None?

I think we need a better error message :-)

[root@zoo ~]# perf probe -V getname_flags%return
Return probe must be on the head of a real function.
Debuginfo analysis failed.
  Error: Failed to show vars.
[root@zoo ~]# 


- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1235870 — RE: [perf probe] How to ask what variables can be collected at function return?

From平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com>
Date2015-09-30 10:10 +0200
SubjectRE: [perf probe] How to ask what variables can be collected at function return?
Message-ID<qekCD-7xs-23@gated-at.bofh.it>
In reply to#1234224
From: Arnaldo Carvalho de Melo [mailto:acme@kernel.org]
>
>How to figure out which variables can I collect at function return?
>None?

At first, it seems the below pattern failed to get the probe point itself,
because you're specifying the return point of an inlined function, which
is nowhere.

If you give a function which has actual instance, perf-probe may show
the variables which will be accessable in the entry of the function as below.

$ sudo ./perf probe -V "vfs_read%return"
Available variables at vfs_read%return
        @<vfs_read+0>
                char*   buf
                loff_t* pos
                size_t  count
                struct file*    file

However, this may not work on the arguments passed by registers,
since those may be already broken by the operations in the function.

So, to get correct accessible variables at return, you must give an actual
line number in the function currently.

$ sudo ./perf probe -L vfs_read
<vfs_read@/home/mhiramat/ksrc/linux-3/fs/read_write.c:0>
      0  ssize_t vfs_read(struct file *file, char __user *buf, size_t count, lof
      1  {
                ssize_t ret;

      4         if (!(file->f_mode & FMODE_READ))
      5                 return -EBADF;
      6         if (!(file->f_mode & FMODE_CAN_READ))
      7                 return -EINVAL;
      8         if (unlikely(!access_ok(VERIFY_WRITE, buf, count)))
      9                 return -EFAULT;

     11         ret = rw_verify_area(READ, file, pos, count);
     12         if (ret >= 0) {
                        count = ret;
     14                 ret = __vfs_read(file, buf, count, pos);
     15                 if (ret > 0) {
     16                         fsnotify_access(file);
     17                         add_rchar(current, ret);
                        }
     19                 inc_syscr(current);
                }

                return ret;
     23  }

$ sudo ./perf probe -V vfs_read:23
Available variables at vfs_read:23
        @<vfs_read+214>
                char*   buf
                loff_t* pos
                size_t  count
                struct file*    file


>
>I think we need a better error message :-)
>
>[root@zoo ~]# perf probe -V getname_flags%return Return probe must be on the head of a real function.

It seems that perf probe said " Return probe must be on the head of a real function."
So this means it can not find the given probe point because the %return is not 
put on the entry of the function which has actual instance.

Thanks.


>Debuginfo analysis failed.
>  Error: Failed to show vars.
>[root@zoo ~]#
>
>
>- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1236279 — Re: [perf probe] How to ask what variables can be collected at function return?

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-30 15:20 +0200
SubjectRe: [perf probe] How to ask what variables can be collected at function return?
Message-ID<qepsC-63w-19@gated-at.bofh.it>
In reply to#1235870
Em Wed, Sep 30, 2015 at 08:05:09AM +0000, 平松雅巳 / HIRAMATU,MASAMI escreveu:
> From: Arnaldo Carvalho de Melo [mailto:acme@kernel.org]
> >
> >How to figure out which variables can I collect at function return?
> >None?
> 
> At first, it seems the below pattern failed to get the probe point itself,
> because you're specifying the return point of an inlined function, which
> is nowhere.

Would be really nice to have this warning emitted to the user, as well
as bits and pieces of the following explanations.

- Arnaldo
 
> If you give a function which has actual instance, perf-probe may show
> the variables which will be accessable in the entry of the function as below.
> 
> $ sudo ./perf probe -V "vfs_read%return"
> Available variables at vfs_read%return
>         @<vfs_read+0>
>                 char*   buf
>                 loff_t* pos
>                 size_t  count
>                 struct file*    file
> 
> However, this may not work on the arguments passed by registers,
> since those may be already broken by the operations in the function.
> 
> So, to get correct accessible variables at return, you must give an actual
> line number in the function currently.
> 
> $ sudo ./perf probe -L vfs_read
> <vfs_read@/home/mhiramat/ksrc/linux-3/fs/read_write.c:0>
>       0  ssize_t vfs_read(struct file *file, char __user *buf, size_t count, lof
>       1  {
>                 ssize_t ret;
> 
>       4         if (!(file->f_mode & FMODE_READ))
>       5                 return -EBADF;
>       6         if (!(file->f_mode & FMODE_CAN_READ))
>       7                 return -EINVAL;
>       8         if (unlikely(!access_ok(VERIFY_WRITE, buf, count)))
>       9                 return -EFAULT;
> 
>      11         ret = rw_verify_area(READ, file, pos, count);
>      12         if (ret >= 0) {
>                         count = ret;
>      14                 ret = __vfs_read(file, buf, count, pos);
>      15                 if (ret > 0) {
>      16                         fsnotify_access(file);
>      17                         add_rchar(current, ret);
>                         }
>      19                 inc_syscr(current);
>                 }
> 
>                 return ret;
>      23  }
> 
> $ sudo ./perf probe -V vfs_read:23
> Available variables at vfs_read:23
>         @<vfs_read+214>
>                 char*   buf
>                 loff_t* pos
>                 size_t  count
>                 struct file*    file
> 
> 
> >
> >I think we need a better error message :-)
> >
> >[root@zoo ~]# perf probe -V getname_flags%return Return probe must be on the head of a real function.
> 
> It seems that perf probe said " Return probe must be on the head of a real function."
> So this means it can not find the given probe point because the %return is not 
> put on the entry of the function which has actual instance.
> 
> Thanks.
> 
> 
> >Debuginfo analysis failed.
> >  Error: Failed to show vars.
> >[root@zoo ~]#
> >
> >
> >- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1236540 — RE: [perf probe] How to ask what variables can be collected at function return?

From平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com>
Date2015-09-30 18:50 +0200
SubjectRE: [perf probe] How to ask what variables can be collected at function return?
Message-ID<qesJR-2eW-41@gated-at.bofh.it>
In reply to#1236279
RnJvbTogQXJuYWxkbyBDYXJ2YWxobyBkZSBNZWxvIFttYWlsdG86YWNtZUBrZXJuZWwub3JnXQ0K
Pg0KPkVtIFdlZCwgU2VwIDMwLCAyMDE1IGF0IDA4OjA1OjA5QU0gKzAwMDAsIOW5s+advumbheW3
syAvIEhJUkFNQVRV77yMTUFTQU1JIGVzY3JldmV1Og0KPj4gRnJvbTogQXJuYWxkbyBDYXJ2YWxo
byBkZSBNZWxvIFttYWlsdG86YWNtZUBrZXJuZWwub3JnXQ0KPj4gPg0KPj4gPkhvdyB0byBmaWd1
cmUgb3V0IHdoaWNoIHZhcmlhYmxlcyBjYW4gSSBjb2xsZWN0IGF0IGZ1bmN0aW9uIHJldHVybj8N
Cj4+ID5Ob25lPw0KPj4NCj4+IEF0IGZpcnN0LCBpdCBzZWVtcyB0aGUgYmVsb3cgcGF0dGVybiBm
YWlsZWQgdG8gZ2V0IHRoZSBwcm9iZSBwb2ludA0KPj4gaXRzZWxmLCBiZWNhdXNlIHlvdSdyZSBz
cGVjaWZ5aW5nIHRoZSByZXR1cm4gcG9pbnQgb2YgYW4gaW5saW5lZA0KPj4gZnVuY3Rpb24sIHdo
aWNoIGlzIG5vd2hlcmUuDQo+DQo+V291bGQgYmUgcmVhbGx5IG5pY2UgdG8gaGF2ZSB0aGlzIHdh
cm5pbmcgZW1pdHRlZCB0byB0aGUgdXNlciwgYXMgd2VsbCBhcyBiaXRzIGFuZCBwaWVjZXMgb2Yg
dGhlIGZvbGxvd2luZyBleHBsYW5hdGlvbnMuDQoNCk9LLCBJJ2xsIGluY2x1ZGUgdGhpcyB0byB0
aGUgb3RoZXIgYnVnZml4ZXMuDQoNClRoYW5rcyENCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web