Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM irq
0004 
0005 #if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_IRQ_H
0007 
0008 #include <linux/tracepoint.h>
0009 
0010 struct irqaction;
0011 struct softirq_action;
0012 
0013 #define SOFTIRQ_NAME_LIST               \
0014              softirq_name(HI)       \
0015              softirq_name(TIMER)        \
0016              softirq_name(NET_TX)       \
0017              softirq_name(NET_RX)       \
0018              softirq_name(BLOCK)        \
0019              softirq_name(IRQ_POLL)     \
0020              softirq_name(TASKLET)      \
0021              softirq_name(SCHED)        \
0022              softirq_name(HRTIMER)      \
0023              softirq_name_end(RCU)
0024 
0025 #undef softirq_name
0026 #undef softirq_name_end
0027 
0028 #define softirq_name(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
0029 #define softirq_name_end(sirq)  TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
0030 
0031 SOFTIRQ_NAME_LIST
0032 
0033 #undef softirq_name
0034 #undef softirq_name_end
0035 
0036 #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq },
0037 #define softirq_name_end(sirq) { sirq##_SOFTIRQ, #sirq }
0038 
0039 #define show_softirq_name(val)              \
0040     __print_symbolic(val, SOFTIRQ_NAME_LIST)
0041 
0042 /**
0043  * irq_handler_entry - called immediately before the irq action handler
0044  * @irq: irq number
0045  * @action: pointer to struct irqaction
0046  *
0047  * The struct irqaction pointed to by @action contains various
0048  * information about the handler, including the device name,
0049  * @action->name, and the device id, @action->dev_id. When used in
0050  * conjunction with the irq_handler_exit tracepoint, we can figure
0051  * out irq handler latencies.
0052  */
0053 TRACE_EVENT(irq_handler_entry,
0054 
0055     TP_PROTO(int irq, struct irqaction *action),
0056 
0057     TP_ARGS(irq, action),
0058 
0059     TP_STRUCT__entry(
0060         __field(    int,    irq     )
0061         __string(   name,   action->name    )
0062     ),
0063 
0064     TP_fast_assign(
0065         __entry->irq = irq;
0066         __assign_str(name, action->name);
0067     ),
0068 
0069     TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
0070 );
0071 
0072 /**
0073  * irq_handler_exit - called immediately after the irq action handler returns
0074  * @irq: irq number
0075  * @action: pointer to struct irqaction
0076  * @ret: return value
0077  *
0078  * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
0079  * @action->handler successfully handled this irq. Otherwise, the irq might be
0080  * a shared irq line, or the irq was not handled successfully. Can be used in
0081  * conjunction with the irq_handler_entry to understand irq handler latencies.
0082  */
0083 TRACE_EVENT(irq_handler_exit,
0084 
0085     TP_PROTO(int irq, struct irqaction *action, int ret),
0086 
0087     TP_ARGS(irq, action, ret),
0088 
0089     TP_STRUCT__entry(
0090         __field(    int,    irq )
0091         __field(    int,    ret )
0092     ),
0093 
0094     TP_fast_assign(
0095         __entry->irq    = irq;
0096         __entry->ret    = ret;
0097     ),
0098 
0099     TP_printk("irq=%d ret=%s",
0100           __entry->irq, __entry->ret ? "handled" : "unhandled")
0101 );
0102 
0103 DECLARE_EVENT_CLASS(softirq,
0104 
0105     TP_PROTO(unsigned int vec_nr),
0106 
0107     TP_ARGS(vec_nr),
0108 
0109     TP_STRUCT__entry(
0110         __field(    unsigned int,   vec )
0111     ),
0112 
0113     TP_fast_assign(
0114         __entry->vec = vec_nr;
0115     ),
0116 
0117     TP_printk("vec=%u [action=%s]", __entry->vec,
0118           show_softirq_name(__entry->vec))
0119 );
0120 
0121 /**
0122  * softirq_entry - called immediately before the softirq handler
0123  * @vec_nr:  softirq vector number
0124  *
0125  * When used in combination with the softirq_exit tracepoint
0126  * we can determine the softirq handler routine.
0127  */
0128 DEFINE_EVENT(softirq, softirq_entry,
0129 
0130     TP_PROTO(unsigned int vec_nr),
0131 
0132     TP_ARGS(vec_nr)
0133 );
0134 
0135 /**
0136  * softirq_exit - called immediately after the softirq handler returns
0137  * @vec_nr:  softirq vector number
0138  *
0139  * When used in combination with the softirq_entry tracepoint
0140  * we can determine the softirq handler routine.
0141  */
0142 DEFINE_EVENT(softirq, softirq_exit,
0143 
0144     TP_PROTO(unsigned int vec_nr),
0145 
0146     TP_ARGS(vec_nr)
0147 );
0148 
0149 /**
0150  * softirq_raise - called immediately when a softirq is raised
0151  * @vec_nr:  softirq vector number
0152  *
0153  * When used in combination with the softirq_entry tracepoint
0154  * we can determine the softirq raise to run latency.
0155  */
0156 DEFINE_EVENT(softirq, softirq_raise,
0157 
0158     TP_PROTO(unsigned int vec_nr),
0159 
0160     TP_ARGS(vec_nr)
0161 );
0162 
0163 #endif /*  _TRACE_IRQ_H */
0164 
0165 /* This part must be outside protection */
0166 #include <trace/define_trace.h>