| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM workqueue |
| 4 | |
| 5 | #if !defined(LTTNG_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define LTTNG_TRACE_WORKQUEUE_H |
| 7 | |
| 8 | #include <lttng/tracepoint-event.h> |
| 9 | #include <linux/workqueue.h> |
| 10 | #include <lttng/kernel-version.h> |
| 11 | |
| 12 | #ifndef _TRACE_WORKQUEUE_DEF_ |
| 13 | #define _TRACE_WORKQUEUE_DEF_ |
| 14 | |
| 15 | struct worker; |
| 16 | struct global_cwq; |
| 17 | |
| 18 | #endif |
| 19 | |
| 20 | LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work, |
| 21 | |
| 22 | TP_PROTO(struct work_struct *work), |
| 23 | |
| 24 | TP_ARGS(work), |
| 25 | |
| 26 | TP_FIELDS( |
| 27 | ctf_integer_hex(void *, work, work) |
| 28 | ) |
| 29 | ) |
| 30 | |
| 31 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,19,0)) |
| 32 | /** |
| 33 | * workqueue_queue_work - called when a work gets queued |
| 34 | * @req_cpu: the requested cpu |
| 35 | * @pwq: pointer to struct pool_workqueue |
| 36 | * @work: pointer to struct work_struct |
| 37 | * |
| 38 | * This event occurs when a work is queued immediately or once a |
| 39 | * delayed work is actually queued on a workqueue (ie: once the delay |
| 40 | * has been reached). |
| 41 | */ |
| 42 | LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, |
| 43 | |
| 44 | TP_PROTO(int req_cpu, struct pool_workqueue *pwq, |
| 45 | struct work_struct *work), |
| 46 | |
| 47 | TP_ARGS(req_cpu, pwq, work), |
| 48 | |
| 49 | TP_FIELDS( |
| 50 | ctf_integer_hex(void *, work, work) |
| 51 | ctf_integer_hex(void *, function, work->func) |
| 52 | ctf_integer(int, req_cpu, req_cpu) |
| 53 | ) |
| 54 | ) |
| 55 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,9,0)) |
| 56 | /** |
| 57 | * workqueue_queue_work - called when a work gets queued |
| 58 | * @req_cpu: the requested cpu |
| 59 | * @pwq: pointer to struct pool_workqueue |
| 60 | * @work: pointer to struct work_struct |
| 61 | * |
| 62 | * This event occurs when a work is queued immediately or once a |
| 63 | * delayed work is actually queued on a workqueue (ie: once the delay |
| 64 | * has been reached). |
| 65 | */ |
| 66 | LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, |
| 67 | |
| 68 | TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq, |
| 69 | struct work_struct *work), |
| 70 | |
| 71 | TP_ARGS(req_cpu, pwq, work), |
| 72 | |
| 73 | TP_FIELDS( |
| 74 | ctf_integer_hex(void *, work, work) |
| 75 | ctf_integer_hex(void *, function, work->func) |
| 76 | ctf_integer(unsigned int, req_cpu, req_cpu) |
| 77 | ) |
| 78 | ) |
| 79 | #else |
| 80 | /** |
| 81 | * workqueue_queue_work - called when a work gets queued |
| 82 | * @req_cpu: the requested cpu |
| 83 | * @cwq: pointer to struct cpu_workqueue_struct |
| 84 | * @work: pointer to struct work_struct |
| 85 | * |
| 86 | * This event occurs when a work is queued immediately or once a |
| 87 | * delayed work is actually queued on a workqueue (ie: once the delay |
| 88 | * has been reached). |
| 89 | */ |
| 90 | LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, |
| 91 | |
| 92 | TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq, |
| 93 | struct work_struct *work), |
| 94 | |
| 95 | TP_ARGS(req_cpu, cwq, work), |
| 96 | |
| 97 | TP_FIELDS( |
| 98 | ctf_integer_hex(void *, work, work) |
| 99 | ctf_integer_hex(void *, function, work->func) |
| 100 | ctf_integer(unsigned int, req_cpu, req_cpu) |
| 101 | ) |
| 102 | ) |
| 103 | #endif |
| 104 | |
| 105 | /** |
| 106 | * workqueue_activate_work - called when a work gets activated |
| 107 | * @work: pointer to struct work_struct |
| 108 | * |
| 109 | * This event occurs when a queued work is put on the active queue, |
| 110 | * which happens immediately after queueing unless @max_active limit |
| 111 | * is reached. |
| 112 | */ |
| 113 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_activate_work, |
| 114 | |
| 115 | TP_PROTO(struct work_struct *work), |
| 116 | |
| 117 | TP_ARGS(work) |
| 118 | ) |
| 119 | |
| 120 | /** |
| 121 | * workqueue_execute_start - called immediately before the workqueue callback |
| 122 | * @work: pointer to struct work_struct |
| 123 | * |
| 124 | * Allows to track workqueue execution. |
| 125 | */ |
| 126 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_start, |
| 127 | |
| 128 | TP_PROTO(struct work_struct *work), |
| 129 | |
| 130 | TP_ARGS(work), |
| 131 | |
| 132 | TP_FIELDS( |
| 133 | ctf_integer_hex(void *, work, work) |
| 134 | ctf_integer_hex(void *, function, work->func) |
| 135 | ) |
| 136 | ) |
| 137 | |
| 138 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) |
| 139 | /** |
| 140 | * workqueue_execute_end - called immediately after the workqueue callback |
| 141 | * @work: pointer to struct work_struct |
| 142 | * @function: pointer to worker function |
| 143 | * |
| 144 | * Allows to track workqueue execution. |
| 145 | */ |
| 146 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_end, |
| 147 | |
| 148 | TP_PROTO(struct work_struct *work, work_func_t function), |
| 149 | |
| 150 | TP_ARGS(work, function), |
| 151 | |
| 152 | TP_FIELDS( |
| 153 | ctf_integer_hex(void *, work, work) |
| 154 | ctf_integer_hex(void *, function, function) |
| 155 | ) |
| 156 | ) |
| 157 | #else |
| 158 | /** |
| 159 | * workqueue_execute_end - called immediately after the workqueue callback |
| 160 | * @work: pointer to struct work_struct |
| 161 | * |
| 162 | * Allows to track workqueue execution. |
| 163 | */ |
| 164 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_execute_end, |
| 165 | |
| 166 | TP_PROTO(struct work_struct *work), |
| 167 | |
| 168 | TP_ARGS(work) |
| 169 | ) |
| 170 | #endif |
| 171 | |
| 172 | #endif /* LTTNG_TRACE_WORKQUEUE_H */ |
| 173 | |
| 174 | /* This part must be outside protection */ |
| 175 | #include <lttng/define_trace.h> |