* [PATCH] Replace pending exception by PF if it happens serially.
@ 2009-06-11 8:26 Gleb Natapov
2009-06-14 11:01 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Gleb Natapov @ 2009-06-11 8:26 UTC (permalink / raw)
To: avi; +Cc: kvm
Replace previous exception with a new one in a hope that instruction
re-execution will regenerate lost exception.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 272e2e8..3150d06 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -181,16 +181,21 @@ void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long addr,
++vcpu->stat.pf_guest;
if (vcpu->arch.exception.pending) {
- if (vcpu->arch.exception.nr == PF_VECTOR) {
- printk(KERN_DEBUG "kvm: inject_page_fault:"
- " double fault 0x%lx\n", addr);
- vcpu->arch.exception.nr = DF_VECTOR;
- vcpu->arch.exception.error_code = 0;
- } else if (vcpu->arch.exception.nr == DF_VECTOR) {
+ switch(vcpu->arch.exception.nr) {
+ case DF_VECTOR:
/* triple fault -> shutdown */
set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests);
+ case PF_VECTOR:
+ vcpu->arch.exception.nr = DF_VECTOR;
+ vcpu->arch.exception.error_code = 0;
+ return;
+ default:
+ /* replace previous exception with a new one in a hope
+ that instruction re-execution will regenerate lost
+ exception */
+ vcpu->arch.exception.pending = false;
+ break;
}
- return;
}
vcpu->arch.cr2 = addr;
kvm_queue_exception_e(vcpu, PF_VECTOR, error_code);
--
Gleb.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Replace pending exception by PF if it happens serially.
2009-06-11 8:26 [PATCH] Replace pending exception by PF if it happens serially Gleb Natapov
@ 2009-06-14 11:01 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2009-06-14 11:01 UTC (permalink / raw)
To: Gleb Natapov; +Cc: kvm
Gleb Natapov wrote:
> Replace previous exception with a new one in a hope that instruction
> re-execution will regenerate lost exception.
>
>
Applied, thanks.
> + switch(vcpu->arch.exception.nr) {
> + case DF_VECTOR:
> /* triple fault -> shutdown */
> set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests);
>
Added a 'return' here. It will work without, but will raise endless
questions from people who look at the code.
> + case PF_VECTOR:
> + vcpu->arch.exception.nr = DF_VECTOR;
> + vcpu->arch.exception.error_code = 0;
> + return;
> + default:
> + /* replace previous exception with a new one in a hope
> + that instruction re-execution will regenerate lost
> + exception */
> + vcpu->arch.exception.pending = false;
> + break;
> }
> - return;
> }
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-14 11:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-11 8:26 [PATCH] Replace pending exception by PF if it happens serially Gleb Natapov
2009-06-14 11:01 ` Avi Kivity
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.