xref: /linux/include/trace/events/tlb.h (revision c31f4aa8fed048fa70e742c4bb49bb48dc489ab3)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM tlb
4 
5 #if !defined(_TRACE_TLB_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_TLB_H
7 
8 #include <linux/mm_types.h>
9 #include <linux/tracepoint.h>
10 
11 #define TLB_FLUSH_REASON						\
12 	EM(  TLB_FLUSH_ON_TASK_SWITCH,	"flush on task switch" )	\
13 	EM(  TLB_REMOTE_SHOOTDOWN,	"remote shootdown" )		\
14 	EM(  TLB_LOCAL_SHOOTDOWN,	"local shootdown" )		\
15 	EM(  TLB_LOCAL_MM_SHOOTDOWN,	"local MM shootdown" )		\
16 	EM(  TLB_REMOTE_SEND_IPI,	"remote IPI send" )		\
17 	EMe( TLB_REMOTE_WRONG_CPU,	"remote wrong CPU" )
18 
19 /*
20  * First define the enums in TLB_FLUSH_REASON to be exported to userspace
21  * via TRACE_DEFINE_ENUM().
22  */
23 #undef EM
24 #undef EMe
25 #define EM(a,b)		TRACE_DEFINE_ENUM(a);
26 #define EMe(a,b)	TRACE_DEFINE_ENUM(a);
27 
28 TLB_FLUSH_REASON
29 
30 /*
31  * Now redefine the EM() and EMe() macros to map the enums to the strings
32  * that will be printed in the output.
33  */
34 #undef EM
35 #undef EMe
36 #define EM(a,b)		{ a, b },
37 #define EMe(a,b)	{ a, b }
38 
39 TRACE_EVENT(tlb_flush,
40 
41 	TP_PROTO(int reason, unsigned long pages),
42 	TP_ARGS(reason, pages),
43 
44 	TP_STRUCT__entry(
45 		__field(	  int, reason)
46 		__field(unsigned long,  pages)
47 	),
48 
49 	TP_fast_assign(
50 		__entry->reason = reason;
51 		__entry->pages  = pages;
52 	),
53 
54 	TP_printk("pages:%ld reason:%s (%d)",
55 		__entry->pages,
56 		__print_symbolic(__entry->reason, TLB_FLUSH_REASON),
57 		__entry->reason)
58 );
59 
60 #endif /* _TRACE_TLB_H */
61 
62 /* This part must be outside protection */
63 #include <trace/define_trace.h>
64