1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM irq_vectors
5 #if !defined(_TRACE_IRQ_VECTORS_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_IRQ_VECTORS_H
8 #include <linux/tracepoint.h>
9 #include <asm/trace/common.h>
11 #ifdef CONFIG_X86_LOCAL_APIC
13 extern int trace_resched_ipi_reg(void);
14 extern void trace_resched_ipi_unreg(void);
16 DECLARE_EVENT_CLASS(x86_irq_vector
,
23 __field( int, vector
)
27 __entry
->vector
= vector
;
30 TP_printk("vector=%d", __entry
->vector
) );
32 #define DEFINE_IRQ_VECTOR_EVENT(name) \
33 DEFINE_EVENT_FN(x86_irq_vector, name##_entry, \
34 TP_PROTO(int vector), \
35 TP_ARGS(vector), NULL, NULL); \
36 DEFINE_EVENT_FN(x86_irq_vector, name##_exit, \
37 TP_PROTO(int vector), \
38 TP_ARGS(vector), NULL, NULL);
40 #define DEFINE_RESCHED_IPI_EVENT(name) \
41 DEFINE_EVENT_FN(x86_irq_vector, name##_entry, \
42 TP_PROTO(int vector), \
44 trace_resched_ipi_reg, \
45 trace_resched_ipi_unreg); \
46 DEFINE_EVENT_FN(x86_irq_vector, name##_exit, \
47 TP_PROTO(int vector), \
49 trace_resched_ipi_reg, \
50 trace_resched_ipi_unreg);
53 * local_timer - called when entering/exiting a local timer interrupt
56 DEFINE_IRQ_VECTOR_EVENT(local_timer
);
59 * spurious_apic - called when entering/exiting a spurious apic vector handler
61 DEFINE_IRQ_VECTOR_EVENT(spurious_apic
);
64 * error_apic - called when entering/exiting an error apic vector handler
66 DEFINE_IRQ_VECTOR_EVENT(error_apic
);
69 * x86_platform_ipi - called when entering/exiting a x86 platform ipi interrupt
72 DEFINE_IRQ_VECTOR_EVENT(x86_platform_ipi
);
74 #ifdef CONFIG_IRQ_WORK
76 * irq_work - called when entering/exiting a irq work interrupt
79 DEFINE_IRQ_VECTOR_EVENT(irq_work
);
82 * We must dis-allow sampling irq_work_exit() because perf event sampling
83 * itself can cause irq_work, which would lead to an infinite loop;
85 * 1) irq_work_exit happens
86 * 2) generates perf sample
87 * 3) generates irq_work
90 TRACE_EVENT_PERF_PERM(irq_work_exit
, is_sampling_event(p_event
) ? -EPERM
: 0);
94 * The ifdef is required because that tracepoint macro hell emits tracepoint
95 * code in files which include this header even if the tracepoint is not
96 * enabled. Brilliant stuff that.
100 * reschedule - called when entering/exiting a reschedule vector handler
102 DEFINE_RESCHED_IPI_EVENT(reschedule
);
105 * call_function - called when entering/exiting a call function interrupt
108 DEFINE_IRQ_VECTOR_EVENT(call_function
);
111 * call_function_single - called when entering/exiting a call function
112 * single interrupt vector handler
114 DEFINE_IRQ_VECTOR_EVENT(call_function_single
);
117 #ifdef CONFIG_X86_MCE_THRESHOLD
119 * threshold_apic - called when entering/exiting a threshold apic interrupt
122 DEFINE_IRQ_VECTOR_EVENT(threshold_apic
);
125 #ifdef CONFIG_X86_MCE_AMD
127 * deferred_error_apic - called when entering/exiting a deferred apic interrupt
130 DEFINE_IRQ_VECTOR_EVENT(deferred_error_apic
);
133 #ifdef CONFIG_X86_THERMAL_VECTOR
135 * thermal_apic - called when entering/exiting a thermal apic interrupt
138 DEFINE_IRQ_VECTOR_EVENT(thermal_apic
);
141 TRACE_EVENT(vector_config
,
143 TP_PROTO(unsigned int irq
, unsigned int vector
,
144 unsigned int cpu
, unsigned int apicdest
),
146 TP_ARGS(irq
, vector
, cpu
, apicdest
),
149 __field( unsigned int, irq
)
150 __field( unsigned int, vector
)
151 __field( unsigned int, cpu
)
152 __field( unsigned int, apicdest
)
157 __entry
->vector
= vector
;
159 __entry
->apicdest
= apicdest
;
162 TP_printk("irq=%u vector=%u cpu=%u apicdest=0x%08x",
163 __entry
->irq
, __entry
->vector
, __entry
->cpu
,
167 DECLARE_EVENT_CLASS(vector_mod
,
169 TP_PROTO(unsigned int irq
, unsigned int vector
,
170 unsigned int cpu
, unsigned int prev_vector
,
171 unsigned int prev_cpu
),
173 TP_ARGS(irq
, vector
, cpu
, prev_vector
, prev_cpu
),
176 __field( unsigned int, irq
)
177 __field( unsigned int, vector
)
178 __field( unsigned int, cpu
)
179 __field( unsigned int, prev_vector
)
180 __field( unsigned int, prev_cpu
)
185 __entry
->vector
= vector
;
187 __entry
->prev_vector
= prev_vector
;
188 __entry
->prev_cpu
= prev_cpu
;
192 TP_printk("irq=%u vector=%u cpu=%u prev_vector=%u prev_cpu=%u",
193 __entry
->irq
, __entry
->vector
, __entry
->cpu
,
194 __entry
->prev_vector
, __entry
->prev_cpu
)
197 #define DEFINE_IRQ_VECTOR_MOD_EVENT(name) \
198 DEFINE_EVENT_FN(vector_mod, name, \
199 TP_PROTO(unsigned int irq, unsigned int vector, \
200 unsigned int cpu, unsigned int prev_vector, \
201 unsigned int prev_cpu), \
202 TP_ARGS(irq, vector, cpu, prev_vector, prev_cpu), NULL, NULL); \
204 DEFINE_IRQ_VECTOR_MOD_EVENT(vector_update);
205 DEFINE_IRQ_VECTOR_MOD_EVENT(vector_clear
);
207 DECLARE_EVENT_CLASS(vector_reserve
,
209 TP_PROTO(unsigned int irq
, int ret
),
214 __field( unsigned int, irq
)
223 TP_printk("irq=%u ret=%d", __entry
->irq
, __entry
->ret
)
226 #define DEFINE_IRQ_VECTOR_RESERVE_EVENT(name) \
227 DEFINE_EVENT_FN(vector_reserve, name, \
228 TP_PROTO(unsigned int irq, int ret), \
229 TP_ARGS(irq, ret), NULL, NULL); \
231 DEFINE_IRQ_VECTOR_RESERVE_EVENT(vector_reserve_managed);
232 DEFINE_IRQ_VECTOR_RESERVE_EVENT(vector_reserve
);
234 TRACE_EVENT(vector_alloc
,
236 TP_PROTO(unsigned int irq
, unsigned int vector
, bool reserved
,
239 TP_ARGS(irq
, vector
, reserved
, ret
),
242 __field( unsigned int, irq
)
243 __field( unsigned int, vector
)
244 __field( bool, reserved
)
250 __entry
->vector
= ret
< 0 ? 0 : vector
;
251 __entry
->reserved
= reserved
;
252 __entry
->ret
= ret
> 0 ? 0 : ret
;
255 TP_printk("irq=%u vector=%u reserved=%d ret=%d",
256 __entry
->irq
, __entry
->vector
,
257 __entry
->reserved
, __entry
->ret
)
260 TRACE_EVENT(vector_alloc_managed
,
262 TP_PROTO(unsigned int irq
, unsigned int vector
,
265 TP_ARGS(irq
, vector
, ret
),
268 __field( unsigned int, irq
)
269 __field( unsigned int, vector
)
275 __entry
->vector
= ret
< 0 ? 0 : vector
;
276 __entry
->ret
= ret
> 0 ? 0 : ret
;
279 TP_printk("irq=%u vector=%u ret=%d",
280 __entry
->irq
, __entry
->vector
, __entry
->ret
)
283 DECLARE_EVENT_CLASS(vector_activate
,
285 TP_PROTO(unsigned int irq
, bool is_managed
, bool can_reserve
,
288 TP_ARGS(irq
, is_managed
, can_reserve
, reserve
),
291 __field( unsigned int, irq
)
292 __field( bool, is_managed
)
293 __field( bool, can_reserve
)
294 __field( bool, reserve
)
299 __entry
->is_managed
= is_managed
;
300 __entry
->can_reserve
= can_reserve
;
301 __entry
->reserve
= reserve
;
304 TP_printk("irq=%u is_managed=%d can_reserve=%d reserve=%d",
305 __entry
->irq
, __entry
->is_managed
, __entry
->can_reserve
,
309 #define DEFINE_IRQ_VECTOR_ACTIVATE_EVENT(name) \
310 DEFINE_EVENT_FN(vector_activate, name, \
311 TP_PROTO(unsigned int irq, bool is_managed, \
312 bool can_reserve, bool reserve), \
313 TP_ARGS(irq, is_managed, can_reserve, reserve), NULL, NULL); \
315 DEFINE_IRQ_VECTOR_ACTIVATE_EVENT(vector_activate);
316 DEFINE_IRQ_VECTOR_ACTIVATE_EVENT(vector_deactivate
);
318 TRACE_EVENT(vector_teardown
,
320 TP_PROTO(unsigned int irq
, bool is_managed
, bool has_reserved
),
322 TP_ARGS(irq
, is_managed
, has_reserved
),
325 __field( unsigned int, irq
)
326 __field( bool, is_managed
)
327 __field( bool, has_reserved
)
332 __entry
->is_managed
= is_managed
;
333 __entry
->has_reserved
= has_reserved
;
336 TP_printk("irq=%u is_managed=%d has_reserved=%d",
337 __entry
->irq
, __entry
->is_managed
, __entry
->has_reserved
)
340 TRACE_EVENT(vector_setup
,
342 TP_PROTO(unsigned int irq
, bool is_legacy
, int ret
),
344 TP_ARGS(irq
, is_legacy
, ret
),
347 __field( unsigned int, irq
)
348 __field( bool, is_legacy
)
354 __entry
->is_legacy
= is_legacy
;
358 TP_printk("irq=%u is_legacy=%d ret=%d",
359 __entry
->irq
, __entry
->is_legacy
, __entry
->ret
)
362 TRACE_EVENT(vector_free_moved
,
364 TP_PROTO(unsigned int irq
, unsigned int cpu
, unsigned int vector
,
367 TP_ARGS(irq
, cpu
, vector
, is_managed
),
370 __field( unsigned int, irq
)
371 __field( unsigned int, cpu
)
372 __field( unsigned int, vector
)
373 __field( bool, is_managed
)
379 __entry
->vector
= vector
;
380 __entry
->is_managed
= is_managed
;
383 TP_printk("irq=%u cpu=%u vector=%u is_managed=%d",
384 __entry
->irq
, __entry
->cpu
, __entry
->vector
,
389 #endif /* CONFIG_X86_LOCAL_APIC */
391 #undef TRACE_INCLUDE_PATH
392 #define TRACE_INCLUDE_PATH .
393 #define TRACE_INCLUDE_FILE irq_vectors
394 #endif /* _TRACE_IRQ_VECTORS_H */
396 /* This part must be outside protection */
397 #include <trace/define_trace.h>