From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: VMX: Add ept_sync_context in flush_tlb Date: Sun, 29 Jun 2008 13:09:20 +0300 Message-ID: <48675F50.9000905@qumranet.com> References: <200806181138.22990.sheng.yang@intel.com> <486233C9.4060906@qumranet.com> <200806260847.14386.sheng.yang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: "Yang, Sheng" Return-path: Received: from il.qumranet.com ([212.179.150.194]:40974 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbYF2KJV (ORCPT ); Sun, 29 Jun 2008 06:09:21 -0400 In-Reply-To: <200806260847.14386.sheng.yang@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Yang, Sheng wrote: > On Wednesday 25 June 2008 20:02:17 Avi Kivity wrote: > >> Yang, Sheng wrote: >> >>> From 54dc26e44f1c0aa460bef409b799f36dae56a911 Mon Sep 17 00:00:00 2001 >>> From: Sheng Yang >>> Date: Wed, 18 Jun 2008 11:23:13 +0800 >>> Subject: [PATCH] KVM: VMX: Add ept_sync_context in flush_tlb >>> >>> Fix a potention issue caused by kvm_mmu_slot_remove_write_access(). >>> The old behavior don't sync EPT TLB with modified EPT entry, which >>> result in inconsistent content of EPT TLB and EPT table. >>> >>> >>> @@ -1407,6 +1408,8 @@ static void exit_lmode(struct kvm_vcpu *vcpu) >>> static void vmx_flush_tlb(struct kvm_vcpu *vcpu) >>> { >>> vpid_sync_vcpu_all(to_vmx(vcpu)); >>> + if (vm_need_ept()) >>> + ept_sync_context(to_vmx(vcpu)); >>> } >>> >> So we're flushing both the vpid tlb and the ept context? What does an >> ept context flush mean exactly? tlb entries for gpa->hpa? >> > > Yeah, the entries for gpa->hpa. So if we don't do this, cpu may see rw entry > rather than ro, then write to it directly rather than fall into KVM. > > I see. Back to the patch, can't you replace vmx->eptp by construct_eptp(vcpu->arch.mmu.root_hpa)? -- error compiling committee.c: too many arguments to function