1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM workqueue
5 #if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_WORKQUEUE_H
8 #include <linux/tracepoint.h>
9 #include <linux/workqueue.h>
11 struct pool_workqueue
;
14 * workqueue_queue_work - called when a work gets queued
15 * @req_cpu: the requested cpu
16 * @pwq: pointer to struct pool_workqueue
17 * @work: pointer to struct work_struct
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
23 TRACE_EVENT(workqueue_queue_work
,
25 TP_PROTO(int req_cpu
, struct pool_workqueue
*pwq
,
26 struct work_struct
*work
),
28 TP_ARGS(req_cpu
, pwq
, work
),
31 __field( void *, work
)
32 __field( void *, function
)
33 __string( workqueue
, pwq
->wq
->name
)
34 __field( int, req_cpu
)
40 __entry
->function
= work
->func
;
41 __assign_str(workqueue
);
42 __entry
->req_cpu
= req_cpu
;
43 __entry
->cpu
= pwq
->pool
->cpu
;
46 TP_printk("work struct=%p function=%ps workqueue=%s req_cpu=%d cpu=%d",
47 __entry
->work
, __entry
->function
, __get_str(workqueue
),
48 __entry
->req_cpu
, __entry
->cpu
)
52 * workqueue_activate_work - called when a work gets activated
53 * @work: pointer to struct work_struct
55 * This event occurs when a queued work is put on the active queue,
56 * which happens immediately after queueing unless @max_active limit
59 TRACE_EVENT(workqueue_activate_work
,
61 TP_PROTO(struct work_struct
*work
),
66 __field( void *, work
)
67 __field( void *, function
)
72 __entry
->function
= work
->func
;
75 TP_printk("work struct %p function=%ps ", __entry
->work
, __entry
->function
)
79 * workqueue_execute_start - called immediately before the workqueue callback
80 * @work: pointer to struct work_struct
82 * Allows to track workqueue execution.
84 TRACE_EVENT(workqueue_execute_start
,
86 TP_PROTO(struct work_struct
*work
),
91 __field( void *, work
)
92 __field( void *, function
)
97 __entry
->function
= work
->func
;
100 TP_printk("work struct %p: function %ps", __entry
->work
, __entry
->function
)
104 * workqueue_execute_end - called immediately after the workqueue callback
105 * @work: pointer to struct work_struct
106 * @function: pointer to worker function
108 * Allows to track workqueue execution.
110 TRACE_EVENT(workqueue_execute_end
,
112 TP_PROTO(struct work_struct
*work
, work_func_t function
),
114 TP_ARGS(work
, function
),
117 __field( void *, work
)
118 __field( void *, function
)
122 __entry
->work
= work
;
123 __entry
->function
= function
;
126 TP_printk("work struct %p: function %ps", __entry
->work
, __entry
->function
)
129 #endif /* _TRACE_WORKQUEUE_H */
131 /* This part must be outside protection */
132 #include <trace/define_trace.h>