lkml.org 
[lkml]   [2010]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 17/27] KVM: MMU: Track page fault data in struct vcpu
  On 09/06/2010 06:55 PM, Joerg Roedel wrote:
> This patch introduces a struct with two new fields in
> vcpu_arch for x86:
>
> * fault.address
> * fault.error_code
>
> This will be used to correctly propagate page faults back
> into the guest when we could have either an ordinary page
> fault or a nested page fault. In the case of a nested page
> fault the fault-address is different from the original
> address that should be walked. So we need to keep track
> about the real fault-address.
>
>
>
> -static void emulate_pf(struct x86_emulate_ctxt *ctxt, unsigned long addr,
> - int err)
> +static void emulate_pf(struct x86_emulate_ctxt *ctxt)
> {
> - ctxt->cr2 = addr;
> - emulate_exception(ctxt, PF_VECTOR, err, true);
> + emulate_exception(ctxt, PF_VECTOR, 0, true);
> }

What happened to the error code?

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index b2fe9e7..38d482d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4130,7 +4130,8 @@ static void inject_emulated_exception(struct kvm_vcpu *vcpu)
> {
> struct x86_emulate_ctxt *ctxt =&vcpu->arch.emulate_ctxt;
> if (ctxt->exception == PF_VECTOR)
> - kvm_inject_page_fault(vcpu, ctxt->cr2, ctxt->error_code);
> + kvm_inject_page_fault(vcpu, vcpu->arch.fault.address,
> + vcpu->arch.fault.error_code);
> else if (ctxt->error_code_valid)
> kvm_queue_exception_e(vcpu, ctxt->exception, ctxt->error_code);
> else

Ah. Not lovely, but it was ugly before as well.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.



\
 
 \ /
  Last update: 2010-09-06 20:21    [W:0.175 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site