xref: /openbmc/linux/include/trace/events/tlb.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2d17d8f9dSDave Hansen #undef TRACE_SYSTEM
3d17d8f9dSDave Hansen #define TRACE_SYSTEM tlb
4d17d8f9dSDave Hansen 
5d17d8f9dSDave Hansen #if !defined(_TRACE_TLB_H) || defined(TRACE_HEADER_MULTI_READ)
6d17d8f9dSDave Hansen #define _TRACE_TLB_H
7d17d8f9dSDave Hansen 
8d17d8f9dSDave Hansen #include <linux/mm_types.h>
9d17d8f9dSDave Hansen #include <linux/tracepoint.h>
10d17d8f9dSDave Hansen 
11d17d8f9dSDave Hansen #define TLB_FLUSH_REASON						\
1223b97662SSteven Rostedt (Red Hat) 	EM(  TLB_FLUSH_ON_TASK_SWITCH,	"flush on task switch" )	\
1323b97662SSteven Rostedt (Red Hat) 	EM(  TLB_REMOTE_SHOOTDOWN,	"remote shootdown" )		\
1423b97662SSteven Rostedt (Red Hat) 	EM(  TLB_LOCAL_SHOOTDOWN,	"local shootdown" )		\
155b74283aSMel Gorman 	EM(  TLB_LOCAL_MM_SHOOTDOWN,	"local mm shootdown" )		\
165b74283aSMel Gorman 	EMe( TLB_REMOTE_SEND_IPI,	"remote ipi send" )
1723b97662SSteven Rostedt (Red Hat) 
1823b97662SSteven Rostedt (Red Hat) /*
1923b97662SSteven Rostedt (Red Hat)  * First define the enums in TLB_FLUSH_REASON to be exported to userspace
2023b97662SSteven Rostedt (Red Hat)  * via TRACE_DEFINE_ENUM().
2123b97662SSteven Rostedt (Red Hat)  */
2223b97662SSteven Rostedt (Red Hat) #undef EM
2323b97662SSteven Rostedt (Red Hat) #undef EMe
2423b97662SSteven Rostedt (Red Hat) #define EM(a,b)		TRACE_DEFINE_ENUM(a);
2523b97662SSteven Rostedt (Red Hat) #define EMe(a,b)	TRACE_DEFINE_ENUM(a);
2623b97662SSteven Rostedt (Red Hat) 
2723b97662SSteven Rostedt (Red Hat) TLB_FLUSH_REASON
2823b97662SSteven Rostedt (Red Hat) 
2923b97662SSteven Rostedt (Red Hat) /*
3023b97662SSteven Rostedt (Red Hat)  * Now redefine the EM() and EMe() macros to map the enums to the strings
3123b97662SSteven Rostedt (Red Hat)  * that will be printed in the output.
3223b97662SSteven Rostedt (Red Hat)  */
3323b97662SSteven Rostedt (Red Hat) #undef EM
3423b97662SSteven Rostedt (Red Hat) #undef EMe
3523b97662SSteven Rostedt (Red Hat) #define EM(a,b)		{ a, b },
3623b97662SSteven Rostedt (Red Hat) #define EMe(a,b)	{ a, b }
37d17d8f9dSDave Hansen 
38633f6f58SSteven Rostedt (Red Hat) TRACE_EVENT(tlb_flush,
39d17d8f9dSDave Hansen 
40d17d8f9dSDave Hansen 	TP_PROTO(int reason, unsigned long pages),
41d17d8f9dSDave Hansen 	TP_ARGS(reason, pages),
42d17d8f9dSDave Hansen 
43d17d8f9dSDave Hansen 	TP_STRUCT__entry(
44d17d8f9dSDave Hansen 		__field(	  int, reason)
45d17d8f9dSDave Hansen 		__field(unsigned long,  pages)
46d17d8f9dSDave Hansen 	),
47d17d8f9dSDave Hansen 
48d17d8f9dSDave Hansen 	TP_fast_assign(
49d17d8f9dSDave Hansen 		__entry->reason = reason;
50d17d8f9dSDave Hansen 		__entry->pages  = pages;
51d17d8f9dSDave Hansen 	),
52d17d8f9dSDave Hansen 
53d17d8f9dSDave Hansen 	TP_printk("pages:%ld reason:%s (%d)",
54d17d8f9dSDave Hansen 		__entry->pages,
55d17d8f9dSDave Hansen 		__print_symbolic(__entry->reason, TLB_FLUSH_REASON),
56d17d8f9dSDave Hansen 		__entry->reason)
57d17d8f9dSDave Hansen );
58d17d8f9dSDave Hansen 
59d17d8f9dSDave Hansen #endif /* _TRACE_TLB_H */
60d17d8f9dSDave Hansen 
61d17d8f9dSDave Hansen /* This part must be outside protection */
62d17d8f9dSDave Hansen #include <trace/define_trace.h>
63