public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] do not call gva_to_gpa on physical address
Date: Wed, 14 Jul 2010 18:52:52 +0300	[thread overview]
Message-ID: <20100714155252.GJ4689@redhat.com> (raw)
In-Reply-To: <4C3DDB4F.3050208@redhat.com>

On Wed, Jul 14, 2010 at 06:44:15PM +0300, Avi Kivity wrote:
> On 07/14/2010 06:38 PM, Gleb Natapov wrote:
> >When tdp is enabled cr2 passed to emulator is pga not gva, so no need to
> >call gva_to_gpa on it.
> >
> >Signed-off-by: Gleb Natapov<gleb@redhat.com>
> >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> >index fb08316..721bf0a 100644
> >--- a/arch/x86/kvm/x86.c
> >+++ b/arch/x86/kvm/x86.c
> >@@ -3944,10 +3944,13 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)
> >  	if (kvm_mmu_unprotect_page_virt(vcpu, gva))
> >  		return true;
> >
> >-	gpa = kvm_mmu_gva_to_gpa_system(vcpu, gva, NULL);
> >+	if (!tdp_enabled) {
> >+		gpa = kvm_mmu_gva_to_gpa_system(vcpu, gva, NULL);
> >
> >-	if (gpa == UNMAPPED_GVA)
> >-		return true; /* let cpu generate fault */
> >+		if (gpa == UNMAPPED_GVA)
> >+			return true; /* let cpu generate fault */
> >+	} else
> >+		gpa = gva;
> >
> >  	if (!kvm_is_error_hva(gfn_to_hva(vcpu->kvm, gpa>>  PAGE_SHIFT)))
> >  		return true;
> 
> Why not
> 
>     if (tdp_enabled)
>               return false;
> 
> at the top?  Is there any reason ever to reexecute an instruction
> with tdp enabled?
> 
Can't think of one now. If in the future we will shadow some other data
structures in the guest except page tables (nested vmx/svm?) there may
be the reason.

--
			Gleb.

  reply	other threads:[~2010-07-14 15:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-14 15:38 [PATCH] do not call gva_to_gpa on physical address Gleb Natapov
2010-07-14 15:44 ` Avi Kivity
2010-07-14 15:52   ` Gleb Natapov [this message]
2010-07-14 15:55     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100714155252.GJ4689@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox