sunrpc: Adding trace points to status routines (take 2)
Subsystems (4)
PATCH 1/1 sunrpc: Adding trace points to status routines (take 2)
Hey Trond,
Here is an updated version of the patch I sent out a while back... all that has changed was the addtion of 'rpc_' to the name of the trace points which coincides with the other trace points naming convention.
Here is a pointer to the previous email that has the fairly long winded explanation of how all this works:
http://marc.info/?l=linux-kernel&m=124058933520183&w=2
And below is the updated patch which is based on Ingo's linux-2.6-tip.git tree.
Comments?
steved.
Author: Steve Dickson <[email protected]> Date: Tue Jun 9 14:12:07 EDT 2009
Adds three trace points to the status routines in the sunrpc state machine. The trace points will only execute in error conditions.
The goal of these trace points it to make it easier to debug process that spin or get hung up in the NFS and related subsystems.
include/trace/events/sunrpc.h new file +86 -0
@@ -0,0 +1,86 @@ +#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_SUNRPC_H + +#include <linux/tracepoint.h> + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM sunrpc + +TRACE_EVENT (rpc_call_status, + + TP_PROTO(struct rpc_task *task), + +TP_ARGS (task), + +TP_STRUCT__entry ( + __field(u32, cl_prog) + __field(u32, cl_vers) + __field(u32, p_proc) +__field (int, tk_status) + ), + +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->cl_prog = task->tk_client->cl_prog; + __entry->tk_status = task->tk_status; + ), + +TP_printk ("%d[%d]:%d status=%d" , __entry->cl_prog, + __entry->cl_vers,__entry->p_proc, __entry->tk_status) +); + +TRACE_EVENT (rpc_bind_status, + + TP_PROTO(struct rpc_task *task), + +TP_ARGS (task), + +TP_STRUCT__entry ( + __field(u32, cl_prog) + __field(u32, cl_vers) + __field(u32, p_proc) +__field (int, tk_status) + ), + +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->cl_prog = task->tk_client->cl_prog; + __entry->tk_status = task->tk_status; + ), + +TP_printk ("%d[%d]:%d status=%d" , __entry->cl_prog, + __entry->cl_vers,__entry->p_proc, __entry->tk_status) +); +TRACE_EVENT (rpc_connect_status, + + TP_PROTO(struct rpc_task *task, int status), + +TP_ARGS (task, status), + +TP_STRUCT__entry ( + __field(u32, cl_prog) + __field(u32, cl_vers) + __field(u32, p_proc) +__field (int, tk_status) + ), + +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->cl_prog = task->tk_client->cl_prog; + __entry->tk_status = status; + ), + +TP_printk ("%d[%d]:%d status=%d" , __entry->cl_prog, + __entry->cl_vers,__entry->p_proc, __entry->tk_status) + +); +#endif /* __TRACE_SUNRPC_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h>
net/sunrpc/clnt.c +6 -0
@@ -37,6 +37,9 @@#include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/sunrpc/metrics.h> +#include <linux/ftrace.h> +#define CREATE_TRACE_POINTS +#include <trace/events/sunrpc.h> #ifdef RPC_DEBUG # define RPCDBG_FACILITY RPCDBG_CALL
@@ -957,6 +960,7 @@ call_bind_status(struct rpc_task *task)return ; } +trace_rpc_bind_status (task);switch (task->tk_status) {case -ENOMEM :dprintk ("RPC: %5u rpcbind out of memory\n" , task->tk_pid);
@@ -1038,6 +1042,7 @@ call_connect_status(struct rpc_task *task)return ; } +trace_rpc_connect_status (task, status);switch (status) {/* if soft mounted, test if we've timed out */ case -ETIMEDOUT :
@@ -1141,6 +1146,7 @@ call_status(struct rpc_task *task)return ; } +trace_rpc_call_status (task); task->tk_status =0 ;switch (status) {case -EHOSTDOWN :
Quoted 22 lines · Steve Dickson
Hey Trond,
Here is an updated version of the patch I sent out a while back... all that has changed was the addtion of '
rpc_' to the name of the trace points which coincides with the other trace points naming convention.Here is a pointer to the previous email that has the fairly long winded explanation of how all this works:
http://marc.info/?l=linux-kernel&m=124058933520183&w=2And below is the updated patch which is based on Ingo's linux-2.6-tip.git tree.
Comments?
steved.
Author: Steve Dickson <[email protected]> Date: Tue Jun 9 14:12:07 EDT 2009
Quoted 7 lines
Adds three trace points to the status routines in the sunrpc state machine. The trace points will only execute in error conditions.
The goal of these trace points it to make it easier to debug process that spin or get hung up in the NFS and related subsystems.
Would this replace the existing dprint_status()? How does it differ from the existing DYNAMIC_DEBUG functionality that was merged in 2.6.30?
Quoted 24 lines
Signed-off-by Steve Dickson <[email protected]>include/trace/events/sunrpc.h new file +16
-0@@ -0,0 +1,86 @@ +#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_SUNRPC_H + +#include <linux/tracepoint.h> + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM sunrpc + +TRACE_EVENT(rpc_call_status, + + TP_PROTO(struct rpc_task *task), + + TP_ARGS(task), + + TP_STRUCT__entry( + __field(u32, cl_prog)
include/trace/events/sunrpc.h line 26
Quoted 10 lines
include/trace/events/sunrpc.h new file +10
-0+ __field(u32, cl_vers) + __field(u32, p_proc) +__field (int, tk_status) + ), + +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->cl_prog = task->tk_client->cl_prog;
You should only need to set entry->cl_prog once, right?
Quoted 15 lines
include/trace/events/sunrpc.h new file +15
-0+ __entry->tk_status = task->tk_status; + ), + +TP_printk ("%d[%d]:%d status=%d" , __entry->cl_prog, + __entry->cl_vers,__entry->p_proc, __entry->tk_status) +); + +TRACE_EVENT(rpc_bind_status, + + TP_PROTO(struct rpc_task *task), + + TP_ARGS(task), + + TP_STRUCT__entry( + __field(u32, cl_prog)
include/trace/events/sunrpc.h line 51
Quoted 10 lines
include/trace/events/sunrpc.h new file +10
-0+ __field(u32, cl_vers) + __field(u32, p_proc) +__field (int, tk_status) + ), + +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->cl_prog = task->tk_client->cl_prog;
Ditto
Quoted 14 lines
include/trace/events/sunrpc.h new file +14
-0+ __entry->tk_status = task->tk_status; + ), + +TP_printk ("%d[%d]:%d status=%d" , __entry->cl_prog, + __entry->cl_vers,__entry->p_proc, __entry->tk_status) +); +TRACE_EVENT(rpc_connect_status, + + TP_PROTO(struct rpc_task *task, int status), + + TP_ARGS(task, status), + + TP_STRUCT__entry( + __field(u32, cl_prog)
include/trace/events/sunrpc.h line 75
Quoted 10 lines
include/trace/events/sunrpc.h new file +10
-0+ __field(u32, cl_vers) + __field(u32, p_proc) +__field (int, tk_status) + ), + +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->cl_prog = task->tk_client->cl_prog;
Ditto
Quoted 51 lines
include/trace/events/sunrpc.h new file +11
-0+ __entry->tk_status = status; + ), + +TP_printk ("%d[%d]:%d status=%d" , __entry->cl_prog, + __entry->cl_vers,__entry->p_proc, __entry->tk_status) + +); +#endif /* __TRACE_SUNRPC_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> net/sunrpc/clnt.c +6
-0@@ -37,6 +37,9 @@#include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/sunrpc/metrics.h> +#include <linux/ftrace.h> +#define CREATE_TRACE_POINTS +#include <trace/events/sunrpc.h> #ifdef RPC_DEBUG # define RPCDBG_FACILITY RPCDBG_CALL@@ -957,6 +960,7 @@ call_bind_status(struct rpc_task *task)return ; } +trace_rpc_bind_status (task);switch (task->tk_status) {case -ENOMEM :dprintk ("RPC: %5u rpcbind out of memory\n" , task->tk_pid);@@ -1038,6 +1042,7 @@ call_connect_status(struct rpc_task *task)return ; } +trace_rpc_connect_status (task, status);switch (status) {/* if soft mounted, test if we've timed out */ case -ETIMEDOUT :@@ -1141,6 +1146,7 @@ call_status(struct rpc_task *task)return ; } +trace_rpc_call_status (task); task->tk_status =0 ;switch (status) {case -EHOSTDOWN :
Quoted 27 lines · Trond Myklebust
Quoted 26 lines · Steve Dickson
Hey Trond,
Here is an updated version of the patch I sent out a while back... all that has changed was the addtion of '
rpc_' to the name of the trace points which coincides with the other trace points naming convention.Here is a pointer to the previous email that has the fairly long winded explanation of how all this works:
http://marc.info/?l=linux-kernel&m=124058933520183&w=2And below is the updated patch which is based on Ingo's linux-2.6-tip.git tree.
Comments?
steved.
Author: Steve Dickson <[email protected]> Date: Tue Jun 9 14:12:07 EDT 2009Adds three trace points to the status routines in the sunrpc state machine. The trace points will only execute in error conditions.
Quoted 6 lines
Quoted 3 lines
The goal of these trace points it to make it easier to debug process that spin or get hung up in the NFS and related subsystems.
Would this replace the existing
dprint_status()? How does it differ from the existingDYNAMIC_DEBUGfunctionality that was merged in 2.6.30?
I believe it would be an addition to... Its my understanding the dynamic debug uses printks, which ultimately causes messages to be log to /var/log/messages... The trace points are used by a systemtap script which is much more efficent and lightweight...
Quoted 29 lines
Quoted 29 lines
Signed-off-by Steve Dickson <[email protected]>include/trace/events/sunrpc.h new file +20
-0@@ -0,0 +1,86 @@ +#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_SUNRPC_H + +#include <linux/tracepoint.h> + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM sunrpc + +TRACE_EVENT(rpc_call_status, + + TP_PROTO(struct rpc_task *task), + + TP_ARGS(task), + + TP_STRUCT__entry( + __field(u32, cl_prog) + __field(u32, cl_vers) + __field(u32, p_proc) + __field(int, tk_status) + ),
Quoted 8 lines
include/trace/events/sunrpc.h line 26
Quoted 6 lines
include/trace/events/sunrpc.h new file +6
-0+ +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->cl_prog = task->tk_client->cl_prog;You should only need to set
entry->cl_progonce, right?
Point... its redundant... Here is the updated patch:
Author: Steve Dickson <[email protected]> Date: Tue Jun 18 14:12:07 EDT 2009
Adds three trace points to the status routines in the sunrpc state machine. The trace points will only execute in error conditions.
The goal of these trace points it to make it easier to debug process that spin or get hung up in the NFS and related subsystems.
include/trace/events/sunrpc.h new file +83 -0
@@ -0,0 +1,86 @@ +#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _TRACE_SUNRPC_H + +#include <linux/tracepoint.h> + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM sunrpc + +TRACE_EVENT (rpc_call_status, + + TP_PROTO(struct rpc_task *task), + +TP_ARGS (task), + +TP_STRUCT__entry ( + __field(u32, cl_prog) + __field(u32, cl_vers) + __field(u32, p_proc) +__field (int, tk_status) + ), + +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->tk_status = task->tk_status; + ), + +TP_printk ("%d[%d]:%d status=%d" , __entry->cl_prog, + __entry->cl_vers,__entry->p_proc, __entry->tk_status) +); + +TRACE_EVENT (rpc_bind_status, + + TP_PROTO(struct rpc_task *task), + +TP_ARGS (task), + +TP_STRUCT__entry ( + __field(u32, cl_prog) + __field(u32, cl_vers) + __field(u32, p_proc) +__field (int, tk_status) + ), + +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->tk_status = task->tk_status; + ), + +TP_printk ("%d[%d]:%d status=%d" , __entry->cl_prog, + __entry->cl_vers,__entry->p_proc, __entry->tk_status) +); +TRACE_EVENT (rpc_connect_status, + + TP_PROTO(struct rpc_task *task, int status), + +TP_ARGS (task, status), + +TP_STRUCT__entry ( + __field(u32, cl_prog) + __field(u32, cl_vers) + __field(u32, p_proc) +__field (int, tk_status) + ), + +TP_fast_assign ( + __entry->cl_prog = task->tk_client->cl_prog; + __entry->cl_vers = task->tk_client->cl_vers; + __entry->p_proc = task->tk_client->cl_procinfo->p_proc; + __entry->tk_status = status; + ), + +TP_printk ("%d[%d]:%d status=%d" , __entry->cl_prog, + __entry->cl_vers,__entry->p_proc, __entry->tk_status) + +); +#endif /* __TRACE_SUNRPC_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h>
net/sunrpc/clnt.c +6 -0
@@ -37,6 +37,9 @@#include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/sunrpc/metrics.h> +#include <linux/ftrace.h> +#define CREATE_TRACE_POINTS +#include <trace/events/sunrpc.h> #ifdef RPC_DEBUG # define RPCDBG_FACILITY RPCDBG_CALL
@@ -957,6 +960,7 @@ call_bind_status(struct rpc_task *task)return ; } +trace_rpc_bind_status (task);switch (task->tk_status) {case -ENOMEM :dprintk ("RPC: %5u rpcbind out of memory\n" , task->tk_pid);
@@ -1038,6 +1042,7 @@ call_connect_status(struct rpc_task *task)return ; } +trace_rpc_connect_status (task, status);switch (status) {/* if soft mounted, test if we've timed out */ case -ETIMEDOUT :
@@ -1141,6 +1146,7 @@ call_status(struct rpc_task *task)return ; } +trace_rpc_call_status (task); task->tk_status =0 ;switch (status) {case -EHOSTDOWN :