summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2012-05-24 13:37:38 -0400
committerSteve Dickson <steved@redhat.com>2012-05-24 13:37:38 -0400
commitc70763075b9d1086ec40771bc800db09152a6994 (patch)
tree17382e2567a50208857d129de2fde99c1b12cacc
parent1ef389bb195f94d44ed5a1113fef4c6f80490d25 (diff)
parent1be52c0b9f8ade90aaa5d955ae655d5d9d8d8461 (diff)
downloadsystemtap-c70763075b9d1086ec40771bc800db09152a6994.tar.gz
systemtap-c70763075b9d1086ec40771bc800db09152a6994.tar.xz
systemtap-c70763075b9d1086ec40771bc800db09152a6994.zip
Merge branch 'master' of ssh://fedorapeople.org/~steved/systemtap
-rw-r--r--net/tcp_connect.stp12
-rw-r--r--nfs/nfs_idmap.stp86
-rw-r--r--nfs/nfs_lookup.stp24
-rw-r--r--nfs/nfs_mount.stp59
-rw-r--r--nfs/nfs_readdir.stp11
-rw-r--r--nfs/nfs_xdr.stp39
-rw-r--r--sunrpc/call_status.stp87
-rw-r--r--sunrpc/rpc_rtt.stp10
-rw-r--r--sunrpc/sunrpc.stp40
-rw-r--r--sunrpc/xprt.stp61
-rw-r--r--sunrpc/xprt_copy.stp17
-rw-r--r--tapset/fs.stp14
-rw-r--r--tapset/iserr.stp11
-rw-r--r--tapset/key.stp12
-rw-r--r--tapset/rpc_clnt.stp42
-rw-r--r--tapset/sunrpc_task.stp63
-rw-r--r--tapset/task.stp123
-rwxr-xr-xtop-nfscalls.stp4
-rwxr-xr-xtop-xprtcalls.stp20
-rw-r--r--tracepoints/rpc_sched_events.stp32
20 files changed, 631 insertions, 136 deletions
diff --git a/net/tcp_connect.stp b/net/tcp_connect.stp
index 4763bb5..8364b14 100644
--- a/net/tcp_connect.stp
+++ b/net/tcp_connect.stp
@@ -1,7 +1,19 @@
+/*
probe kernel.function("tcp_v4_connect").return {
if (isinstr(execname(), "rpc.nfsd"))
printf("%s: tcp_v4_connect: return %d (%s)\n",
$return, errno_str($return));
}
+*/
+probe kernel.function("tcp_sendmsg").return {
+ if ($return < 0 && $return != -11)
+ printf("%s(%d): __sock_sendmsg: sock %p return %d (%s)\n",
+ execname(), pid(), $sock, $return, errno_str($return));
+}
+probe kernel.function("sk_stream_wait_connect").return {
+ if ($return < 0 && $return != -11)
+ printf("%s(%d): sk_stream_wait_connect: sk %p return %d (%s)\n",
+ execname(), pid(), $sk, $return, errno_str($return));
+}
probe begin { log("starting tcp_v4_connect probe") }
probe end { log("tcp_v4_connect inet_bind probe") }
diff --git a/nfs/nfs_idmap.stp b/nfs/nfs_idmap.stp
new file mode 100644
index 0000000..5591f13
--- /dev/null
+++ b/nfs/nfs_idmap.stp
@@ -0,0 +1,86 @@
+probe module("nfs").function("nfs_map_name_to_uid").return
+{
+ if ($return < 0)
+ printf("nfs_map_name_to_uid: '%s' --> %d(%s)\n", kernel_string($name),
+ $return, errno_str($return));
+ else
+ printf("nfs_map_name_to_uid: '%s' --> %d\n", kernel_string($name), $return);
+}
+probe module("nfs").function("nfs_idmap_request_key").return
+{
+ if ($return < 0)
+ printf(" nfs_idmap_request_key: %d(%s)\n", $return, errno_str($return));
+ else
+ printf(" nfs_idmap_request_key: %d\n", $return);
+}
+probe kernel.function("call_sbin_request_key").return
+{
+ if ($return < 0)
+ printf(" call_sbin_request_key: %d(%s)\n", $return, errno_str($return));
+ else
+ printf(" call_sbin_request_key: %d\n", $return);
+}
+probe kernel.function("call_usermodehelper_exec").return
+{
+ if ($return < 0)
+ printf(" call_usermodehelper_exec: %d(%s)\n", $return, errno_str($return));
+ else
+ printf(" call_usermodehelper_exec: %d\n", $return);
+}
+probe kernel.function("call_usermodehelper_setup").return
+{
+ if (is_err($return))
+ printf(" call_usermodehelper_setup: path %s %ld(%s)\n",
+ kernel_string($path), $return, errno_str($return));
+ else
+ printf(" call_usermodehelper_setup: path %s\n argv %s %s %s %s %s %s %s %s\n",
+ kernel_string($path), kernel_string($argv[0]), kernel_string($argv[1]),
+ kernel_string($argv[2]), kernel_string($argv[3]), kernel_string($argv[4]),
+ kernel_string($argv[5]), kernel_string($argv[6]), kernel_string($argv[7]));
+}
+probe kernel.function("request_key_and_link")
+{
+ printf(" request_key_and_link: type %s desc %s callout %p(%d)\n",
+ key_type($type), kernel_string($description), $callout_info, $callout_len);
+}
+probe kernel.function("request_key_and_link").return
+{
+ if (is_err($return))
+ printf(" request_key_and_link: desc %s %ld(%s)\n",
+ kernel_string($description), $return, errno_str($return));
+ else
+ printf(" request_key_and_link: desc %s %p\n",
+ kernel_string($description), $return);
+}
+/*
+probe kernel.function("key_user_lookup").return
+{
+ if (is_err($return))
+ printf(" key_user_lookup: uid %d %ld(%s)\n",
+ $uid, $return, errno_str($return));
+ else
+ printf(" key_user_lookup: uid %d %p\n",
+ $uid, $return);
+}
+probe kernel.function("search_process_keyrings").return
+{
+ if (is_err($return))
+ printf(" search_process_keyrings: %ld (%s)\n", $return, errno_str($return));
+ else
+ printf(" search_process_keyrings: %p\n", $return);
+}
+probe kernel.function("search_my_process_keyrings").return
+{
+ if (is_err($return))
+ printf(" search_my_process_keyrings: %ld(%s)\n", $return, errno_str($return));
+ else
+ printf(" search_my_process_keyrings: %p\n", $return);
+}
+probe module("nfs").function("nfs_idmap_get_desc").return
+{
+ printf(" nfs_idmap_get_desc: %d\n", $return);
+}
+*/
+probe begin { log("starting nfsidmap probe") }
+probe end { log("ending nfsidmap probe") }
+
diff --git a/nfs/nfs_lookup.stp b/nfs/nfs_lookup.stp
new file mode 100644
index 0000000..04409ad
--- /dev/null
+++ b/nfs/nfs_lookup.stp
@@ -0,0 +1,24 @@
+/*
+probe module("nfs").function("nfs_lookup_revalidate").return
+{
+ if ($return != 0)
+ printf("nfs_lookup_revalidate: %s\n", errno_str($return));
+}
+*/
+probe module("nfs").function("nfs_proc_lookup").return
+{
+ printf("nfs_proc_lookup: %s\n", errno_str($return));
+}
+probe module("nfs").function("nfs_refresh_inode").return
+{
+ if ($return != 0)
+ printf("nfs_refresh_inode: %s\n", errno_str($return));
+}
+probe module("nfs").function("nfs_is_exclusive_create").return
+{
+ if ($return != 0)
+ printf("nfs_is_exclusive_create: %s\n", errno_str($return));
+}
+probe begin { log("starting probe") }
+probe end { log("ending probe") }
+
diff --git a/nfs/nfs_mount.stp b/nfs/nfs_mount.stp
index 940497a..6d6c37c 100644
--- a/nfs/nfs_mount.stp
+++ b/nfs/nfs_mount.stp
@@ -1,14 +1,61 @@
+probe kernel.function("do_add_mount_unlocked")
+{
+ printf("do_add_mount_unlocked: mnt_sb %p %s\n", $newmnt->mnt_sb, pathdump($path));
+}
+probe kernel.function("do_add_mount_unlocked").return
+{
+ if ($return < 0)
+ printf("do_add_mount_unlocked: ERROR %d (%s)\n", $return, errno_str($return));
+}
+probe kernel.function("do_new_mount").return
+{
+ if ($return < 0)
+ printf("do_new_mount: ERROR %d (%s)\n", $return, errno_str($return));
+}
+probe kernel.function("do_kern_mount").return
+{
+ if ($return < 0)
+ printf("do_kern_mount: ERROR %p (%s)\n", $return, errno_str($return));
+}
+probe kernel.function("security_sb_kern_mount").return
+{
+ if ($return < 0)
+ printf("security_sb_kern_mount: ERROR %d (%s)\n", $return, errno_str($return));
+}
+/*
+probe kernel.function("vfs_kern_mount")
+{
+ printf("vfs_kern_mount: type %p flags 0x%x name %s\n", $type, $flags, kernel_string($name));
+}
+probe kernel.function("vfs_kern_mount").return
+{
+ if ($return < 0)
+ printf("vfs_kern_mount: ERROR %p (%s)\n", $return, errno_str($return));
+}
+*/
probe module("nfs").function("nfs_get_sb")
{
- printf("nfs_mount: fs_name %s dev %s \n",
+ printf("nfs_get_sb: fs_name %s dev %s \n",
fs_name($fs_type), kernel_string($dev_name));
printf(" : flags=[%s]\n", nfs_mntflags($raw_data));
}
probe module("nfs").function("nfs_get_sb").return
{
- if ($return)
- printf("nfs_mount: ERROR %d (%s)\n", $return, errno_str($return));
+ if ($return < 0)
+ printf("nfs_get_sb: ERROR %d (%s)\n", $return, errno_str($return));
+}
+probe module("nfs").function("nfs4_get_sb")
+{
+ printf("nfs4_get_sb: fs_name %s dev %s \n",
+ fs_name($fs_type), kernel_string($dev_name));
+
+ printf(" : flags=[%s]\n", nfs_mntflags($raw_data));
+}
+probe module("nfs").function("nfs4_get_sb").return
+{
+ if ($return < 0)
+ printf("nfs4_get_sb: ERROR %d (%s)\n", $return, errno_str($return));
}
/*
probe module("nfs").function("nfs_validate_mount_data")
@@ -38,6 +85,10 @@ probe module("nfs").function("nfs_parse_devname").return
if ($return)
printf(" nfs_parse_devname: ERROR %d (%s)\n", $return, errno_str($return));
}
+probe module("nfs").function("nfs_compare_super").return
+{
+ printf(" nfs_compare_super: sp %p return %d\n", $sb, $return);
+}
/*
probe module("nfs").function("nfs_try_mount")
{
@@ -66,10 +117,10 @@ probe module("nfs").function("nfs_fill_super")
{
printf(" nfs_fill_super: sb %p data %p \n", $sb, $data);
}
-*/
probe module("nfs").function("nfs_initialise_sb")
{
printf(" nfs_initialise_sb: sb %p\n", $sb);
}
+*/
probe begin { log("starting nfs_mount probe") }
probe end { log("ending nfs_mount probe") }
diff --git a/nfs/nfs_readdir.stp b/nfs/nfs_readdir.stp
new file mode 100644
index 0000000..4d083dd
--- /dev/null
+++ b/nfs/nfs_readdir.stp
@@ -0,0 +1,11 @@
+probe module("nfs").function("*@fs/nfs/dir.c")
+{
+ printf("%s\n", probefunc());
+}
+probe module("nfs").function("*@fs/nfs/dir.c").return
+{
+ printf("%s: return\n", probefunc());
+}
+probe begin { log("starting probe") }
+probe end { log("ending probe") }
+
diff --git a/nfs/nfs_xdr.stp b/nfs/nfs_xdr.stp
new file mode 100644
index 0000000..3da97a4
--- /dev/null
+++ b/nfs/nfs_xdr.stp
@@ -0,0 +1,39 @@
+probe module("nfs").function("decode_opaque_fixed").return
+{
+ if ($return)
+ printf("decode_opaque_fixed return: %d\n", $return);
+}
+probe module("nfs").function("_nfs4_proc_readdir").return
+{
+ if ($return < 0)
+ printf("_nfs4_proc_readdir return: %d\n", $return);
+}
+probe module("nfs").function("decode_attr_type").return
+{
+ if ($return < 0)
+ printf("decode_attr_type return: %d\n", $return);
+}
+probe module("nfs").function("decode_attr_change").return
+{
+ if ($return < 0)
+ printf("decode_attr_change return: %d\n", $return);
+}
+probe module("nfs").function("decode_attr_size").return
+{
+ if ($return < 0)
+ printf("decode_attr_size return: %d\n", $return);
+}
+/*
+probe module("nfs").statement("*@fs/nfs/nfs4xdr.c:6507")
+{
+ log("hellow")
+}
+probe module("nfs").function("decode_readdir").return
+{
+ if ($return)
+ printf("decode_readdir return: %d\n", $return);
+}
+*/
+probe begin { log("starting nfs_xdr probe") }
+probe end { log("ending nfs_xdr probe") }
+
diff --git a/sunrpc/call_status.stp b/sunrpc/call_status.stp
index 56976cd..45119f5 100644
--- a/sunrpc/call_status.stp
+++ b/sunrpc/call_status.stp
@@ -1,32 +1,105 @@
/*
* stap -g -I../tapset call_status.stp
*/
+global transmit, ctask
+
+probe module("sunrpc").function("rpc_call_sync").return
+{
+ if ($return < 0 && $return != -11)
+ printf("rpc_call_sync: %s(%d): status %d\n", execname(), pid(), $return);
+}
+probe module("sunrpc").function("call_transmit_status")
+{
+ ctask = $task;
+}
+probe module("sunrpc").function("call_transmit_status").return
+{
+ terror = task_status(ctask);
+ if (terror && terror != -11)
+ printf("call_transmit_status:%s(%d):%s:%s: error %d (%s)\n",
+ execname(), pid(),
+ cl_server(ctask), cl_prog(ctask), terror, errno_str(terror));
+}
+probe module("sunrpc").function("rpcb_getport_async")
+{
+ ctask = $task;
+}
+probe module("sunrpc").function("rpcb_getport_async")
+{
+ terror = task_status(ctask);
+ /*
+ if (terror && terror != -11)
+ */
+ printf("rpcb_getport_async:%s:%s:error %d (%s)\n",
+ cl_server(ctask), cl_prog(ctask), terror, errno_str(terror));
+}
+probe module("sunrpc").function("call_bind")
+{
+ terror = task_status($task);
+ /*
+ if (terror && terror != -11)
+ */
+ printf("call_bind:%s(%d):%s:%s: task %p error %d (%s)\n",
+ execname(), pid(),
+ cl_server($task), cl_prog($task), $task, terror, errno_str(terror));
+}
+probe module("sunrpc").function("call_status")
+{
+ terror = task_status($task);
+ if (terror && terror != -11)
+ printf("call_status:%s(%d): %s:%s: task %p error %d (%s)\n",
+ execname(), pid(),
+ cl_server($task), cl_prog($task), $task, terror, errno_str(terror));
+}
+probe module("sunrpc").function("call_bind_status")
+{
+ terror = task_status($task);
+ if (terror && terror != -11)
+ printf("call_bind_status:%s(%d):%s:%s:error %d (%s)\n",
+ execname(), pid(),
+ cl_server($task), cl_prog($task), terror, errno_str(terror));
+}
probe module("sunrpc").function("call_connect_status")
{
terror = task_status($task);
- if (terror)
- printf("call_connect_status:%s:%s: error %d (%s)\n",
+ /*
+ if (terror && terror != -11)
+ */
+ printf("call_connect_status:%s(%d):%s:%s:error %d (%s)\n",
+ execname(), pid(),
cl_server($task), cl_prog($task), terror, errno_str(terror));
}
probe module("sunrpc").function("call_bind_status")
{
terror = task_status($task);
- if (terror)
- printf("call_bind_status:%s:%s: error %d (%s)\n",
+ if (terror && terror != -11)
+ printf("call_bind_status:%s(%d): %s:%s: error %d (%s)\n",
+ execname(), pid(),
cl_server($task), cl_prog($task), terror, errno_str(terror));
}
-probe module("sunrpc").function("call_connect_status")
+probe module("sunrpc").function("call_transmit")
{
+ transmit = $task;
terror = task_status($task);
- if (terror)
- printf("call_connect_status:%s:%s: error %d (%s)\n",
+ if (terror && terror != -11)
+ printf("call_transmit:%s(%d):%s:%s: error %d (%s)\n",
+ execname(), pid(),
cl_server($task), cl_prog($task), terror, errno_str(terror));
}
+probe module("sunrpc").function("call_transmit").return
+{
+ terror = task_status(transmit);
+ if (terror && terror != -11)
+ printf("call_transmit:%s:%s: error %d (%s)\n",
+ cl_server(transmit), cl_prog(transmit), terror, errno_str(terror));
+}
+/*
probe module("sunrpc").function("xs_tcp_finish_connecting").return
{
if ($return)
printf("xs_tcp_finish_connecting: error %d (%s)\n",
$return, errno_str($return));
}
+*/
probe begin { log("starting call_status probe") }
probe end { log("ending call_status probe") }
diff --git a/sunrpc/rpc_rtt.stp b/sunrpc/rpc_rtt.stp
new file mode 100644
index 0000000..df82c70
--- /dev/null
+++ b/sunrpc/rpc_rtt.stp
@@ -0,0 +1,10 @@
+
+probe module("sunrpc").function("rpc_release_task").return
+{
+ printf("rpc_release_task: %s: wsize %d rtt %ld\n", execname(),
+ $task->tk_status, rpc_rtt($task));
+}
+
+probe begin { log("starting rpc rtt probe") }
+probe end { log("ending rpc rtt probe") }
+
diff --git a/sunrpc/sunrpc.stp b/sunrpc/sunrpc.stp
index 689577c..d94076f 100644
--- a/sunrpc/sunrpc.stp
+++ b/sunrpc/sunrpc.stp
@@ -1,43 +1,3 @@
-%{
-#include <linux/sunrpc/sched.h>
-#include <linux/sunrpc/clnt.h>
-%}
-function rpcprocnum:long(_msg:long)
-%{
- struct rpc_message *msg = (struct rpc_message *)(long) kread(&(THIS->_msg));
- struct rpc_procinfo *rpc_proc =
- (struct rpc_procinfo *)(long) kread(&(msg->rpc_proc));
-
- THIS->__retvalue = rpc_proc->p_proc;
-
- CATCH_DEREF_FAULT();
-%}
-function rpcprocname:string(_msg:long)
-%{
- struct rpc_message *msg = (struct rpc_message *)(long) kread(&(THIS->_msg));
- struct rpc_procinfo *rpc_proc =
- (struct rpc_procinfo *)(long) kread(&(msg->rpc_proc));
- char *p_name = kread(&(rpc_proc->p_name));
- char buf[MAXSTRINGLEN];
-
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s(%d)",
- p_name ? p_name : "NULL" , rpc_proc->p_proc);
-
- CATCH_DEREF_FAULT();
-%}
-function rpcprogname:string(_clnt:long)
-%{
- struct rpc_clnt *clnt = (struct rpc_clnt *)(long) kread(&(THIS->_clnt));
- char *cl_server = kread(&(clnt->cl_server));
- char *cl_protname = kread(&(clnt->cl_protname));
- char buf[MAXSTRINGLEN];
-
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s:%s",
- cl_server ? cl_server : "NULL" ,
- cl_protname ? cl_protname : "NULL" );
-
- CATCH_DEREF_FAULT();
-%}
global syn_clnt, syn_msg, syn_flags
global asyn_clnt, asyn_msg, asyn_flags
global show_all
diff --git a/sunrpc/xprt.stp b/sunrpc/xprt.stp
index 34f8fe4..87630a3 100644
--- a/sunrpc/xprt.stp
+++ b/sunrpc/xprt.stp
@@ -1,11 +1,12 @@
-global xs_task, trans_task, udp_send_task
+global xs_task, trans_task, udp_send_task, sendpages_sock
+/*
probe module("sunrpc").function("xs_connect")
{
- printf("xs_connect: task %p\n", $task);
- xs_task = $task;
+ //printf("xs_connect: task %p\n", $task);
//print_backtrace();
}
+*/
/*
probe module("sunrpc").function("xs_tcp_connect")
{
@@ -16,21 +17,66 @@ probe module("sunrpc").function("xs_tcp_connect")
*/
probe module("sunrpc").function("xprt_connect_status")
{
- printf("xprt_connect_status: task %p\n", $task);
+ xs_task = $task;
}
probe module("sunrpc").function("xprt_connect_status").return
{
- printf("xprt_connect_status: %s", task_dump(xs_task));
+ tdump = task_dump(xs_task);
+ if (isinstr(tdump, "tk_status 0") != 1 && isinstr(tdump, "tk_status -11") != 1)
+ printf("xprt_connect_status: %s(%d): %s\n", execname(), pid(), tdump);
+}
+probe kernel.function("kernel_connect").return
+{
+ if ($return < 0 && $return != -11 && $return != -115)
+ printf("kernel_connect: %s(%d): status %d\n", execname(), pid(), $return);
}
probe module("sunrpc").function("xprt_transmit")
{
- printf("xprt_transmit: task %p\n", $task);
trans_task = $task;
}
probe module("sunrpc").function("xprt_transmit").return
{
- printf("xprt_transmit: %s", task_dump(trans_task));
+ if (task_status(trans_task) && task_status(trans_task) != -11)
+ printf("xprt_transmit: %s(%d): %s\n\t%s\n", execname(), pid(),
+ task_dump(trans_task), xprt_dump(trans_task));
+}
+probe module("sunrpc").function("xs_tcp_send_request").return
+{
+ if ($return < 0 && $return != -11)
+ printf("xs_tcp_send_request: %s(%d): status %d (%s)\n", execname(), pid(),
+ $return, errno_str($return));
+}
+probe module("sunrpc").function("xs_sendpages")
+{
+ sendpages_sock = $sock
+}
+probe module("sunrpc").function("xs_sendpages").return
+{
+ if ($return < 0 && $return != -11)
+ printf("xs_sendpages: %s(%d): sock %p status %d (%s)\n", execname(), pid(),
+ sendpages_sock, $return, errno_str($return));
+}
+probe module("sunrpc").function("xs_send_kvec").return
+{
+ if ($return < 0 && $return != -11)
+ printf("xs_send_kvec: %s(%d): status %d (%s)\n", execname(), pid(),
+ $return, errno_str($return));
+}
+/*
+probe module("sunrpc").function("xs_send_pagedata").return
+{
+ if ($return < 0)
+ printf("xs_send_pagedata: %s(%d): status %d (%s)\n", execname(), pid(),
+ $return, errno_str($return));
}
+*/
+probe kernel.function("kernel_sendmsg").return
+{
+ if ($return < 0 && $return != -11)
+ printf("kernel_sendmsg: %s(%d): status %d (%s)\n", execname(), pid(),
+ $return, errno_str($return));
+}
+/*
probe module("sunrpc").function("xs_udp_send_request")
{
printf("xs_udp_send_request: task %p\n", $task);
@@ -45,6 +91,7 @@ probe module("sunrpc").function("xs_bind4").return
{
printf("xs_bind4: %d %s\n", $return, errno_str($return));
}
+*/
probe begin { log("starting xprt probe") }
probe end { log("ending xprt probe") }
diff --git a/sunrpc/xprt_copy.stp b/sunrpc/xprt_copy.stp
new file mode 100644
index 0000000..fbb5fff
--- /dev/null
+++ b/sunrpc/xprt_copy.stp
@@ -0,0 +1,17 @@
+global nbytes
+
+probe module("sunrpc").function("xdr_inline_decode")
+{
+ nbytes = $nbytes;
+}
+probe module("sunrpc").function("xdr_inline_decode").return
+{
+ printf("xdr_inline_decode: bytes %d return %p\n", nbytes, $return);
+}
+probe module("sunrpc").function("xdr_copy_to_scratch").return
+{
+ printf("xdr_copy_to_scratch: bytes %d return %p\n", nbytes, $return);
+}
+
+probe begin { log("starting probe") }
+probe end { log("ending probe") }
diff --git a/tapset/fs.stp b/tapset/fs.stp
index 94c39ff..6f3fe9d 100644
--- a/tapset/fs.stp
+++ b/tapset/fs.stp
@@ -59,3 +59,17 @@ function file2ops:string(filep:long)
CATCH_DEREF_FAULT();
%}
+function pathdump:string(pathp:long)
+%{
+ struct path *path = (struct path *)(long) kread(&(THIS->pathp));
+ struct vfsmount *mnt=NULL;
+
+ if (path) {
+ mnt = (struct vfsmount *) kread(&(path->mnt));
+ }
+ if (mnt) {
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "pathdump: mnt_sb 0x%p mnt_root 0x%p dentry 0x%p",
+ mnt->mnt_sb, mnt->mnt_root, path->dentry);
+ }
+ CATCH_DEREF_FAULT();
+%}
diff --git a/tapset/iserr.stp b/tapset/iserr.stp
new file mode 100644
index 0000000..26207fd
--- /dev/null
+++ b/tapset/iserr.stp
@@ -0,0 +1,11 @@
+%{
+#include <linux/types.h>
+#include <linux/err.h>
+%}
+
+function is_err:long(_ptr:long)
+%{
+ THIS->__retvalue = (long)IS_ERR((char *)THIS->_ptr);
+
+ CATCH_DEREF_FAULT();
+%}
diff --git a/tapset/key.stp b/tapset/key.stp
new file mode 100644
index 0000000..7a40d7d
--- /dev/null
+++ b/tapset/key.stp
@@ -0,0 +1,12 @@
+%{
+#include <linux/key-type.h>
+%}
+
+function key_type:string(_ptr:long)
+%{
+ struct key_type *type = (struct key_type *)(long)kread(&(THIS->_ptr));
+
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", type->name);
+
+ CATCH_DEREF_FAULT();
+%}
diff --git a/tapset/rpc_clnt.stp b/tapset/rpc_clnt.stp
new file mode 100644
index 0000000..587a67b
--- /dev/null
+++ b/tapset/rpc_clnt.stp
@@ -0,0 +1,42 @@
+%{
+#include <linux/sunrpc/sched.h>
+#include <linux/sunrpc/clnt.h>
+%}
+function rpcprocnum:long(_msg:long)
+%{
+ struct rpc_message *msg = (struct rpc_message *)(long) kread(&(THIS->_msg));
+ struct rpc_procinfo *rpc_proc =
+ (struct rpc_procinfo *)(long) kread(&(msg->rpc_proc));
+
+ THIS->__retvalue = rpc_proc->p_proc;
+
+ CATCH_DEREF_FAULT();
+%}
+function rpcprocname:string(_msg:long)
+%{
+ struct rpc_message *msg = (struct rpc_message *)(long) kread(&(THIS->_msg));
+ struct rpc_procinfo *rpc_proc =
+ (struct rpc_procinfo *)(long) kread(&(msg->rpc_proc));
+ char *p_name = kread(&(rpc_proc->p_name));
+ char buf[MAXSTRINGLEN];
+
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s(%d)",
+ p_name ? p_name : "NULL" , rpc_proc->p_proc);
+
+ CATCH_DEREF_FAULT();
+%}
+function rpcprogname:string(_clnt:long)
+%{
+ struct rpc_clnt *clnt = (struct rpc_clnt *)(long) kread(&(THIS->_clnt));
+ char *cl_server = kread(&(clnt->cl_server));
+ char *cl_protname = kread(&(clnt->cl_protname));
+ char buf[MAXSTRINGLEN];
+
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s:%s(%d)",
+ cl_server ? cl_server : "NULL" ,
+ cl_protname ? cl_protname : "NULL",
+ clnt->cl_vers);
+
+ CATCH_DEREF_FAULT();
+%}
+
diff --git a/tapset/sunrpc_task.stp b/tapset/sunrpc_task.stp
deleted file mode 100644
index 47cc178..0000000
--- a/tapset/sunrpc_task.stp
+++ /dev/null
@@ -1,63 +0,0 @@
-%{
-#include <linux/sunrpc/svc.h>
-#include <linux/sunrpc/sched.h>
-#include <linux/sunrpc/clnt.h>
-%}
-
-function cl_prog:string(_task:long)
-%{
- struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
- struct rpc_clnt *clnt = (struct rpc_clnt *)(long) kread(&(task->tk_client));
- struct rpc_procinfo *proc =
- (struct rpc_procinfo *)(long) kread(&(clnt->cl_procinfo));
- char *p_name = kread(&(proc->p_name));
- static struct {
- int prog;
- char *string;
- } prog_progtbl[] = {
- {100000, "rpcbind"},
- {100024, "statd"},
- {100011, "rquotad"},
- {100003, "nfsd"},
- {100021, "nlockmgr"},
- {100005, "mountd"},
- {100227, "nfs_acl"},
- };
- int i;
- int tabsz = (sizeof(prog_progtbl)/sizeof(prog_progtbl[0]));
-
- for (i = 0; i < tabsz; i++) {
- if (prog_progtbl[i].prog == clnt->cl_prog) {
- break;
- }
- }
- if (i == tabsz)
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "0x%x[%d]:%d",
- clnt->cl_prog, clnt->cl_vers, proc->p_proc);
- else
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s[%d]:%d",
- prog_progtbl[i].string, clnt->cl_vers, proc->p_proc);
-
- CATCH_DEREF_FAULT();
-%}
-function cl_server:string(_task:long)
-%{
- struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
- struct rpc_clnt *clnt = (struct rpc_clnt *)(long) kread(&(task->tk_client));
- char *cl_server = kread(&(clnt->cl_server));
-
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s",
- cl_server ? cl_server : "NULL");
-
- CATCH_DEREF_FAULT();
-%}
-
-function task_status:long(_task:long)
-%{
- struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
-
- THIS->__retvalue = task->tk_status;
-
- CATCH_DEREF_FAULT();
-%}
-
diff --git a/tapset/task.stp b/tapset/task.stp
index 6b121be..f98d7be 100644
--- a/tapset/task.stp
+++ b/tapset/task.stp
@@ -1,5 +1,6 @@
%{
#include <linux/kernel.h>
+#include <linux/ktime.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/svc.h>
@@ -8,17 +9,46 @@
function task_dump:string(_task:long)
%{
struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
- char buf[MAXSTRINGLEN];
+ char buf[64];
int cc=0;
if (task <= 0) {
sprintf(buf+cc, "task NULL");
} else {
- sprintf(buf+cc, "task %p tk_pid %d tk_status %d\n",
+ sprintf(buf+cc, ": task 0x%p tk_pid %d tk_status %d",
task, task->tk_pid, task->tk_status);
cc = strlen(buf);
}
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf);
+ snprintf(THIS->__retvalue, 64, "%s", buf);
+
+ CATCH_DEREF_FAULT();
+%}
+function xprt_dump:string(_task:long)
+%{
+ struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
+ struct rpc_rqst *req;
+ struct rpc_xprt *xprt;
+ char buf[64];
+ int cc=0;
+
+ if (task <= 0) {
+ sprintf(buf+cc, "task NULL");
+ goto leave;
+ }
+ req = (struct rpc_rqst *)(long) kread(&(task->tk_rqstp));
+ if (req <= 0) {
+ sprintf(buf+cc, "req is NULL");
+ goto leave;
+ }
+ xprt = (struct rpc_xprt *)(long) kread(&(req->rq_xprt));
+ if (xprt <= 0) {
+ sprintf(buf+cc, "xprt is NULL");
+ goto leave;
+ }
+ sprintf(buf+cc, ": xprt 0x%p state 0x%lx", xprt, xprt->state);
+ cc = strlen(buf);
+leave:
+ snprintf(THIS->__retvalue, 64, "%s", buf);
CATCH_DEREF_FAULT();
%}
@@ -30,6 +60,20 @@ function task_status:long(_task:long)
CATCH_DEREF_FAULT();
%}
+function task_flags:string(_task:long)
+%{
+ struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
+ char buf[64];
+ int cc=0;
+
+ if (task->tk_flags & RPC_TASK_ASYNC) {
+ snprintf(buf+cc, 64, "ASYNC");
+ cc = strlen(buf);
+ }
+ snprintf(THIS->__retvalue, 64, "%s", buf);
+
+ CATCH_DEREF_FAULT();
+%}
function cl_prognum:long(_task:long)
%{
@@ -50,14 +94,30 @@ function cl_vers:long(_task:long)
CATCH_DEREF_FAULT();
%}
+function cl_protname:string(_task:long)
+%{
+ struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
+ struct rpc_clnt *clnt;
+ char *protname = NULL;
+
+ if (task) {
+ clnt = (struct rpc_clnt *)(long) kread(&(task->tk_client));
+ if (clnt)
+ protname = (char *)(long) kread(&(clnt->cl_protname));
+ }
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", protname);
+
+ CATCH_DEREF_FAULT();
+%}
function cl_prog:string(_task:long)
%{
struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
- struct rpc_clnt *clnt = (struct rpc_clnt *)(long) kread(&(task->tk_client));
- struct rpc_procinfo *proc =
- (struct rpc_procinfo *)(long) kread(&(clnt->cl_procinfo));
- char *p_name = kread(&(proc->p_name));
+ struct rpc_clnt *clnt;
+ struct rpc_procinfo *proc;
+ char *p_name;
+ char buf[64];
+
static struct {
int prog;
char *string;
@@ -73,28 +133,65 @@ function cl_prog:string(_task:long)
int i;
int tabsz = (sizeof(prog_progtbl)/sizeof(prog_progtbl[0]));
+ if (task <= 0) {
+ sprintf(buf, "task NULL");
+ goto leave;
+ }
+ clnt = (struct rpc_clnt *)(long) kread(&(task->tk_client));
+ if (clnt == NULL) {
+ sprintf(buf, "tk_client NULL");
+ goto leave;
+ }
+ proc = (struct rpc_procinfo *)(long) kread(&(clnt->cl_procinfo));
+ if (proc == NULL) {
+ sprintf(buf, "cl_procinfo NULL");
+ goto leave;
+ }
+ p_name = kread(&(proc->p_name));
+
for (i = 0; i < tabsz; i++) {
if (prog_progtbl[i].prog == clnt->cl_prog) {
break;
}
}
if (i == tabsz)
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "0x%x[%d]:%d",
+ snprintf(buf, 64, "0x%x[%d]:%d",
clnt->cl_prog, clnt->cl_vers, proc->p_proc);
else
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s[%d]:%d",
+ snprintf(buf, 64, "%s[%d]:%d",
prog_progtbl[i].string, clnt->cl_vers, proc->p_proc);
+leave:
+ snprintf(THIS->__retvalue, 64, "%s", buf);
+
CATCH_DEREF_FAULT();
%}
+
function cl_server:string(_task:long)
%{
struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
- struct rpc_clnt *clnt = (struct rpc_clnt *)(long) kread(&(task->tk_client));
- char *cl_server = kread(&(clnt->cl_server));
+ struct rpc_clnt *clnt;
+ char *cl_server = NULL;
+
+ if (task) {
+ clnt = (struct rpc_clnt *)(long) kread(&(task->tk_client));
+ if (clnt)
+ cl_server = kread(&(clnt->cl_server));
+ }
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", cl_server);
+
+ CATCH_DEREF_FAULT();
+%}
+function rpc_rtt:long(_task:long)
+%{
+ struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task));
+ struct rpc_rqst *req;
+ long rtt = 0;
+
+ if (task)
+ rtt = ktime_to_ms(ktime_sub(ktime_get(), task->tk_start));
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s",
- cl_server ? cl_server : "NULL");
+ THIS->__retvalue = rtt;
CATCH_DEREF_FAULT();
%}
diff --git a/top-nfscalls.stp b/top-nfscalls.stp
index 90586e0..ebd3eaf 100755
--- a/top-nfscalls.stp
+++ b/top-nfscalls.stp
@@ -6,8 +6,8 @@ probe begin {
printf("Collecting top NFS procs...\n")
}
-probe kernel.function("*@fs/nfs/*proc.c") ?,
- module("nfs").function("*@fs/nfs/*proc.c") ?
+probe kernel.function("*@fs/nfs/*.c") ?,
+ module("nfs").function("*@fs/nfs/*.c") ?
{
nfscalls[probefunc()]++
}
diff --git a/top-xprtcalls.stp b/top-xprtcalls.stp
new file mode 100755
index 0000000..ab9edbb
--- /dev/null
+++ b/top-xprtcalls.stp
@@ -0,0 +1,20 @@
+#!/usr/bin/env stap
+
+global rpccalls
+
+probe begin {
+ printf("Collecting data...\n")
+}
+
+probe kernel.function("*@net/sunrpc") ?,
+ module("sunrpc").function("*@net/sunrpc/xprt*.c") ?
+{
+ rpccalls[probefunc()]++
+}
+
+probe end {
+ printf("Collating data...\n");
+ foreach (name in rpccalls- limit 40)
+ printf("%10d %s\n", rpccalls[name], name)
+}
+
diff --git a/tracepoints/rpc_sched_events.stp b/tracepoints/rpc_sched_events.stp
new file mode 100644
index 0000000..1189f07
--- /dev/null
+++ b/tracepoints/rpc_sched_events.stp
@@ -0,0 +1,32 @@
+/*
+ * stap -g -I ../tapset rpc_sched_events.stp
+ */
+probe kernel.trace("rpc_task_begin")
+{
+ printf("%s[%d]:%s:%s: %s\n",
+ execname(), pid(), $$name, rpcprogname($clnt), $$parms);
+
+}
+probe kernel.trace("rpc_task_complete")
+{
+ printf("%s[%d]:%s:%s: %s\n",
+ execname(), pid(), $$name, rpcprogname($clnt), $$parms);
+}
+probe kernel.trace("rpc_task_sleep")
+{
+ printf("%s[%d]:%s:%s: %s\n",
+ execname(), pid(), $$name, rpcprogname($clnt), $$parms);
+}
+probe kernel.trace("rpc_task_wakeup")
+{
+ printf("%s[%d]:%s:%s: %s\n",
+ execname(), pid(), $$name, rpcprogname($clnt), $$parms);
+}
+probe kernel.trace("rpc_task_run_action")
+{
+ printf("%s[%d]:%s:%s: %s\n",
+ execname(), pid(), $$name, rpcprogname($clnt), $$parms);
+}
+
+probe begin { log("starting rpc sched events probe") }
+probe end { log("ending rpc events events probe") }