diff options
author | Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> | 2012-06-20 03:59:41 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-07-11 09:51:21 -0400 |
commit | a72faf2504dfc12ff9bfb486a42f2761296666ff (patch) | |
tree | bc8d0c376d90f06d146cb8831ef44cc0b43f66b5 | |
parent | c7ba5b48cc8ddc015a9e0463813ca1e60bc42c59 (diff) |
KVM: MMU: trace fast page fault
To see what happen on this path and help us to optimize it
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/mmu.c | 2 | ||||
-rw-r--r-- | arch/x86/kvm/mmutrace.h | 38 |
2 files changed, 40 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 8637bffbdb4a..28c8fbcc6763 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2776,6 +2776,8 @@ static bool fast_page_fault(struct kvm_vcpu *vcpu, gva_t gva, int level, | |||
2776 | */ | 2776 | */ |
2777 | ret = fast_pf_fix_direct_spte(vcpu, iterator.sptep, spte); | 2777 | ret = fast_pf_fix_direct_spte(vcpu, iterator.sptep, spte); |
2778 | exit: | 2778 | exit: |
2779 | trace_fast_page_fault(vcpu, gva, error_code, iterator.sptep, | ||
2780 | spte, ret); | ||
2779 | walk_shadow_page_lockless_end(vcpu); | 2781 | walk_shadow_page_lockless_end(vcpu); |
2780 | 2782 | ||
2781 | return ret; | 2783 | return ret; |
diff --git a/arch/x86/kvm/mmutrace.h b/arch/x86/kvm/mmutrace.h index 89fb0e81322a..c364abc8d034 100644 --- a/arch/x86/kvm/mmutrace.h +++ b/arch/x86/kvm/mmutrace.h | |||
@@ -243,6 +243,44 @@ TRACE_EVENT( | |||
243 | TP_printk("addr:%llx gfn %llx access %x", __entry->addr, __entry->gfn, | 243 | TP_printk("addr:%llx gfn %llx access %x", __entry->addr, __entry->gfn, |
244 | __entry->access) | 244 | __entry->access) |
245 | ); | 245 | ); |
246 | |||
247 | #define __spte_satisfied(__spte) \ | ||
248 | (__entry->retry && is_writable_pte(__entry->__spte)) | ||
249 | |||
250 | TRACE_EVENT( | ||
251 | fast_page_fault, | ||
252 | TP_PROTO(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code, | ||
253 | u64 *sptep, u64 old_spte, bool retry), | ||
254 | TP_ARGS(vcpu, gva, error_code, sptep, old_spte, retry), | ||
255 | |||
256 | TP_STRUCT__entry( | ||
257 | __field(int, vcpu_id) | ||
258 | __field(gva_t, gva) | ||
259 | __field(u32, error_code) | ||
260 | __field(u64 *, sptep) | ||
261 | __field(u64, old_spte) | ||
262 | __field(u64, new_spte) | ||
263 | __field(bool, retry) | ||
264 | ), | ||
265 | |||
266 | TP_fast_assign( | ||
267 | __entry->vcpu_id = vcpu->vcpu_id; | ||
268 | __entry->gva = gva; | ||
269 | __entry->error_code = error_code; | ||
270 | __entry->sptep = sptep; | ||
271 | __entry->old_spte = old_spte; | ||
272 | __entry->new_spte = *sptep; | ||
273 | __entry->retry = retry; | ||
274 | ), | ||
275 | |||
276 | TP_printk("vcpu %d gva %lx error_code %s sptep %p old %#llx" | ||
277 | " new %llx spurious %d fixed %d", __entry->vcpu_id, | ||
278 | __entry->gva, __print_flags(__entry->error_code, "|", | ||
279 | kvm_mmu_trace_pferr_flags), __entry->sptep, | ||
280 | __entry->old_spte, __entry->new_spte, | ||
281 | __spte_satisfied(old_spte), __spte_satisfied(new_spte) | ||
282 | ) | ||
283 | ); | ||
246 | #endif /* _TRACE_KVMMMU_H */ | 284 | #endif /* _TRACE_KVMMMU_H */ |
247 | 285 | ||
248 | #undef TRACE_INCLUDE_PATH | 286 | #undef TRACE_INCLUDE_PATH |