diff options
author | Avi Kivity <avi@redhat.com> | 2009-07-01 09:01:02 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 01:33:07 -0400 |
commit | aec51dc4f1584018d7e35269e04e3dde3d2033e6 (patch) | |
tree | 8423d4680a2db4417fd99ccfffc935f8650230e1 | |
parent | c323c0e5f06150cc000e09e8e3b22356099e7bde (diff) |
KVM: Trace mmio
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/x86.c | 11 | ||||
-rw-r--r-- | include/trace/events/kvm.h | 33 |
2 files changed, 43 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index af40e23df251..d32e3c6d3175 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <linux/iommu.h> | 37 | #include <linux/iommu.h> |
38 | #include <linux/intel-iommu.h> | 38 | #include <linux/intel-iommu.h> |
39 | #include <linux/cpufreq.h> | 39 | #include <linux/cpufreq.h> |
40 | #include <trace/events/kvm.h> | ||
41 | #undef TRACE_INCLUDE_FILE | ||
40 | #define CREATE_TRACE_POINTS | 42 | #define CREATE_TRACE_POINTS |
41 | #include "trace.h" | 43 | #include "trace.h" |
42 | 44 | ||
@@ -2425,6 +2427,8 @@ static int emulator_read_emulated(unsigned long addr, | |||
2425 | 2427 | ||
2426 | if (vcpu->mmio_read_completed) { | 2428 | if (vcpu->mmio_read_completed) { |
2427 | memcpy(val, vcpu->mmio_data, bytes); | 2429 | memcpy(val, vcpu->mmio_data, bytes); |
2430 | trace_kvm_mmio(KVM_TRACE_MMIO_READ, bytes, | ||
2431 | vcpu->mmio_phys_addr, *(u64 *)val); | ||
2428 | vcpu->mmio_read_completed = 0; | 2432 | vcpu->mmio_read_completed = 0; |
2429 | return X86EMUL_CONTINUE; | 2433 | return X86EMUL_CONTINUE; |
2430 | } | 2434 | } |
@@ -2445,8 +2449,12 @@ mmio: | |||
2445 | /* | 2449 | /* |
2446 | * Is this MMIO handled locally? | 2450 | * Is this MMIO handled locally? |
2447 | */ | 2451 | */ |
2448 | if (!vcpu_mmio_read(vcpu, gpa, bytes, val)) | 2452 | if (!vcpu_mmio_read(vcpu, gpa, bytes, val)) { |
2453 | trace_kvm_mmio(KVM_TRACE_MMIO_READ, bytes, gpa, *(u64 *)val); | ||
2449 | return X86EMUL_CONTINUE; | 2454 | return X86EMUL_CONTINUE; |
2455 | } | ||
2456 | |||
2457 | trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, bytes, gpa, 0); | ||
2450 | 2458 | ||
2451 | vcpu->mmio_needed = 1; | 2459 | vcpu->mmio_needed = 1; |
2452 | vcpu->mmio_phys_addr = gpa; | 2460 | vcpu->mmio_phys_addr = gpa; |
@@ -2490,6 +2498,7 @@ static int emulator_write_emulated_onepage(unsigned long addr, | |||
2490 | return X86EMUL_CONTINUE; | 2498 | return X86EMUL_CONTINUE; |
2491 | 2499 | ||
2492 | mmio: | 2500 | mmio: |
2501 | trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, bytes, gpa, *(u64 *)val); | ||
2493 | /* | 2502 | /* |
2494 | * Is this MMIO handled locally? | 2503 | * Is this MMIO handled locally? |
2495 | */ | 2504 | */ |
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h index 035232dc84e0..77022af48492 100644 --- a/include/trace/events/kvm.h +++ b/include/trace/events/kvm.h | |||
@@ -56,6 +56,39 @@ TRACE_EVENT(kvm_ack_irq, | |||
56 | 56 | ||
57 | 57 | ||
58 | #endif /* defined(__KVM_HAVE_IOAPIC) */ | 58 | #endif /* defined(__KVM_HAVE_IOAPIC) */ |
59 | |||
60 | #define KVM_TRACE_MMIO_READ_UNSATISFIED 0 | ||
61 | #define KVM_TRACE_MMIO_READ 1 | ||
62 | #define KVM_TRACE_MMIO_WRITE 2 | ||
63 | |||
64 | #define kvm_trace_symbol_mmio \ | ||
65 | { KVM_TRACE_MMIO_READ_UNSATISFIED, "unsatisfied-read" }, \ | ||
66 | { KVM_TRACE_MMIO_READ, "read" }, \ | ||
67 | { KVM_TRACE_MMIO_WRITE, "write" } | ||
68 | |||
69 | TRACE_EVENT(kvm_mmio, | ||
70 | TP_PROTO(int type, int len, u64 gpa, u64 val), | ||
71 | TP_ARGS(type, len, gpa, val), | ||
72 | |||
73 | TP_STRUCT__entry( | ||
74 | __field( u32, type ) | ||
75 | __field( u32, len ) | ||
76 | __field( u64, gpa ) | ||
77 | __field( u64, val ) | ||
78 | ), | ||
79 | |||
80 | TP_fast_assign( | ||
81 | __entry->type = type; | ||
82 | __entry->len = len; | ||
83 | __entry->gpa = gpa; | ||
84 | __entry->val = val; | ||
85 | ), | ||
86 | |||
87 | TP_printk("mmio %s len %u gpa 0x%llx val 0x%llx", | ||
88 | __print_symbolic(__entry->type, kvm_trace_symbol_mmio), | ||
89 | __entry->len, __entry->gpa, __entry->val) | ||
90 | ); | ||
91 | |||
59 | #endif /* _TRACE_KVM_MAIN_H */ | 92 | #endif /* _TRACE_KVM_MAIN_H */ |
60 | 93 | ||
61 | /* This part must be outside protection */ | 94 | /* This part must be outside protection */ |