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