linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [perf probe] How to ask what variables can be collected at function return?
@ 2015-09-28 14:52 Arnaldo Carvalho de Melo
  2015-09-30  8:05 ` 平松雅巳 / HIRAMATU,MASAMI
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-28 14:52 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: David Ahern, Jiri Olsa, Wang Nan, Linux Kernel Mailing List

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [perf probe] How to ask what variables can be collected at function return?
  2015-09-28 14:52 [perf probe] How to ask what variables can be collected at function return? Arnaldo Carvalho de Melo
@ 2015-09-30  8:05 ` 平松雅巳 / HIRAMATU,MASAMI
  2015-09-30 13:18   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: 平松雅巳 / HIRAMATU,MASAMI @ 2015-09-30  8:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: David Ahern, Jiri Olsa, Wang Nan, Linux Kernel Mailing List

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [perf probe] How to ask what variables can be collected at function return?
  2015-09-30  8:05 ` 平松雅巳 / HIRAMATU,MASAMI
@ 2015-09-30 13:18   ` Arnaldo Carvalho de Melo
  2015-09-30 16:48     ` 平松雅巳 / HIRAMATU,MASAMI
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-30 13:18 UTC (permalink / raw)
  To: 平松雅巳 / HIRAMATU,MASAMI
  Cc: David Ahern, Jiri Olsa, Wang Nan, Linux Kernel Mailing List

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [perf probe] How to ask what variables can be collected at function return?
  2015-09-30 13:18   ` Arnaldo Carvalho de Melo
@ 2015-09-30 16:48     ` 平松雅巳 / HIRAMATU,MASAMI
  0 siblings, 0 replies; 4+ messages in thread
From: 平松雅巳 / HIRAMATU,MASAMI @ 2015-09-30 16:48 UTC (permalink / raw)
  To: 'Arnaldo Carvalho de Melo'
  Cc: David Ahern, Jiri Olsa, Wang Nan, Linux Kernel Mailing List

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 802 bytes --]

From: Arnaldo Carvalho de Melo [mailto:acme@kernel.org]
>
>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.

OK, I'll include this to the other bugfixes.

Thanks!

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-30 16:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-28 14:52 [perf probe] How to ask what variables can be collected at function return? Arnaldo Carvalho de Melo
2015-09-30  8:05 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-30 13:18   ` Arnaldo Carvalho de Melo
2015-09-30 16:48     ` 平松雅巳 / HIRAMATU,MASAMI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).