trace_pr.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. #if !defined(_TRACE_KVM_PR_H) || defined(TRACE_HEADER_MULTI_READ)
  2. #define _TRACE_KVM_PR_H
  3. #include <linux/tracepoint.h>
  4. #include "trace_book3s.h"
  5. #undef TRACE_SYSTEM
  6. #define TRACE_SYSTEM kvm_pr
  7. TRACE_EVENT(kvm_book3s_reenter,
  8. TP_PROTO(int r, struct kvm_vcpu *vcpu),
  9. TP_ARGS(r, vcpu),
  10. TP_STRUCT__entry(
  11. __field( unsigned int, r )
  12. __field( unsigned long, pc )
  13. ),
  14. TP_fast_assign(
  15. __entry->r = r;
  16. __entry->pc = kvmppc_get_pc(vcpu);
  17. ),
  18. TP_printk("reentry r=%d | pc=0x%lx", __entry->r, __entry->pc)
  19. );
  20. #ifdef CONFIG_PPC_BOOK3S_64
  21. TRACE_EVENT(kvm_book3s_64_mmu_map,
  22. TP_PROTO(int rflags, ulong hpteg, ulong va, pfn_t hpaddr,
  23. struct kvmppc_pte *orig_pte),
  24. TP_ARGS(rflags, hpteg, va, hpaddr, orig_pte),
  25. TP_STRUCT__entry(
  26. __field( unsigned char, flag_w )
  27. __field( unsigned char, flag_x )
  28. __field( unsigned long, eaddr )
  29. __field( unsigned long, hpteg )
  30. __field( unsigned long, va )
  31. __field( unsigned long long, vpage )
  32. __field( unsigned long, hpaddr )
  33. ),
  34. TP_fast_assign(
  35. __entry->flag_w = ((rflags & HPTE_R_PP) == 3) ? '-' : 'w';
  36. __entry->flag_x = (rflags & HPTE_R_N) ? '-' : 'x';
  37. __entry->eaddr = orig_pte->eaddr;
  38. __entry->hpteg = hpteg;
  39. __entry->va = va;
  40. __entry->vpage = orig_pte->vpage;
  41. __entry->hpaddr = hpaddr;
  42. ),
  43. TP_printk("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx",
  44. __entry->flag_w, __entry->flag_x, __entry->eaddr,
  45. __entry->hpteg, __entry->va, __entry->vpage, __entry->hpaddr)
  46. );
  47. #endif /* CONFIG_PPC_BOOK3S_64 */
  48. TRACE_EVENT(kvm_book3s_mmu_map,
  49. TP_PROTO(struct hpte_cache *pte),
  50. TP_ARGS(pte),
  51. TP_STRUCT__entry(
  52. __field( u64, host_vpn )
  53. __field( u64, pfn )
  54. __field( ulong, eaddr )
  55. __field( u64, vpage )
  56. __field( ulong, raddr )
  57. __field( int, flags )
  58. ),
  59. TP_fast_assign(
  60. __entry->host_vpn = pte->host_vpn;
  61. __entry->pfn = pte->pfn;
  62. __entry->eaddr = pte->pte.eaddr;
  63. __entry->vpage = pte->pte.vpage;
  64. __entry->raddr = pte->pte.raddr;
  65. __entry->flags = (pte->pte.may_read ? 0x4 : 0) |
  66. (pte->pte.may_write ? 0x2 : 0) |
  67. (pte->pte.may_execute ? 0x1 : 0);
  68. ),
  69. TP_printk("Map: hvpn=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
  70. __entry->host_vpn, __entry->pfn, __entry->eaddr,
  71. __entry->vpage, __entry->raddr, __entry->flags)
  72. );
  73. TRACE_EVENT(kvm_book3s_mmu_invalidate,
  74. TP_PROTO(struct hpte_cache *pte),
  75. TP_ARGS(pte),
  76. TP_STRUCT__entry(
  77. __field( u64, host_vpn )
  78. __field( u64, pfn )
  79. __field( ulong, eaddr )
  80. __field( u64, vpage )
  81. __field( ulong, raddr )
  82. __field( int, flags )
  83. ),
  84. TP_fast_assign(
  85. __entry->host_vpn = pte->host_vpn;
  86. __entry->pfn = pte->pfn;
  87. __entry->eaddr = pte->pte.eaddr;
  88. __entry->vpage = pte->pte.vpage;
  89. __entry->raddr = pte->pte.raddr;
  90. __entry->flags = (pte->pte.may_read ? 0x4 : 0) |
  91. (pte->pte.may_write ? 0x2 : 0) |
  92. (pte->pte.may_execute ? 0x1 : 0);
  93. ),
  94. TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]",
  95. __entry->host_vpn, __entry->pfn, __entry->eaddr,
  96. __entry->vpage, __entry->raddr, __entry->flags)
  97. );
  98. TRACE_EVENT(kvm_book3s_mmu_flush,
  99. TP_PROTO(const char *type, struct kvm_vcpu *vcpu, unsigned long long p1,
  100. unsigned long long p2),
  101. TP_ARGS(type, vcpu, p1, p2),
  102. TP_STRUCT__entry(
  103. __field( int, count )
  104. __field( unsigned long long, p1 )
  105. __field( unsigned long long, p2 )
  106. __field( const char *, type )
  107. ),
  108. TP_fast_assign(
  109. __entry->count = to_book3s(vcpu)->hpte_cache_count;
  110. __entry->p1 = p1;
  111. __entry->p2 = p2;
  112. __entry->type = type;
  113. ),
  114. TP_printk("Flush %d %sPTEs: %llx - %llx",
  115. __entry->count, __entry->type, __entry->p1, __entry->p2)
  116. );
  117. TRACE_EVENT(kvm_book3s_slb_found,
  118. TP_PROTO(unsigned long long gvsid, unsigned long long hvsid),
  119. TP_ARGS(gvsid, hvsid),
  120. TP_STRUCT__entry(
  121. __field( unsigned long long, gvsid )
  122. __field( unsigned long long, hvsid )
  123. ),
  124. TP_fast_assign(
  125. __entry->gvsid = gvsid;
  126. __entry->hvsid = hvsid;
  127. ),
  128. TP_printk("%llx -> %llx", __entry->gvsid, __entry->hvsid)
  129. );
  130. TRACE_EVENT(kvm_book3s_slb_fail,
  131. TP_PROTO(u16 sid_map_mask, unsigned long long gvsid),
  132. TP_ARGS(sid_map_mask, gvsid),
  133. TP_STRUCT__entry(
  134. __field( unsigned short, sid_map_mask )
  135. __field( unsigned long long, gvsid )
  136. ),
  137. TP_fast_assign(
  138. __entry->sid_map_mask = sid_map_mask;
  139. __entry->gvsid = gvsid;
  140. ),
  141. TP_printk("%x/%x: %llx", __entry->sid_map_mask,
  142. SID_MAP_MASK - __entry->sid_map_mask, __entry->gvsid)
  143. );
  144. TRACE_EVENT(kvm_book3s_slb_map,
  145. TP_PROTO(u16 sid_map_mask, unsigned long long gvsid,
  146. unsigned long long hvsid),
  147. TP_ARGS(sid_map_mask, gvsid, hvsid),
  148. TP_STRUCT__entry(
  149. __field( unsigned short, sid_map_mask )
  150. __field( unsigned long long, guest_vsid )
  151. __field( unsigned long long, host_vsid )
  152. ),
  153. TP_fast_assign(
  154. __entry->sid_map_mask = sid_map_mask;
  155. __entry->guest_vsid = gvsid;
  156. __entry->host_vsid = hvsid;
  157. ),
  158. TP_printk("%x: %llx -> %llx", __entry->sid_map_mask,
  159. __entry->guest_vsid, __entry->host_vsid)
  160. );
  161. TRACE_EVENT(kvm_book3s_slbmte,
  162. TP_PROTO(u64 slb_vsid, u64 slb_esid),
  163. TP_ARGS(slb_vsid, slb_esid),
  164. TP_STRUCT__entry(
  165. __field( u64, slb_vsid )
  166. __field( u64, slb_esid )
  167. ),
  168. TP_fast_assign(
  169. __entry->slb_vsid = slb_vsid;
  170. __entry->slb_esid = slb_esid;
  171. ),
  172. TP_printk("%llx, %llx", __entry->slb_vsid, __entry->slb_esid)
  173. );
  174. TRACE_EVENT(kvm_exit,
  175. TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu),
  176. TP_ARGS(exit_nr, vcpu),
  177. TP_STRUCT__entry(
  178. __field( unsigned int, exit_nr )
  179. __field( unsigned long, pc )
  180. __field( unsigned long, msr )
  181. __field( unsigned long, dar )
  182. __field( unsigned long, srr1 )
  183. __field( unsigned long, last_inst )
  184. ),
  185. TP_fast_assign(
  186. __entry->exit_nr = exit_nr;
  187. __entry->pc = kvmppc_get_pc(vcpu);
  188. __entry->dar = kvmppc_get_fault_dar(vcpu);
  189. __entry->msr = kvmppc_get_msr(vcpu);
  190. __entry->srr1 = vcpu->arch.shadow_srr1;
  191. __entry->last_inst = vcpu->arch.last_inst;
  192. ),
  193. TP_printk("exit=%s"
  194. " | pc=0x%lx"
  195. " | msr=0x%lx"
  196. " | dar=0x%lx"
  197. " | srr1=0x%lx"
  198. " | last_inst=0x%lx"
  199. ,
  200. __print_symbolic(__entry->exit_nr, kvm_trace_symbol_exit),
  201. __entry->pc,
  202. __entry->msr,
  203. __entry->dar,
  204. __entry->srr1,
  205. __entry->last_inst
  206. )
  207. );
  208. TRACE_EVENT(kvm_unmap_hva,
  209. TP_PROTO(unsigned long hva),
  210. TP_ARGS(hva),
  211. TP_STRUCT__entry(
  212. __field( unsigned long, hva )
  213. ),
  214. TP_fast_assign(
  215. __entry->hva = hva;
  216. ),
  217. TP_printk("unmap hva 0x%lx\n", __entry->hva)
  218. );
  219. #endif /* _TRACE_KVM_H */
  220. /* This part must be outside protection */
  221. #undef TRACE_INCLUDE_PATH
  222. #undef TRACE_INCLUDE_FILE
  223. #define TRACE_INCLUDE_PATH .
  224. #define TRACE_INCLUDE_FILE trace_pr
  225. #include <trace/define_trace.h>