From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH 3/6] Emulator: Inject #PF when page was not found Date: Fri, 15 May 2009 15:40:00 +0200 Message-ID: <20090515133959.GW9835@amd.com> References: <1242375740-31222-1-git-send-email-agraf@suse.de> <1242375740-31222-2-git-send-email-agraf@suse.de> <1242375740-31222-3-git-send-email-agraf@suse.de> <1242375740-31222-4-git-send-email-agraf@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: Alexander Graf Return-path: Received: from tx2ehsobe003.messaging.microsoft.com ([65.55.88.13]:16314 "EHLO TX2EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750803AbZEONkv convert rfc822-to-8bit (ORCPT ); Fri, 15 May 2009 09:40:51 -0400 Content-Disposition: inline In-Reply-To: <1242375740-31222-4-git-send-email-agraf@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, May 15, 2009 at 10:22:17AM +0200, Alexander Graf wrote: > If we couldn't find a page on read_emulated, it might be a good > idea to tell the guest about that and inject a #PF. >=20 > We do the same already for write faults. I don't know why it was > not implemented for reads. Have you checked that the emulator will never ever do speculative reads= ? This may be the reason why the fault was not injected here. >=20 > Signed-off-by: Alexander Graf > --- > arch/x86/kvm/x86.c | 7 +++++-- > 1 files changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 5fcde2c..5aa1219 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -2131,10 +2131,13 @@ static int emulator_read_emulated(unsigned lo= ng addr, > goto mmio; > =20 > if (kvm_read_guest_virt(addr, val, bytes, vcpu) > - =3D=3D X86EMUL_CONTINUE) > + =3D=3D X86EMUL_CONTINUE) { > return X86EMUL_CONTINUE; > - if (gpa =3D=3D UNMAPPED_GVA) > + } > + if (gpa =3D=3D UNMAPPED_GVA) { > + kvm_inject_page_fault(vcpu, addr, 0); > return X86EMUL_PROPAGATE_FAULT; > + } > =20 > mmio: > /* > --=20 > 1.6.0.2 >=20 >=20 --=20 | Advanced Micro Devices GmbH Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei M=FCnchen System |=20 Research | Gesch=E4ftsf=FChrer: Thomas M. McCoy, Giuliano Meroni Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis M=FCnchen | Registergericht M=FCnchen, HRB Nr. 43632