Replace pending exception by PF if it happens serially.
PATCH 1/1 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 Gleb Natapov <[email protected]>
arch/x86/kvm/x86.c +12 -7
@@ -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.
Avi Kivity
AppliedQuoted 4 lines · Gleb Natapov
Replace previous exception with a new one in a hope that instruction re-execution will regenerate lost exception.
Applied, thanks.
arch/x86/kvm/x86.c void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long addr, · line 187
Quoted 5 lines
arch/x86/kvm/x86.c +2
-0+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.
Quoted 13 lines
arch/x86/kvm/x86.c +10
-1+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 ; }
Signature · 1 line
error compiling committee.c: too many arguments to function