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 DECLARE_EVENT_CLASS(workqueue_work
,
13 TP_PROTO(struct work_struct
*work
),
18 __field( void *, work
)
25 TP_printk("work struct %p", __entry
->work
)
29 * workqueue_queue_work - called when a work gets queued
30 * @req_cpu: the requested cpu
31 * @pwq: pointer to struct pool_workqueue
32 * @work: pointer to struct work_struct
34 * This event occurs when a work is queued immediately or once a
35 * delayed work is actually queued on a workqueue (ie: once the delay
38 TRACE_EVENT(workqueue_queue_work
,
40 TP_PROTO(unsigned int req_cpu
, struct pool_workqueue
*pwq
,
41 struct work_struct
*work
),
43 TP_ARGS(req_cpu
, pwq
, work
),
46 __field( void *, work
)
47 __field( void *, function
)
48 __field( void *, workqueue
)
49 __field( unsigned int, req_cpu
)
50 __field( unsigned int, cpu
)
55 __entry
->function
= work
->func
;
56 __entry
->workqueue
= pwq
->wq
;
57 __entry
->req_cpu
= req_cpu
;
58 __entry
->cpu
= pwq
->pool
->cpu
;
61 TP_printk("work struct=%p function=%pf workqueue=%p req_cpu=%u cpu=%u",
62 __entry
->work
, __entry
->function
, __entry
->workqueue
,
63 __entry
->req_cpu
, __entry
->cpu
)
67 * workqueue_activate_work - called when a work gets activated
68 * @work: pointer to struct work_struct
70 * This event occurs when a queued work is put on the active queue,
71 * which happens immediately after queueing unless @max_active limit
74 DEFINE_EVENT(workqueue_work
, workqueue_activate_work
,
76 TP_PROTO(struct work_struct
*work
),
82 * workqueue_execute_start - called immediately before the workqueue callback
83 * @work: pointer to struct work_struct
85 * Allows to track workqueue execution.
87 TRACE_EVENT(workqueue_execute_start
,
89 TP_PROTO(struct work_struct
*work
),
94 __field( void *, work
)
95 __field( void *, function
)
100 __entry
->function
= work
->func
;
103 TP_printk("work struct %p: function %pf", __entry
->work
, __entry
->function
)
107 * workqueue_execute_end - called immediately after the workqueue callback
108 * @work: pointer to struct work_struct
110 * Allows to track workqueue execution.
112 DEFINE_EVENT(workqueue_work
, workqueue_execute_end
,
114 TP_PROTO(struct work_struct
*work
),
119 #endif /* _TRACE_WORKQUEUE_H */
121 /* This part must be outside protection */
122 #include <trace/define_trace.h>