From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: VMX: Fix 32bit Windows blue screen with EPT Date: Thu, 30 Dec 2010 11:16:18 +0200 Message-ID: <4D1C4DE2.5040506@redhat.com> References: <1293698159-30452-1-git-send-email-sheng@linux.intel.com> <4D1C4970.9000409@redhat.com> <201012301709.46648.sheng@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Sheng Yang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:16588 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751105Ab0L3JQW (ORCPT ); Thu, 30 Dec 2010 04:16:22 -0500 In-Reply-To: <201012301709.46648.sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/30/2010 11:09 AM, Sheng Yang wrote: > > > > > if (!(cr0& X86_CR0_PG)) { > > > > > > /* From paging/starting to nonpaging */ > > > vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, > > > > > > @@ -1937,11 +1936,8 @@ static void ept_update_paging_mode_cr0(unsigned > > > long *hw_cr0, > > > > > > vmcs_read32(CPU_BASED_VM_EXEC_CONTROL)& > > > > > > ~(CPU_BASED_CR3_LOAD_EXITING | > > > > > > CPU_BASED_CR3_STORE_EXITING)); > > > > > > - /* Must fetch cr3 before updating cr0 */ > > > - cr3 = kvm_read_cr3(vcpu); > > > > > > vcpu->arch.cr0 = cr0; > > > vmx_set_cr4(vcpu, kvm_read_cr4(vcpu)); > > > > > > - vmx_set_cr3(vcpu, cr3); > > > > This is indeed bogus. But what ensures that we'll have the correct > > GUEST_CR3 after enabling paging? > > BTW: What did you find when you added this two lines? Don't remember... but I can't see how it works without them (though they're wrong - they set the wrong cr3 when !enable_ept). I'll do some work to disentangle this mess. ->set_cr3() means two different things, sometimes it's the guest visible cr3, sometimes it's the mmu cr3. -- error compiling committee.c: too many arguments to function