diff options
author | Avi Kivity <avi@redhat.com> | 2010-03-11 06:01:59 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-05-17 05:15:27 -0400 |
commit | 5c1c85d08da5c257b21b0423b96fa6554aa4cb6f (patch) | |
tree | 4ee236dd52b4a534e84b45894507ee3656468609 | |
parent | 5bfd8b5455e69b37af16a2df1edae2c3b567648c (diff) |
KVM: Trace exception injection
Often an exception can help point out where things start to go wrong.
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/trace.h | 32 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 3 |
2 files changed, 35 insertions, 0 deletions
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index d10b359a21f3..32c912c40bf8 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h | |||
@@ -219,6 +219,38 @@ TRACE_EVENT(kvm_inj_virq, | |||
219 | TP_printk("irq %u", __entry->irq) | 219 | TP_printk("irq %u", __entry->irq) |
220 | ); | 220 | ); |
221 | 221 | ||
222 | #define EXS(x) { x##_VECTOR, "#" #x } | ||
223 | |||
224 | #define kvm_trace_sym_exc \ | ||
225 | EXS(DE), EXS(DB), EXS(BP), EXS(OF), EXS(BR), EXS(UD), EXS(NM), \ | ||
226 | EXS(DF), EXS(TS), EXS(NP), EXS(SS), EXS(GP), EXS(PF), \ | ||
227 | EXS(MF), EXS(MC) | ||
228 | |||
229 | /* | ||
230 | * Tracepoint for kvm interrupt injection: | ||
231 | */ | ||
232 | TRACE_EVENT(kvm_inj_exception, | ||
233 | TP_PROTO(unsigned exception, bool has_error, unsigned error_code), | ||
234 | TP_ARGS(exception, has_error, error_code), | ||
235 | |||
236 | TP_STRUCT__entry( | ||
237 | __field( u8, exception ) | ||
238 | __field( u8, has_error ) | ||
239 | __field( u32, error_code ) | ||
240 | ), | ||
241 | |||
242 | TP_fast_assign( | ||
243 | __entry->exception = exception; | ||
244 | __entry->has_error = has_error; | ||
245 | __entry->error_code = error_code; | ||
246 | ), | ||
247 | |||
248 | TP_printk("%s (0x%x)", | ||
249 | __print_symbolic(__entry->exception, kvm_trace_sym_exc), | ||
250 | /* FIXME: don't print error_code if not present */ | ||
251 | __entry->has_error ? __entry->error_code : 0) | ||
252 | ); | ||
253 | |||
222 | /* | 254 | /* |
223 | * Tracepoint for page fault. | 255 | * Tracepoint for page fault. |
224 | */ | 256 | */ |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 74e70d975ffa..a1cf87fe9f3a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -4237,6 +4237,9 @@ static void inject_pending_event(struct kvm_vcpu *vcpu) | |||
4237 | { | 4237 | { |
4238 | /* try to reinject previous events if any */ | 4238 | /* try to reinject previous events if any */ |
4239 | if (vcpu->arch.exception.pending) { | 4239 | if (vcpu->arch.exception.pending) { |
4240 | trace_kvm_inj_exception(vcpu->arch.exception.nr, | ||
4241 | vcpu->arch.exception.has_error_code, | ||
4242 | vcpu->arch.exception.error_code); | ||
4240 | kvm_x86_ops->queue_exception(vcpu, vcpu->arch.exception.nr, | 4243 | kvm_x86_ops->queue_exception(vcpu, vcpu->arch.exception.nr, |
4241 | vcpu->arch.exception.has_error_code, | 4244 | vcpu->arch.exception.has_error_code, |
4242 | vcpu->arch.exception.error_code); | 4245 | vcpu->arch.exception.error_code); |