trace_pr.h 6.4 KB

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