Marcelo Tosatti | 46f43c6 | 2009-06-18 11:47:27 -0300 | [diff] [blame] | 1 | #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ) |
| 2 | #define _TRACE_KVM_H |
| 3 | |
| 4 | #include <linux/tracepoint.h> |
| 5 | |
| 6 | #undef TRACE_SYSTEM |
| 7 | #define TRACE_SYSTEM kvm |
| 8 | #define TRACE_INCLUDE_PATH . |
| 9 | #define TRACE_INCLUDE_FILE trace |
| 10 | |
| 11 | /* |
| 12 | * Tracepoint for guest mode entry. |
| 13 | */ |
| 14 | TRACE_EVENT(kvm_ppc_instr, |
Alexander Graf | 346b276 | 2009-10-30 05:47:25 +0000 | [diff] [blame] | 15 | TP_PROTO(unsigned int inst, unsigned long _pc, unsigned int emulate), |
| 16 | TP_ARGS(inst, _pc, emulate), |
Marcelo Tosatti | 46f43c6 | 2009-06-18 11:47:27 -0300 | [diff] [blame] | 17 | |
| 18 | TP_STRUCT__entry( |
| 19 | __field( unsigned int, inst ) |
| 20 | __field( unsigned long, pc ) |
| 21 | __field( unsigned int, emulate ) |
| 22 | ), |
| 23 | |
| 24 | TP_fast_assign( |
| 25 | __entry->inst = inst; |
Alexander Graf | 346b276 | 2009-10-30 05:47:25 +0000 | [diff] [blame] | 26 | __entry->pc = _pc; |
Marcelo Tosatti | 46f43c6 | 2009-06-18 11:47:27 -0300 | [diff] [blame] | 27 | __entry->emulate = emulate; |
| 28 | ), |
| 29 | |
| 30 | TP_printk("inst %u pc 0x%lx emulate %u\n", |
| 31 | __entry->inst, __entry->pc, __entry->emulate) |
| 32 | ); |
| 33 | |
| 34 | TRACE_EVENT(kvm_stlb_inval, |
| 35 | TP_PROTO(unsigned int stlb_index), |
| 36 | TP_ARGS(stlb_index), |
| 37 | |
| 38 | TP_STRUCT__entry( |
| 39 | __field( unsigned int, stlb_index ) |
| 40 | ), |
| 41 | |
| 42 | TP_fast_assign( |
| 43 | __entry->stlb_index = stlb_index; |
| 44 | ), |
| 45 | |
| 46 | TP_printk("stlb_index %u", __entry->stlb_index) |
| 47 | ); |
| 48 | |
| 49 | TRACE_EVENT(kvm_stlb_write, |
| 50 | TP_PROTO(unsigned int victim, unsigned int tid, unsigned int word0, |
| 51 | unsigned int word1, unsigned int word2), |
| 52 | TP_ARGS(victim, tid, word0, word1, word2), |
| 53 | |
| 54 | TP_STRUCT__entry( |
| 55 | __field( unsigned int, victim ) |
| 56 | __field( unsigned int, tid ) |
| 57 | __field( unsigned int, word0 ) |
| 58 | __field( unsigned int, word1 ) |
| 59 | __field( unsigned int, word2 ) |
| 60 | ), |
| 61 | |
| 62 | TP_fast_assign( |
| 63 | __entry->victim = victim; |
| 64 | __entry->tid = tid; |
| 65 | __entry->word0 = word0; |
| 66 | __entry->word1 = word1; |
| 67 | __entry->word2 = word2; |
| 68 | ), |
| 69 | |
| 70 | TP_printk("victim %u tid %u w0 %u w1 %u w2 %u", |
| 71 | __entry->victim, __entry->tid, __entry->word0, |
| 72 | __entry->word1, __entry->word2) |
| 73 | ); |
| 74 | |
| 75 | TRACE_EVENT(kvm_gtlb_write, |
| 76 | TP_PROTO(unsigned int gtlb_index, unsigned int tid, unsigned int word0, |
| 77 | unsigned int word1, unsigned int word2), |
| 78 | TP_ARGS(gtlb_index, tid, word0, word1, word2), |
| 79 | |
| 80 | TP_STRUCT__entry( |
| 81 | __field( unsigned int, gtlb_index ) |
| 82 | __field( unsigned int, tid ) |
| 83 | __field( unsigned int, word0 ) |
| 84 | __field( unsigned int, word1 ) |
| 85 | __field( unsigned int, word2 ) |
| 86 | ), |
| 87 | |
| 88 | TP_fast_assign( |
| 89 | __entry->gtlb_index = gtlb_index; |
| 90 | __entry->tid = tid; |
| 91 | __entry->word0 = word0; |
| 92 | __entry->word1 = word1; |
| 93 | __entry->word2 = word2; |
| 94 | ), |
| 95 | |
| 96 | TP_printk("gtlb_index %u tid %u w0 %u w1 %u w2 %u", |
| 97 | __entry->gtlb_index, __entry->tid, __entry->word0, |
| 98 | __entry->word1, __entry->word2) |
| 99 | ); |
| 100 | |
Alexander Graf | bed1ed9 | 2010-08-02 11:06:26 +0200 | [diff] [blame] | 101 | |
| 102 | /************************************************************************* |
| 103 | * Book3S trace points * |
| 104 | *************************************************************************/ |
| 105 | |
Paul Mackerras | de56a94 | 2011-06-29 00:21:34 +0000 | [diff] [blame] | 106 | #ifdef CONFIG_KVM_BOOK3S_PR |
Alexander Graf | bed1ed9 | 2010-08-02 11:06:26 +0200 | [diff] [blame] | 107 | |
| 108 | TRACE_EVENT(kvm_book3s_exit, |
| 109 | TP_PROTO(unsigned int exit_nr, struct kvm_vcpu *vcpu), |
| 110 | TP_ARGS(exit_nr, vcpu), |
| 111 | |
| 112 | TP_STRUCT__entry( |
| 113 | __field( unsigned int, exit_nr ) |
| 114 | __field( unsigned long, pc ) |
| 115 | __field( unsigned long, msr ) |
| 116 | __field( unsigned long, dar ) |
| 117 | __field( unsigned long, srr1 ) |
| 118 | ), |
| 119 | |
| 120 | TP_fast_assign( |
| 121 | __entry->exit_nr = exit_nr; |
| 122 | __entry->pc = kvmppc_get_pc(vcpu); |
| 123 | __entry->dar = kvmppc_get_fault_dar(vcpu); |
| 124 | __entry->msr = vcpu->arch.shared->msr; |
| 125 | __entry->srr1 = to_svcpu(vcpu)->shadow_srr1; |
| 126 | ), |
| 127 | |
| 128 | TP_printk("exit=0x%x | pc=0x%lx | msr=0x%lx | dar=0x%lx | srr1=0x%lx", |
| 129 | __entry->exit_nr, __entry->pc, __entry->msr, __entry->dar, |
| 130 | __entry->srr1) |
| 131 | ); |
| 132 | |
| 133 | TRACE_EVENT(kvm_book3s_reenter, |
| 134 | TP_PROTO(int r, struct kvm_vcpu *vcpu), |
| 135 | TP_ARGS(r, vcpu), |
| 136 | |
| 137 | TP_STRUCT__entry( |
| 138 | __field( unsigned int, r ) |
| 139 | __field( unsigned long, pc ) |
| 140 | ), |
| 141 | |
| 142 | TP_fast_assign( |
| 143 | __entry->r = r; |
| 144 | __entry->pc = kvmppc_get_pc(vcpu); |
| 145 | ), |
| 146 | |
| 147 | TP_printk("reentry r=%d | pc=0x%lx", __entry->r, __entry->pc) |
| 148 | ); |
| 149 | |
Alexander Graf | 82fdee7 | 2010-08-02 11:38:54 +0200 | [diff] [blame] | 150 | #ifdef CONFIG_PPC_BOOK3S_64 |
| 151 | |
| 152 | TRACE_EVENT(kvm_book3s_64_mmu_map, |
| 153 | TP_PROTO(int rflags, ulong hpteg, ulong va, pfn_t hpaddr, |
| 154 | struct kvmppc_pte *orig_pte), |
| 155 | TP_ARGS(rflags, hpteg, va, hpaddr, orig_pte), |
| 156 | |
| 157 | TP_STRUCT__entry( |
| 158 | __field( unsigned char, flag_w ) |
| 159 | __field( unsigned char, flag_x ) |
| 160 | __field( unsigned long, eaddr ) |
| 161 | __field( unsigned long, hpteg ) |
| 162 | __field( unsigned long, va ) |
| 163 | __field( unsigned long long, vpage ) |
| 164 | __field( unsigned long, hpaddr ) |
| 165 | ), |
| 166 | |
| 167 | TP_fast_assign( |
| 168 | __entry->flag_w = ((rflags & HPTE_R_PP) == 3) ? '-' : 'w'; |
| 169 | __entry->flag_x = (rflags & HPTE_R_N) ? '-' : 'x'; |
| 170 | __entry->eaddr = orig_pte->eaddr; |
| 171 | __entry->hpteg = hpteg; |
| 172 | __entry->va = va; |
| 173 | __entry->vpage = orig_pte->vpage; |
| 174 | __entry->hpaddr = hpaddr; |
| 175 | ), |
| 176 | |
| 177 | TP_printk("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx", |
| 178 | __entry->flag_w, __entry->flag_x, __entry->eaddr, |
| 179 | __entry->hpteg, __entry->va, __entry->vpage, __entry->hpaddr) |
| 180 | ); |
| 181 | |
| 182 | #endif /* CONFIG_PPC_BOOK3S_64 */ |
| 183 | |
Alexander Graf | 4c4eea7 | 2010-08-02 12:51:07 +0200 | [diff] [blame] | 184 | TRACE_EVENT(kvm_book3s_mmu_map, |
| 185 | TP_PROTO(struct hpte_cache *pte), |
| 186 | TP_ARGS(pte), |
| 187 | |
| 188 | TP_STRUCT__entry( |
| 189 | __field( u64, host_va ) |
| 190 | __field( u64, pfn ) |
| 191 | __field( ulong, eaddr ) |
| 192 | __field( u64, vpage ) |
| 193 | __field( ulong, raddr ) |
| 194 | __field( int, flags ) |
| 195 | ), |
| 196 | |
| 197 | TP_fast_assign( |
| 198 | __entry->host_va = pte->host_va; |
| 199 | __entry->pfn = pte->pfn; |
| 200 | __entry->eaddr = pte->pte.eaddr; |
| 201 | __entry->vpage = pte->pte.vpage; |
| 202 | __entry->raddr = pte->pte.raddr; |
| 203 | __entry->flags = (pte->pte.may_read ? 0x4 : 0) | |
| 204 | (pte->pte.may_write ? 0x2 : 0) | |
| 205 | (pte->pte.may_execute ? 0x1 : 0); |
| 206 | ), |
| 207 | |
| 208 | TP_printk("Map: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]", |
| 209 | __entry->host_va, __entry->pfn, __entry->eaddr, |
| 210 | __entry->vpage, __entry->raddr, __entry->flags) |
| 211 | ); |
| 212 | |
Alexander Graf | 8696ee4 | 2010-08-02 12:55:19 +0200 | [diff] [blame] | 213 | TRACE_EVENT(kvm_book3s_mmu_invalidate, |
| 214 | TP_PROTO(struct hpte_cache *pte), |
| 215 | TP_ARGS(pte), |
| 216 | |
| 217 | TP_STRUCT__entry( |
| 218 | __field( u64, host_va ) |
| 219 | __field( u64, pfn ) |
| 220 | __field( ulong, eaddr ) |
| 221 | __field( u64, vpage ) |
| 222 | __field( ulong, raddr ) |
| 223 | __field( int, flags ) |
| 224 | ), |
| 225 | |
| 226 | TP_fast_assign( |
| 227 | __entry->host_va = pte->host_va; |
| 228 | __entry->pfn = pte->pfn; |
| 229 | __entry->eaddr = pte->pte.eaddr; |
| 230 | __entry->vpage = pte->pte.vpage; |
| 231 | __entry->raddr = pte->pte.raddr; |
| 232 | __entry->flags = (pte->pte.may_read ? 0x4 : 0) | |
| 233 | (pte->pte.may_write ? 0x2 : 0) | |
| 234 | (pte->pte.may_execute ? 0x1 : 0); |
| 235 | ), |
| 236 | |
| 237 | TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]", |
| 238 | __entry->host_va, __entry->pfn, __entry->eaddr, |
| 239 | __entry->vpage, __entry->raddr, __entry->flags) |
| 240 | ); |
| 241 | |
Alexander Graf | c60b4cf | 2010-08-02 13:40:30 +0200 | [diff] [blame] | 242 | TRACE_EVENT(kvm_book3s_mmu_flush, |
| 243 | TP_PROTO(const char *type, struct kvm_vcpu *vcpu, unsigned long long p1, |
| 244 | unsigned long long p2), |
| 245 | TP_ARGS(type, vcpu, p1, p2), |
| 246 | |
| 247 | TP_STRUCT__entry( |
| 248 | __field( int, count ) |
| 249 | __field( unsigned long long, p1 ) |
| 250 | __field( unsigned long long, p2 ) |
| 251 | __field( const char *, type ) |
| 252 | ), |
| 253 | |
| 254 | TP_fast_assign( |
Paul Mackerras | c4befc5 | 2011-06-29 00:17:33 +0000 | [diff] [blame] | 255 | __entry->count = to_book3s(vcpu)->hpte_cache_count; |
Alexander Graf | c60b4cf | 2010-08-02 13:40:30 +0200 | [diff] [blame] | 256 | __entry->p1 = p1; |
| 257 | __entry->p2 = p2; |
| 258 | __entry->type = type; |
| 259 | ), |
| 260 | |
| 261 | TP_printk("Flush %d %sPTEs: %llx - %llx", |
| 262 | __entry->count, __entry->type, __entry->p1, __entry->p2) |
| 263 | ); |
| 264 | |
Alexander Graf | 928d78b | 2010-08-02 21:25:33 +0200 | [diff] [blame] | 265 | TRACE_EVENT(kvm_book3s_slb_found, |
| 266 | TP_PROTO(unsigned long long gvsid, unsigned long long hvsid), |
| 267 | TP_ARGS(gvsid, hvsid), |
| 268 | |
| 269 | TP_STRUCT__entry( |
| 270 | __field( unsigned long long, gvsid ) |
| 271 | __field( unsigned long long, hvsid ) |
| 272 | ), |
| 273 | |
| 274 | TP_fast_assign( |
| 275 | __entry->gvsid = gvsid; |
| 276 | __entry->hvsid = hvsid; |
| 277 | ), |
| 278 | |
| 279 | TP_printk("%llx -> %llx", __entry->gvsid, __entry->hvsid) |
| 280 | ); |
| 281 | |
| 282 | TRACE_EVENT(kvm_book3s_slb_fail, |
| 283 | TP_PROTO(u16 sid_map_mask, unsigned long long gvsid), |
| 284 | TP_ARGS(sid_map_mask, gvsid), |
| 285 | |
| 286 | TP_STRUCT__entry( |
| 287 | __field( unsigned short, sid_map_mask ) |
| 288 | __field( unsigned long long, gvsid ) |
| 289 | ), |
| 290 | |
| 291 | TP_fast_assign( |
| 292 | __entry->sid_map_mask = sid_map_mask; |
| 293 | __entry->gvsid = gvsid; |
| 294 | ), |
| 295 | |
| 296 | TP_printk("%x/%x: %llx", __entry->sid_map_mask, |
| 297 | SID_MAP_MASK - __entry->sid_map_mask, __entry->gvsid) |
| 298 | ); |
| 299 | |
| 300 | TRACE_EVENT(kvm_book3s_slb_map, |
| 301 | TP_PROTO(u16 sid_map_mask, unsigned long long gvsid, |
| 302 | unsigned long long hvsid), |
| 303 | TP_ARGS(sid_map_mask, gvsid, hvsid), |
| 304 | |
| 305 | TP_STRUCT__entry( |
| 306 | __field( unsigned short, sid_map_mask ) |
| 307 | __field( unsigned long long, guest_vsid ) |
| 308 | __field( unsigned long long, host_vsid ) |
| 309 | ), |
| 310 | |
| 311 | TP_fast_assign( |
| 312 | __entry->sid_map_mask = sid_map_mask; |
| 313 | __entry->guest_vsid = gvsid; |
| 314 | __entry->host_vsid = hvsid; |
| 315 | ), |
| 316 | |
| 317 | TP_printk("%x: %llx -> %llx", __entry->sid_map_mask, |
| 318 | __entry->guest_vsid, __entry->host_vsid) |
| 319 | ); |
| 320 | |
| 321 | TRACE_EVENT(kvm_book3s_slbmte, |
| 322 | TP_PROTO(u64 slb_vsid, u64 slb_esid), |
| 323 | TP_ARGS(slb_vsid, slb_esid), |
| 324 | |
| 325 | TP_STRUCT__entry( |
| 326 | __field( u64, slb_vsid ) |
| 327 | __field( u64, slb_esid ) |
| 328 | ), |
| 329 | |
| 330 | TP_fast_assign( |
| 331 | __entry->slb_vsid = slb_vsid; |
| 332 | __entry->slb_esid = slb_esid; |
| 333 | ), |
| 334 | |
| 335 | TP_printk("%llx, %llx", __entry->slb_vsid, __entry->slb_esid) |
| 336 | ); |
| 337 | |
Alexander Graf | bed1ed9 | 2010-08-02 11:06:26 +0200 | [diff] [blame] | 338 | #endif /* CONFIG_PPC_BOOK3S */ |
| 339 | |
Marcelo Tosatti | 46f43c6 | 2009-06-18 11:47:27 -0300 | [diff] [blame] | 340 | #endif /* _TRACE_KVM_H */ |
| 341 | |
| 342 | /* This part must be outside protection */ |
| 343 | #include <trace/define_trace.h> |