diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/mmu.c | 9 | ||||
-rw-r--r-- | arch/x86/kvm/mmutrace.h | 24 |
2 files changed, 31 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 3e893cd90389..417f36b7c0e4 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -283,8 +283,13 @@ static bool set_mmio_spte(struct kvm *kvm, u64 *sptep, gfn_t gfn, | |||
283 | 283 | ||
284 | static bool check_mmio_spte(struct kvm *kvm, u64 spte) | 284 | static bool check_mmio_spte(struct kvm *kvm, u64 spte) |
285 | { | 285 | { |
286 | return likely(get_mmio_spte_generation(spte) == | 286 | unsigned int kvm_gen, spte_gen; |
287 | kvm_current_mmio_generation(kvm)); | 287 | |
288 | kvm_gen = kvm_current_mmio_generation(kvm); | ||
289 | spte_gen = get_mmio_spte_generation(spte); | ||
290 | |||
291 | trace_check_mmio_spte(spte, kvm_gen, spte_gen); | ||
292 | return likely(kvm_gen == spte_gen); | ||
288 | } | 293 | } |
289 | 294 | ||
290 | static inline u64 rsvd_bits(int s, int e) | 295 | static inline u64 rsvd_bits(int s, int e) |
diff --git a/arch/x86/kvm/mmutrace.h b/arch/x86/kvm/mmutrace.h index ad24757041ad..9d2e0ffcb190 100644 --- a/arch/x86/kvm/mmutrace.h +++ b/arch/x86/kvm/mmutrace.h | |||
@@ -298,6 +298,30 @@ TRACE_EVENT( | |||
298 | __entry->mmu_valid_gen, __entry->mmu_used_pages | 298 | __entry->mmu_valid_gen, __entry->mmu_used_pages |
299 | ) | 299 | ) |
300 | ); | 300 | ); |
301 | |||
302 | |||
303 | TRACE_EVENT( | ||
304 | check_mmio_spte, | ||
305 | TP_PROTO(u64 spte, unsigned int kvm_gen, unsigned int spte_gen), | ||
306 | TP_ARGS(spte, kvm_gen, spte_gen), | ||
307 | |||
308 | TP_STRUCT__entry( | ||
309 | __field(unsigned int, kvm_gen) | ||
310 | __field(unsigned int, spte_gen) | ||
311 | __field(u64, spte) | ||
312 | ), | ||
313 | |||
314 | TP_fast_assign( | ||
315 | __entry->kvm_gen = kvm_gen; | ||
316 | __entry->spte_gen = spte_gen; | ||
317 | __entry->spte = spte; | ||
318 | ), | ||
319 | |||
320 | TP_printk("spte %llx kvm_gen %x spte-gen %x valid %d", __entry->spte, | ||
321 | __entry->kvm_gen, __entry->spte_gen, | ||
322 | __entry->kvm_gen == __entry->spte_gen | ||
323 | ) | ||
324 | ); | ||
301 | #endif /* _TRACE_KVMMMU_H */ | 325 | #endif /* _TRACE_KVMMMU_H */ |
302 | 326 | ||
303 | #undef TRACE_INCLUDE_PATH | 327 | #undef TRACE_INCLUDE_PATH |