diff options
author | Avi Kivity <avi@redhat.com> | 2010-11-18 06:09:54 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:29:41 -0500 |
commit | 586f9607962cd982293759a4e95ff06e75be5225 (patch) | |
tree | efce3a218f0268e4a066d1621d594951d6ac569e /arch/x86/kvm | |
parent | aa17911e3c21b63e3bf94c580ed029d6dad816b4 (diff) |
KVM: Add instruction-set-specific exit qualifications to kvm_exit trace
The exit reason alone is insufficient to understand exactly why an exit
occured; add ISA-specific trace parameters for additional information.
Because fetching these parameters is expensive on vmx, and because these
parameters are fetched even if tracing is disabled, we fetch the
parameters via a callback instead of as traditional trace arguments.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/svm.c | 10 | ||||
-rw-r--r-- | arch/x86/kvm/trace.h | 8 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 8 |
3 files changed, 24 insertions, 2 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 78a23086e16d..28274cf307ba 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -2974,6 +2974,14 @@ void dump_vmcb(struct kvm_vcpu *vcpu) | |||
2974 | 2974 | ||
2975 | } | 2975 | } |
2976 | 2976 | ||
2977 | static void svm_get_exit_info(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2) | ||
2978 | { | ||
2979 | struct vmcb_control_area *control = &to_svm(vcpu)->vmcb->control; | ||
2980 | |||
2981 | *info1 = control->exit_info_1; | ||
2982 | *info2 = control->exit_info_2; | ||
2983 | } | ||
2984 | |||
2977 | static int handle_exit(struct kvm_vcpu *vcpu) | 2985 | static int handle_exit(struct kvm_vcpu *vcpu) |
2978 | { | 2986 | { |
2979 | struct vcpu_svm *svm = to_svm(vcpu); | 2987 | struct vcpu_svm *svm = to_svm(vcpu); |
@@ -3684,7 +3692,9 @@ static struct kvm_x86_ops svm_x86_ops = { | |||
3684 | .get_tdp_level = get_npt_level, | 3692 | .get_tdp_level = get_npt_level, |
3685 | .get_mt_mask = svm_get_mt_mask, | 3693 | .get_mt_mask = svm_get_mt_mask, |
3686 | 3694 | ||
3695 | .get_exit_info = svm_get_exit_info, | ||
3687 | .exit_reasons_str = svm_exit_reasons_str, | 3696 | .exit_reasons_str = svm_exit_reasons_str, |
3697 | |||
3688 | .get_lpage_level = svm_get_lpage_level, | 3698 | .get_lpage_level = svm_get_lpage_level, |
3689 | 3699 | ||
3690 | .cpuid_update = svm_cpuid_update, | 3700 | .cpuid_update = svm_cpuid_update, |
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 10610229b248..1357d7cf4ec8 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h | |||
@@ -192,18 +192,22 @@ TRACE_EVENT(kvm_exit, | |||
192 | __field( unsigned int, exit_reason ) | 192 | __field( unsigned int, exit_reason ) |
193 | __field( unsigned long, guest_rip ) | 193 | __field( unsigned long, guest_rip ) |
194 | __field( u32, isa ) | 194 | __field( u32, isa ) |
195 | __field( u64, info1 ) | ||
196 | __field( u64, info2 ) | ||
195 | ), | 197 | ), |
196 | 198 | ||
197 | TP_fast_assign( | 199 | TP_fast_assign( |
198 | __entry->exit_reason = exit_reason; | 200 | __entry->exit_reason = exit_reason; |
199 | __entry->guest_rip = kvm_rip_read(vcpu); | 201 | __entry->guest_rip = kvm_rip_read(vcpu); |
200 | __entry->isa = isa; | 202 | __entry->isa = isa; |
203 | kvm_x86_ops->get_exit_info(vcpu, &__entry->info1, | ||
204 | &__entry->info2); | ||
201 | ), | 205 | ), |
202 | 206 | ||
203 | TP_printk("reason %s rip 0x%lx", | 207 | TP_printk("reason %s rip 0x%lx info %llx %llx", |
204 | ftrace_print_symbols_seq(p, __entry->exit_reason, | 208 | ftrace_print_symbols_seq(p, __entry->exit_reason, |
205 | kvm_x86_ops->exit_reasons_str), | 209 | kvm_x86_ops->exit_reasons_str), |
206 | __entry->guest_rip) | 210 | __entry->guest_rip, __entry->info1, __entry->info2) |
207 | ); | 211 | ); |
208 | 212 | ||
209 | /* | 213 | /* |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 24959105d7fc..ab05ff68bcd7 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3690,6 +3690,12 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { | |||
3690 | static const int kvm_vmx_max_exit_handlers = | 3690 | static const int kvm_vmx_max_exit_handlers = |
3691 | ARRAY_SIZE(kvm_vmx_exit_handlers); | 3691 | ARRAY_SIZE(kvm_vmx_exit_handlers); |
3692 | 3692 | ||
3693 | static void vmx_get_exit_info(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2) | ||
3694 | { | ||
3695 | *info1 = vmcs_readl(EXIT_QUALIFICATION); | ||
3696 | *info2 = vmcs_read32(VM_EXIT_INTR_INFO); | ||
3697 | } | ||
3698 | |||
3693 | /* | 3699 | /* |
3694 | * The guest has exited. See if we can fix it or if we need userspace | 3700 | * The guest has exited. See if we can fix it or if we need userspace |
3695 | * assistance. | 3701 | * assistance. |
@@ -4334,7 +4340,9 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
4334 | .get_tdp_level = get_ept_level, | 4340 | .get_tdp_level = get_ept_level, |
4335 | .get_mt_mask = vmx_get_mt_mask, | 4341 | .get_mt_mask = vmx_get_mt_mask, |
4336 | 4342 | ||
4343 | .get_exit_info = vmx_get_exit_info, | ||
4337 | .exit_reasons_str = vmx_exit_reasons_str, | 4344 | .exit_reasons_str = vmx_exit_reasons_str, |
4345 | |||
4338 | .get_lpage_level = vmx_get_lpage_level, | 4346 | .get_lpage_level = vmx_get_lpage_level, |
4339 | 4347 | ||
4340 | .cpuid_update = vmx_cpuid_update, | 4348 | .cpuid_update = vmx_cpuid_update, |