aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-11-17 11:44:19 -0500
committerAvi Kivity <avi@redhat.com>2011-01-12 04:29:40 -0500
commitaa17911e3c21b63e3bf94c580ed029d6dad816b4 (patch)
treedc87c69b50b65d91cb85ef85def526365a6fdc59
parentbd2b53b20fcd0d6c4c815b54e6d464e34429d3a4 (diff)
KVM: Record instruction set in kvm_exit tracepoint
exit_reason's meaning depend on the instruction set; record it so a trace taken on one machine can be interpreted on another. Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--arch/x86/kvm/svm.c2
-rw-r--r--arch/x86/kvm/trace.h9
-rw-r--r--arch/x86/kvm/vmx.c2
3 files changed, 9 insertions, 4 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 7c7f03b5f39a..78a23086e16d 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2980,7 +2980,7 @@ static int handle_exit(struct kvm_vcpu *vcpu)
2980 struct kvm_run *kvm_run = vcpu->run; 2980 struct kvm_run *kvm_run = vcpu->run;
2981 u32 exit_code = svm->vmcb->control.exit_code; 2981 u32 exit_code = svm->vmcb->control.exit_code;
2982 2982
2983 trace_kvm_exit(exit_code, vcpu); 2983 trace_kvm_exit(exit_code, vcpu, KVM_ISA_SVM);
2984 2984
2985 if (!(svm->vmcb->control.intercept_cr_write & INTERCEPT_CR0_MASK)) 2985 if (!(svm->vmcb->control.intercept_cr_write & INTERCEPT_CR0_MASK))
2986 vcpu->arch.cr0 = svm->vmcb->save.cr0; 2986 vcpu->arch.cr0 = svm->vmcb->save.cr0;
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index a6544b8e7c0f..10610229b248 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -178,21 +178,26 @@ TRACE_EVENT(kvm_apic,
178#define trace_kvm_apic_read(reg, val) trace_kvm_apic(0, reg, val) 178#define trace_kvm_apic_read(reg, val) trace_kvm_apic(0, reg, val)
179#define trace_kvm_apic_write(reg, val) trace_kvm_apic(1, reg, val) 179#define trace_kvm_apic_write(reg, val) trace_kvm_apic(1, reg, val)
180 180
181#define KVM_ISA_VMX 1
182#define KVM_ISA_SVM 2
183
181/* 184/*
182 * Tracepoint for kvm guest exit: 185 * Tracepoint for kvm guest exit:
183 */ 186 */
184TRACE_EVENT(kvm_exit, 187TRACE_EVENT(kvm_exit,
185 TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu), 188 TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa),
186 TP_ARGS(exit_reason, vcpu), 189 TP_ARGS(exit_reason, vcpu, isa),
187 190
188 TP_STRUCT__entry( 191 TP_STRUCT__entry(
189 __field( unsigned int, exit_reason ) 192 __field( unsigned int, exit_reason )
190 __field( unsigned long, guest_rip ) 193 __field( unsigned long, guest_rip )
194 __field( u32, isa )
191 ), 195 ),
192 196
193 TP_fast_assign( 197 TP_fast_assign(
194 __entry->exit_reason = exit_reason; 198 __entry->exit_reason = exit_reason;
195 __entry->guest_rip = kvm_rip_read(vcpu); 199 __entry->guest_rip = kvm_rip_read(vcpu);
200 __entry->isa = isa;
196 ), 201 ),
197 202
198 TP_printk("reason %s rip 0x%lx", 203 TP_printk("reason %s rip 0x%lx",
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 6bf807adbeba..24959105d7fc 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3700,7 +3700,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
3700 u32 exit_reason = vmx->exit_reason; 3700 u32 exit_reason = vmx->exit_reason;
3701 u32 vectoring_info = vmx->idt_vectoring_info; 3701 u32 vectoring_info = vmx->idt_vectoring_info;
3702 3702
3703 trace_kvm_exit(exit_reason, vcpu); 3703 trace_kvm_exit(exit_reason, vcpu, KVM_ISA_VMX);
3704 3704
3705 /* If guest state is invalid, start emulating */ 3705 /* If guest state is invalid, start emulating */
3706 if (vmx->emulation_required && emulate_invalid_guest_state) 3706 if (vmx->emulation_required && emulate_invalid_guest_state)