tlb.h 1.5 KB

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