msr-trace.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM msr
  3. #undef TRACE_INCLUDE_FILE
  4. #define TRACE_INCLUDE_FILE msr-trace
  5. #undef TRACE_INCLUDE_PATH
  6. #define TRACE_INCLUDE_PATH asm/
  7. #if !defined(_TRACE_MSR_H) || defined(TRACE_HEADER_MULTI_READ)
  8. #define _TRACE_MSR_H
  9. #include <linux/tracepoint.h>
  10. /*
  11. * Tracing for x86 model specific registers. Directly maps to the
  12. * RDMSR/WRMSR instructions.
  13. */
  14. DECLARE_EVENT_CLASS(msr_trace_class,
  15. TP_PROTO(unsigned msr, u64 val, int failed),
  16. TP_ARGS(msr, val, failed),
  17. TP_STRUCT__entry(
  18. __field( unsigned, msr )
  19. __field( u64, val )
  20. __field( int, failed )
  21. ),
  22. TP_fast_assign(
  23. __entry->msr = msr;
  24. __entry->val = val;
  25. __entry->failed = failed;
  26. ),
  27. TP_printk("%x, value %llx%s",
  28. __entry->msr,
  29. __entry->val,
  30. __entry->failed ? " #GP" : "")
  31. );
  32. DEFINE_EVENT(msr_trace_class, read_msr,
  33. TP_PROTO(unsigned msr, u64 val, int failed),
  34. TP_ARGS(msr, val, failed)
  35. );
  36. DEFINE_EVENT(msr_trace_class, write_msr,
  37. TP_PROTO(unsigned msr, u64 val, int failed),
  38. TP_ARGS(msr, val, failed)
  39. );
  40. DEFINE_EVENT(msr_trace_class, rdpmc,
  41. TP_PROTO(unsigned msr, u64 val, int failed),
  42. TP_ARGS(msr, val, failed)
  43. );
  44. #endif /* _TRACE_MSR_H */
  45. /* This part must be outside protection */
  46. #include <trace/define_trace.h>