From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH v3 04/19] KVM: MMU: cache mmio info on page fault path Date: Wed, 06 Jul 2011 09:17:21 +0800 Message-ID: <4E13B7A1.9010504@cn.fujitsu.com> References: <4E0C3178.2080603@cn.fujitsu.com> <4E0C31EA.5070403@cn.fujitsu.com> <20110705190457.GA24417@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , LKML , KVM To: Marcelo Tosatti Return-path: In-Reply-To: <20110705190457.GA24417@amt.cnet> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 07/06/2011 03:04 AM, Marcelo Tosatti wrote: return 0; >> >> /* mmio */ >> - if (is_error_pfn(pfn)) >> - return kvm_handle_bad_page(vcpu->kvm, walker.gfn, pfn); >> + if (is_error_pfn(pfn)) { >> + unsigned access = walker.pte_access; >> + bool dirty = is_dirty_gpte(walker.ptes[walker.level - 1]); >> + >> + if (dirty) >> + access &= ~ACC_WRITE_MASK; >> + >> + return kvm_handle_bad_page(vcpu, mmu_is_nested(vcpu) ? 0 : >> + addr, access, walker.gfn, pfn); >> + } > > Don't get this... if guest pte is dirty you cache without allowing > write access? Why? > Ah, sorry, the logic should be: if pte is not diry, clear write access, will fix it. Thanks, Marcelo!