提交 6edf14d8 编写于 作者: G Gleb Natapov 提交者: Avi Kivity

KVM: Replace pending exception by PF if it happens serially

Replace previous exception with a new one in a hope that instruction
re-execution will regenerate lost exception.
Signed-off-by: NGleb Natapov <gleb@redhat.com>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 54dee993
......@@ -181,16 +181,22 @@ 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);
return;
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册