]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
e36c886a AV |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM workqueue | |
4 | ||
5 | #if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) | |
6 | #define _TRACE_WORKQUEUE_H | |
7 | ||
8 | #include <linux/tracepoint.h> | |
9 | #include <linux/workqueue.h> | |
10 | ||
1cdae042 AC |
11 | struct pool_workqueue; |
12 | ||
cdadf009 TH |
13 | /** |
14 | * workqueue_queue_work - called when a work gets queued | |
15 | * @req_cpu: the requested cpu | |
112202d9 | 16 | * @pwq: pointer to struct pool_workqueue |
cdadf009 TH |
17 | * @work: pointer to struct work_struct |
18 | * | |
19 | * This event occurs when a work is queued immediately or once a | |
20 | * delayed work is actually queued on a workqueue (ie: once the delay | |
21 | * has been reached). | |
22 | */ | |
23 | TRACE_EVENT(workqueue_queue_work, | |
24 | ||
112202d9 | 25 | TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq, |
cdadf009 TH |
26 | struct work_struct *work), |
27 | ||
112202d9 | 28 | TP_ARGS(req_cpu, pwq, work), |
cdadf009 TH |
29 | |
30 | TP_STRUCT__entry( | |
31 | __field( void *, work ) | |
32 | __field( void *, function) | |
83b62687 | 33 | __string( workqueue, pwq->wq->name) |
cdadf009 TH |
34 | __field( unsigned int, req_cpu ) |
35 | __field( unsigned int, cpu ) | |
36 | ), | |
37 | ||
38 | TP_fast_assign( | |
39 | __entry->work = work; | |
40 | __entry->function = work->func; | |
83b62687 | 41 | __assign_str(workqueue, pwq->wq->name); |
cdadf009 | 42 | __entry->req_cpu = req_cpu; |
112202d9 | 43 | __entry->cpu = pwq->pool->cpu; |
cdadf009 TH |
44 | ), |
45 | ||
7bf9c4a8 | 46 | TP_printk("work struct=%p function=%ps workqueue=%s req_cpu=%u cpu=%u", |
83b62687 | 47 | __entry->work, __entry->function, __get_str(workqueue), |
cdadf009 TH |
48 | __entry->req_cpu, __entry->cpu) |
49 | ); | |
50 | ||
51 | /** | |
52 | * workqueue_activate_work - called when a work gets activated | |
53 | * @work: pointer to struct work_struct | |
54 | * | |
55 | * This event occurs when a queued work is put on the active queue, | |
56 | * which happens immediately after queueing unless @max_active limit | |
57 | * is reached. | |
58 | */ | |
e8ab20d9 | 59 | TRACE_EVENT(workqueue_activate_work, |
cdadf009 TH |
60 | |
61 | TP_PROTO(struct work_struct *work), | |
62 | ||
e8ab20d9 DJ |
63 | TP_ARGS(work), |
64 | ||
65 | TP_STRUCT__entry( | |
66 | __field( void *, work ) | |
67 | ), | |
68 | ||
69 | TP_fast_assign( | |
70 | __entry->work = work; | |
71 | ), | |
72 | ||
73 | TP_printk("work struct %p", __entry->work) | |
cdadf009 TH |
74 | ); |
75 | ||
e36c886a | 76 | /** |
97bd2347 | 77 | * workqueue_execute_start - called immediately before the workqueue callback |
e36c886a AV |
78 | * @work: pointer to struct work_struct |
79 | * | |
80 | * Allows to track workqueue execution. | |
81 | */ | |
97bd2347 | 82 | TRACE_EVENT(workqueue_execute_start, |
e36c886a AV |
83 | |
84 | TP_PROTO(struct work_struct *work), | |
85 | ||
86 | TP_ARGS(work), | |
87 | ||
88 | TP_STRUCT__entry( | |
89 | __field( void *, work ) | |
97bd2347 | 90 | __field( void *, function) |
e36c886a AV |
91 | ), |
92 | ||
93 | TP_fast_assign( | |
94 | __entry->work = work; | |
97bd2347 | 95 | __entry->function = work->func; |
e36c886a AV |
96 | ), |
97 | ||
d75f773c | 98 | TP_printk("work struct %p: function %ps", __entry->work, __entry->function) |
e36c886a AV |
99 | ); |
100 | ||
97bd2347 | 101 | /** |
b3aa1584 | 102 | * workqueue_execute_end - called immediately after the workqueue callback |
97bd2347 | 103 | * @work: pointer to struct work_struct |
1c5da0ec | 104 | * @function: pointer to worker function |
97bd2347 TH |
105 | * |
106 | * Allows to track workqueue execution. | |
107 | */ | |
1c5da0ec | 108 | TRACE_EVENT(workqueue_execute_end, |
97bd2347 | 109 | |
1c5da0ec | 110 | TP_PROTO(struct work_struct *work, work_func_t function), |
97bd2347 | 111 | |
1c5da0ec DJ |
112 | TP_ARGS(work, function), |
113 | ||
114 | TP_STRUCT__entry( | |
115 | __field( void *, work ) | |
116 | __field( void *, function) | |
117 | ), | |
118 | ||
119 | TP_fast_assign( | |
120 | __entry->work = work; | |
121 | __entry->function = function; | |
122 | ), | |
123 | ||
124 | TP_printk("work struct %p: function %ps", __entry->work, __entry->function) | |
97bd2347 | 125 | ); |
e36c886a AV |
126 | |
127 | #endif /* _TRACE_WORKQUEUE_H */ | |
128 | ||
129 | /* This part must be outside protection */ | |
130 | #include <trace/define_trace.h> |