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