From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/3] KVM: VMX: Simplify pdptr and cr3 management Date: Tue, 02 Jun 2009 12:26:27 +0300 Message-ID: <4A24F043.6070109@redhat.com> References: <1243862524-22120-1-git-send-email-avi@redhat.com> <1243862524-22120-3-git-send-email-avi@redhat.com> <200906021722.44103.sheng@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, Marcelo Tosatti , Joerg Roedel To: Sheng Yang Return-path: Received: from mx2.redhat.com ([66.187.237.31]:41317 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751902AbZFBJ03 (ORCPT ); Tue, 2 Jun 2009 05:26:29 -0400 In-Reply-To: <200906021722.44103.sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Sheng Yang wrote: > On Monday 01 June 2009 21:22:02 Avi Kivity wrote: > =20 >> Instead of reading the PDPTRs from memory after every exit (which is= slow >> and wrong, as the PDPTRs are stored on the cpu), sync the PDPTRs fro= m >> memory to the VMCS before entry, and from the VMCS to memory after e= xit. >> Do the same for cr3. >> >> =20 > > Thanks for fixing! > > After review my original code, I found a potential bug. For SDM 3B ha= ve this: > > 23.3.4 Saving Non-Register State > ... > If the logical processor supports the 1-setting of the =E2=80=9Cenabl= e EPT=E2=80=9D VM- > execution control, values are saved into the four (4) PDPTE fields as= follows: > =E2=80=94 If the =E2=80=9Cenable EPT=E2=80=9D VM-execution control is= 1 and the logical processor was > using PAE paging at the time of the VM exit, the PDPTE values current= ly in use > are saved: > =E2=80=A2 The values saved into bits 11:9 of each of the fields is un= defined. > =E2=80=A2 If the value saved into one of the fields has bit 0 (presen= t) clear, the=20 > value saved into bits 63:1 of that field is undefined. That value nee= d not > correspond to the value that was loaded by VM entry or to any value t= hat > might have been loaded in VMX non-root operation. > =E2=80=A2 If the value saved into one of the fields has bit 0 (presen= t) set, the value > saved into bits 63:12 of the field is a guest-physical address. > =E2=80=94 If the =E2=80=9Cenable EPT=E2=80=9D VM-execution control is= 0 or the logical processor was=20 > not using PAE paging at the time of the VM exit, the values saved are= =20 > undefined. > > But drop the ept_load_pdptrs() when exit and add it in cr0 handling r= esult in=20 > Windows PAE guest hang on boot. I am checking it now. Any thoughts?..= =2E > =20 You mean with the new code? What version of Windows exactly? I'll check it out, though EPTs are a little hard to find here. --=20 error compiling committee.c: too many arguments to function