From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] do not call gva_to_gpa on physical address Date: Wed, 14 Jul 2010 18:44:15 +0300 Message-ID: <4C3DDB4F.3050208@redhat.com> References: <20100714153858.GI4689@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:22811 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753161Ab0GNPoT (ORCPT ); Wed, 14 Jul 2010 11:44:19 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6EFiICo017433 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 14 Jul 2010 11:44:18 -0400 In-Reply-To: <20100714153858.GI4689@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 > 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? -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.