^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 irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define _TRACE_IRQ_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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct irqaction;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct softirq_action;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define SOFTIRQ_NAME_LIST \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) softirq_name(HI) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) softirq_name(TIMER) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) softirq_name(NET_TX) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) softirq_name(NET_RX) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) softirq_name(BLOCK) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) softirq_name(IRQ_POLL) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) softirq_name(TASKLET) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) softirq_name(SCHED) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) softirq_name(HRTIMER) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) softirq_name_end(RCU)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #undef softirq_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #undef softirq_name_end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define softirq_name(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define softirq_name_end(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) SOFTIRQ_NAME_LIST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #undef softirq_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #undef softirq_name_end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define softirq_name_end(sirq) { sirq##_SOFTIRQ, #sirq }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define show_softirq_name(val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) __print_symbolic(val, SOFTIRQ_NAME_LIST)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * irq_handler_entry - called immediately before the irq action handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * @irq: irq number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * @action: pointer to struct irqaction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * The struct irqaction pointed to by @action contains various
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * information about the handler, including the device name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * @action->name, and the device id, @action->dev_id. When used in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * conjunction with the irq_handler_exit tracepoint, we can figure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * out irq handler latencies.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) TRACE_EVENT(irq_handler_entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) TP_PROTO(int irq, struct irqaction *action),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) TP_ARGS(irq, action),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) __field( int, irq )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) __string( name, action->name )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) __entry->irq = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) __assign_str(name, action->name);
^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_printk("irq=%d name=%s", __entry->irq, __get_str(name))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) );
^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) * irq_handler_exit - called immediately after the irq action handler returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * @irq: irq number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * @action: pointer to struct irqaction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * @ret: return value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * @action->handler successfully handled this irq. Otherwise, the irq might be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * a shared irq line, or the irq was not handled successfully. Can be used in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * conjunction with the irq_handler_entry to understand irq handler latencies.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) TRACE_EVENT(irq_handler_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) TP_PROTO(int irq, struct irqaction *action, int ret),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) TP_ARGS(irq, action, ret),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) __field( int, irq )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) __field( int, ret )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) __entry->irq = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) __entry->ret = ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) TP_printk("irq=%d ret=%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) __entry->irq, __entry->ret ? "handled" : "unhandled")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) DECLARE_EVENT_CLASS(softirq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) TP_PROTO(unsigned int vec_nr),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) TP_ARGS(vec_nr),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) __field( unsigned int, vec )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) __entry->vec = vec_nr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) TP_printk("vec=%u [action=%s]", __entry->vec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) show_softirq_name(__entry->vec))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * softirq_entry - called immediately before the softirq handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * @vec_nr: softirq vector number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * When used in combination with the softirq_exit tracepoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * we can determine the softirq handler routine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) DEFINE_EVENT(softirq, softirq_entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) TP_PROTO(unsigned int vec_nr),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) TP_ARGS(vec_nr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * softirq_exit - called immediately after the softirq handler returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * @vec_nr: softirq vector number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * When used in combination with the softirq_entry tracepoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * we can determine the softirq handler routine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) DEFINE_EVENT(softirq, softirq_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) TP_PROTO(unsigned int vec_nr),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) TP_ARGS(vec_nr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * softirq_raise - called immediately when a softirq is raised
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * @vec_nr: softirq vector number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * When used in combination with the softirq_entry tracepoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * we can determine the softirq raise to run latency.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) DEFINE_EVENT(softirq, softirq_raise,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) TP_PROTO(unsigned int vec_nr),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) TP_ARGS(vec_nr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) DECLARE_EVENT_CLASS(tasklet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) TP_PROTO(void *func),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) TP_ARGS(func),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) __field( void *, func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) __entry->func = func;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) TP_printk("function=%ps", __entry->func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) DEFINE_EVENT(tasklet, tasklet_entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) TP_PROTO(void *func),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) TP_ARGS(func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) DEFINE_EVENT(tasklet, tasklet_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) TP_PROTO(void *func),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) TP_ARGS(func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) DEFINE_EVENT(tasklet, tasklet_hi_entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) TP_PROTO(void *func),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) TP_ARGS(func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) DEFINE_EVENT(tasklet, tasklet_hi_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) TP_PROTO(void *func),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) TP_ARGS(func)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) #endif /* _TRACE_IRQ_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) #include <trace/define_trace.h>