Message ID | 4DEE20CA.90206@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 06/07/2011 03:59 PM, Xiao Guangrong wrote: > We already get the guest physical address, so use it to read guest data > directly to avoid walking guest page table again > > Signed-off-by: Xiao Guangrong<xiaoguangrong@cn.fujitsu.com> > --- > arch/x86/kvm/x86.c | 3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 694538a..8be9ff6 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -3930,8 +3930,7 @@ static int emulator_read_emulated(struct x86_emulate_ctxt *ctxt, > if ((gpa& PAGE_MASK) == APIC_DEFAULT_PHYS_BASE) > goto mmio; > > - if (kvm_read_guest_virt(ctxt, addr, val, bytes, exception) > - == X86EMUL_CONTINUE) > + if (!kvm_read_guest(vcpu->kvm, gpa, val, bytes)) > return X86EMUL_CONTINUE; This breaks is addr/bytes spans a page boundary. (the current code is also broken, but only for mmio; the new code is broken for ram as well). We need a gva_to_gpa() that returns a range of pages.
On 06/09/2011 02:59 PM, Avi Kivity wrote: > This breaks is addr/bytes spans a page boundary. > > (the current code is also broken, but only for mmio; the new code is broken for ram as well). > > We need a gva_to_gpa() that returns a range of pages. > Thanks for you point it out, will fix it in the next version. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 694538a..8be9ff6 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3930,8 +3930,7 @@ static int emulator_read_emulated(struct x86_emulate_ctxt *ctxt, if ((gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE) goto mmio; - if (kvm_read_guest_virt(ctxt, addr, val, bytes, exception) - == X86EMUL_CONTINUE) + if (!kvm_read_guest(vcpu->kvm, gpa, val, bytes)) return X86EMUL_CONTINUE; mmio:
We already get the guest physical address, so use it to read guest data directly to avoid walking guest page table again Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> --- arch/x86/kvm/x86.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)