From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH v3 03/15] KVM: MMU: flush tlb if the spte can be locklessly modified Date: Tue, 12 Nov 2013 22:10:30 -0200 Message-ID: <20131113001030.GB14651@amt.cnet> References: <1382534973-13197-1-git-send-email-xiaoguangrong@linux.vnet.ibm.com> <1382534973-13197-4-git-send-email-xiaoguangrong@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: gleb@redhat.com, avi.kivity@gmail.com, pbonzini@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org To: Xiao Guangrong Return-path: Received: from mx1.redhat.com ([209.132.183.28]:19099 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755454Ab3KMBar (ORCPT ); Tue, 12 Nov 2013 20:30:47 -0500 Content-Disposition: inline In-Reply-To: <1382534973-13197-4-git-send-email-xiaoguangrong@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Oct 23, 2013 at 09:29:21PM +0800, Xiao Guangrong wrote: > Relax the tlb flush condition since we will write-protect the spte out of mmu > lock. Note lockless write-protection only marks the writable spte to readonly > and the spte can be writable only if both SPTE_HOST_WRITEABLE and > SPTE_MMU_WRITEABLE are set (that are tested by spte_is_locklessly_modifiable) > > This patch is used to avoid this kind of race: > > VCPU 0 VCPU 1 > lockless wirte protection: > set spte.w = 0 > lock mmu-lock > > write protection the spte to sync shadow page, > see spte.w = 0, then without flush tlb > > unlock mmu-lock > > !!! At this point, the shadow page can still be > writable due to the corrupt tlb entry > Flush all TLB > > Signed-off-by: Xiao Guangrong Reviewed-by: Marcelo Tosatti