aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/sched.h2
-rw-r--r--include/trace/events/sunrpc.h124
-rw-r--r--net/sunrpc/sched.c12
3 files changed, 137 insertions, 1 deletions
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index bd337f990a41..f7b2df5252b0 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -271,7 +271,7 @@ static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char pri
271} 271}
272 272
273#ifdef RPC_DEBUG 273#ifdef RPC_DEBUG
274static inline const char * rpc_qname(struct rpc_wait_queue *q) 274static inline const char * rpc_qname(const struct rpc_wait_queue *q)
275{ 275{
276 return ((q && q->name) ? q->name : "unknown"); 276 return ((q && q->name) ? q->name : "unknown");
277} 277}
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
new file mode 100644
index 000000000000..51cc9490919f
--- /dev/null
+++ b/include/trace/events/sunrpc.h
@@ -0,0 +1,124 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM sunrpc
3
4#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SUNRPC_H
6
7#include <linux/sunrpc/sched.h>
8#include <linux/sunrpc/clnt.h>
9#include <linux/tracepoint.h>
10
11DECLARE_EVENT_CLASS(rpc_task_running,
12
13 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
14
15 TP_ARGS(clnt, task, action),
16
17 TP_STRUCT__entry(
18 __field(const struct rpc_clnt *, clnt)
19 __field(const struct rpc_task *, task)
20 __field(const void *, action)
21 __field(unsigned long, runstate)
22 __field(int, status)
23 __field(unsigned short, flags)
24 ),
25
26 TP_fast_assign(
27 __entry->clnt = clnt;
28 __entry->task = task;
29 __entry->action = action;
30 __entry->runstate = task->tk_runstate;
31 __entry->status = task->tk_status;
32 __entry->flags = task->tk_flags;
33 ),
34
35 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d action=%pf",
36 __entry->task,
37 __entry->clnt,
38 __entry->flags,
39 __entry->runstate,
40 __entry->status,
41 __entry->action
42 )
43);
44
45DEFINE_EVENT(rpc_task_running, rpc_task_begin,
46
47 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
48
49 TP_ARGS(clnt, task, action)
50
51);
52
53DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
54
55 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
56
57 TP_ARGS(clnt, task, action)
58
59);
60
61DEFINE_EVENT(rpc_task_running, rpc_task_complete,
62
63 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
64
65 TP_ARGS(clnt, task, action)
66
67);
68
69DECLARE_EVENT_CLASS(rpc_task_queued,
70
71 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
72
73 TP_ARGS(clnt, task, q),
74
75 TP_STRUCT__entry(
76 __field(const struct rpc_clnt *, clnt)
77 __field(const struct rpc_task *, task)
78 __field(const struct rpc_wait_queue *, queue)
79 __field(unsigned long, timeout)
80 __field(unsigned long, runstate)
81 __field(int, status)
82 __field(unsigned short, flags)
83 ),
84
85 TP_fast_assign(
86 __entry->clnt = clnt;
87 __entry->task = task;
88 __entry->queue = q;
89 __entry->timeout = task->tk_timeout;
90 __entry->runstate = task->tk_runstate;
91 __entry->status = task->tk_status;
92 __entry->flags = task->tk_flags;
93 ),
94
95 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
96 __entry->task,
97 __entry->clnt,
98 __entry->flags,
99 __entry->runstate,
100 __entry->status,
101 __entry->timeout,
102 rpc_qname(__entry->queue)
103 )
104);
105
106DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
107
108 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
109
110 TP_ARGS(clnt, task, q)
111
112);
113
114DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
115
116 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
117
118 TP_ARGS(clnt, task, q)
119
120);
121
122#endif /* _TRACE_SUNRPC_H */
123
124#include <trace/define_trace.h>
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index f982dfe53993..d79c63df49b8 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -28,6 +28,9 @@
28#define RPCDBG_FACILITY RPCDBG_SCHED 28#define RPCDBG_FACILITY RPCDBG_SCHED
29#endif 29#endif
30 30
31#define CREATE_TRACE_POINTS
32#include <trace/events/sunrpc.h>
33
31/* 34/*
32 * RPC slabs and memory pools 35 * RPC slabs and memory pools
33 */ 36 */
@@ -251,6 +254,8 @@ static inline void rpc_task_set_debuginfo(struct rpc_task *task)
251 254
252static void rpc_set_active(struct rpc_task *task) 255static void rpc_set_active(struct rpc_task *task)
253{ 256{
257 trace_rpc_task_begin(task->tk_client, task, NULL);
258
254 rpc_task_set_debuginfo(task); 259 rpc_task_set_debuginfo(task);
255 set_bit(RPC_TASK_ACTIVE, &task->tk_runstate); 260 set_bit(RPC_TASK_ACTIVE, &task->tk_runstate);
256} 261}
@@ -267,6 +272,8 @@ static int rpc_complete_task(struct rpc_task *task)
267 unsigned long flags; 272 unsigned long flags;
268 int ret; 273 int ret;
269 274
275 trace_rpc_task_complete(task->tk_client, task, NULL);
276
270 spin_lock_irqsave(&wq->lock, flags); 277 spin_lock_irqsave(&wq->lock, flags);
271 clear_bit(RPC_TASK_ACTIVE, &task->tk_runstate); 278 clear_bit(RPC_TASK_ACTIVE, &task->tk_runstate);
272 ret = atomic_dec_and_test(&task->tk_count); 279 ret = atomic_dec_and_test(&task->tk_count);
@@ -324,6 +331,8 @@ static void __rpc_sleep_on_priority(struct rpc_wait_queue *q,
324 dprintk("RPC: %5u sleep_on(queue \"%s\" time %lu)\n", 331 dprintk("RPC: %5u sleep_on(queue \"%s\" time %lu)\n",
325 task->tk_pid, rpc_qname(q), jiffies); 332 task->tk_pid, rpc_qname(q), jiffies);
326 333
334 trace_rpc_task_sleep(task->tk_client, task, q);
335
327 __rpc_add_wait_queue(q, task, queue_priority); 336 __rpc_add_wait_queue(q, task, queue_priority);
328 337
329 BUG_ON(task->tk_callback != NULL); 338 BUG_ON(task->tk_callback != NULL);
@@ -378,6 +387,8 @@ static void __rpc_do_wake_up_task(struct rpc_wait_queue *queue, struct rpc_task
378 return; 387 return;
379 } 388 }
380 389
390 trace_rpc_task_wakeup(task->tk_client, task, queue);
391
381 __rpc_remove_wait_queue(queue, task); 392 __rpc_remove_wait_queue(queue, task);
382 393
383 rpc_make_runnable(task); 394 rpc_make_runnable(task);
@@ -701,6 +712,7 @@ static void __rpc_execute(struct rpc_task *task)
701 if (do_action == NULL) 712 if (do_action == NULL)
702 break; 713 break;
703 } 714 }
715 trace_rpc_task_run_action(task->tk_client, task, task->tk_action);
704 do_action(task); 716 do_action(task);
705 717
706 /* 718 /*