Bug 2666 - List active probes
Summary: List active probes
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: kprobes (show other bugs)
Version: unspecified
: P3 enhancement
Target Milestone: ---
Assignee: Srinivasa DS
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-16 16:56 UTC by Jim Keniston
Modified: 2007-02-21 08:34 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Patch to list active probes in the system. (1.66 KB, patch)
2007-01-15 10:38 UTC, Srinivasa DS
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Keniston 2006-05-16 16:56:27 UTC
It has been requested that we provide the ability to list all probes that are
currently active in the system.  This could presumably be done either via /proc
or by adding a function to the kprobes API.

If we did it via /proc, the listing might look something like this:
k  c0151ece do_pipe+0x177/0x1d1
r  c01105f6 do_fork
j  c01105f6 do_fork

This would indicate that there's a kprobe somewhere in do_pipe, and a return
probe and a jprobe on do_fork.

Should we include the handlers' addresses?

Presumably, such a function would iterate through the kprobe_table[] and spit
out the probes in whatever order it finds them.  Don't forget about aggregate
probes.  A jprobe is a kprobe with a break_handler.  A kretprobe is a kprobe
with pre_handler=pre_handler_kretprobe.

The implementation should take into account the possibility of user-space
probes, user-space return probes, and watchpoint probes (kernel & user).
Comment 1 Srinivasa DS 2007-01-15 10:38:58 UTC
Created attachment 1494 [details]
Patch to list active probes in the system.

Jim
  I have developed a patch, that lists all active probes on the system through
the proc interface.  Somehow I couldn't able to send this patch to lkml last
time. I did some minor changes to the patch to suit 2.6.20 kernel. 

Output looks like this
======================
[root@llm31 a]# cat /proc/kprobes/list
c0000000000c0720  r  .sys_write+0x0
c0000000000c0720  k  .sys_write+0x0
c00000000004c550  k  .do_fork+0x0
c00000000004c550  k  .do_fork+0x0
c00000000004c550  j  .do_fork+0x0
c0000000000bfed4  r  .vfs_read+0x0
c0000000000bddb4  r  .sys_open+0x0
c0000000000c0694  r  .sys_read+0x0
c0000000000c0694  k  .sys_read+0x0
c00000000004c554  k  .do_fork+0x4
d0000000000781b0  k  .autofs4_dentry_release+0x0  autofs4
c0000000000275d0  k  kretprobe_trampoline+0x0
c0000000000bfd18  k  .vfs_write+0x0
====================================
  So please review my patch and let me know your suggestions,so that I
incorporate those changes in my patch.

  Thanks
    Srinivasa DS
Comment 2 James Dickens 2007-01-16 01:22:43 UTC
Subject: Re:  List active probes

On 15 Jan 2007 10:38:58 -0000, srinivasa at in dot ibm dot com
<sourceware-bugzilla@sourceware.org> wrote:
>
> ------- Additional Comments From srinivasa at in dot ibm dot com  2007-01-15 10:38 -------
> Created an attachment (id=1494)
>  --> (http://sourceware.org/bugzilla/attachment.cgi?id=1494&action=view)
> Patch to list active probes in the system.
>
> Jim
>   I have developed a patch, that lists all active probes on the system through
> the proc interface.  Somehow I couldn't able to send this patch to lkml last
> time. I did some minor changes to the patch to suit 2.6.20 kernel.
>
> Output looks like this
> ======================
> [root@llm31 a]# cat /proc/kprobes/list
> c0000000000c0720  r  .sys_write+0x0
> c0000000000c0720  k  .sys_write+0x0
> c00000000004c550  k  .do_fork+0x0
> c00000000004c550  k  .do_fork+0x0
> c00000000004c550  j  .do_fork+0x0
> c0000000000bfed4  r  .vfs_read+0x0
> c0000000000bddb4  r  .sys_open+0x0
> c0000000000c0694  r  .sys_read+0x0
> c0000000000c0694  k  .sys_read+0x0
> c00000000004c554  k  .do_fork+0x4
> d0000000000781b0  k  .autofs4_dentry_release+0x0  autofs4
> c0000000000275d0  k  kretprobe_trampoline+0x0
> c0000000000bfd18  k  .vfs_write+0x0
> ====================================
>   So please review my patch and let me know your suggestions,so that I
> incorporate those changes in my patch.
>
any idea how the system will respond when there are 40,000 active
probes or more?

James Dickens
uadmin.blogspot.com



>   Thanks
>     Srinivasa DS
>
>
> --
>
>
> http://sourceware.org/bugzilla/show_bug.cgi?id=2666
>
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>
Comment 3 Srinivasa DS 2007-01-16 13:09:19 UTC
(In reply to comment #2)
> any idea how the system will respond when there are 40,000 active
> probes or more?
> 
> James Dickens
> uadmin.blogspot.com
> 
> 
 Eventhough I haven't tested the patch for 40,000 active probes,  size of 
/proc/kprobes/list file depends on available memory and maximum  size of the
proc file.
Comment 4 James Dickens 2007-01-16 15:55:37 UTC
Subject: Re:  List active probes

On 16 Jan 2007 13:09:20 -0000, srinivasa at in dot ibm dot com
<sourceware-bugzilla@sourceware.org> wrote:
>
> ------- Additional Comments From srinivasa at in dot ibm dot com  2007-01-16 13:09 -------
> (In reply to comment #2)
> > any idea how the system will respond when there are 40,000 active
> > probes or more?
> >
> > James Dickens
> > uadmin.blogspot.com
> >
> >
>  Eventhough I haven't tested the patch for 40,000 active probes,  size of
> /proc/kprobes/list file depends on available memory and maximum  size of the
> proc file.
>
i was thinking about the time spent in
+	preempt_disable();
+	hlist_for_each_entry_rcu(p, node, head, hlist) {
+		sym = kallsyms_lookup((unsigned long)p->addr, &size,
+					&offset, &modname, namebuf);
+		if (p->pre_handler == aggr_pre_handler) {
+			list_for_each_entry_rcu(kp, &p->list, list)
+				report_probe(pi, kp, sym, offset, modname);
+		} else
+			report_probe(pi, p, sym, offset, modname);
+	}
+	preempt_enable();

with preemption disabled... it could a second or more, if many probes
are enabled, it could have a negative effect on a production server.

James


> --
>
>
> http://sourceware.org/bugzilla/show_bug.cgi?id=2666
>
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>
Comment 5 Srinivasa DS 2007-02-16 05:57:02 UTC
I have proposed the patch in lkml. We can expect it in next mm-release.
http://www.mail-archive.com/mm-commits@vger.kernel.org/msg08312.html

Thanks
 Srinivasa DS
Comment 6 Ananth Mavinakayanahalli 2007-02-21 08:34:21 UTC
This feature is now accepted upstream as of:

http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=346fd59bab28093276be102632f72691a2c243fe

Closing bug... Thanks Srinivasa for the work on this one.