From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4) Date: Tue, 08 Dec 2009 11:36:59 +0200 Message-ID: <4B1E1E3B.3020704@redhat.com> References: <1260182832-3974-1-git-send-email-avi@redhat.com> <1260182832-3974-3-git-send-email-avi@redhat.com> <200912081557.42822.sheng@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; 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]:6927 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752233AbZLHJgy (ORCPT ); Tue, 8 Dec 2009 04:36:54 -0500 In-Reply-To: <200912081557.42822.sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/08/2009 09:57 AM, Sheng Yang wrote: > vcpu->arch.cr0 = cr0; >> - vmx_set_cr4(vcpu, vcpu->arch.cr4); >> + vmx_set_cr4(vcpu, kvm_read_cr4(vcpu)); >> } >> > Another place accessed cr4 directly, in ept_update_paging_mode_cr4() > > That one is called from vmx_set_cr4(); at that time CR4_READ_SHADOW is not up-to-date and vmx_decache_cr4_guest_bits() will actually corrupt vcpu->arch.cr4 (except it won't be called, since cr4.pae is never guest owned). But you are right, I should have placed a comment. I'll add a patch that inlines ept_update_paging_mode_cr4 into its caller so it can access the cr4 parameter directly instead of vcpu->arch.cr4. -- error compiling committee.c: too many arguments to function