From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 3/3] KVM: MMU: prepopulate the shadow on invlpg Date: Sun, 2 Nov 2008 14:08:08 -0200 Message-ID: <20081102160808.GA24376@dmt.cnet> References: <20081025223111.498934405@localhost.localdomain> <20081025223243.946600413@localhost.localdomain> <49045906.7070305@redhat.com> <20081031194727.GD21772@dmt.cnet> <490B6359.7000307@redhat.com> <20081031223311.GA31882@dmt.cnet> <490D672E.80906@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:44258 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753615AbYKBQJP (ORCPT ); Sun, 2 Nov 2008 11:09:15 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mA2G9EMR012289 for ; Sun, 2 Nov 2008 11:09:14 -0500 Content-Disposition: inline In-Reply-To: <490D672E.80906@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Nov 02, 2008 at 10:39:10AM +0200, Avi Kivity wrote: > Marcelo Tosatti wrote: >> Err, I'm on crack. The assumption is that the common case is pte >> invalidation + invlpg: kunmap_atomic, page aging clearing the accessed >> bit, page reclaim. >> >> Linux COW will invalidate + invlpg (do_wp_page) first: >> >> entry = mk_pte(new_page, vma->vm_page_prot); >> entry = maybe_mkwrite(pte_mkdirty(entry), vma); >> /* >> * Clear the pte entry and flush it first, before >> * updating the >> * pte with the new entry. This will avoid a race >> * condition >> * seen in the presence of one thread doing SMC and >> * another >> * thread doing COW. >> */ >> ptep_clear_flush_notify(vma, address, page_table); >> >> Not sure about Windows. >> >> > > Okay, so Linux won't win on this. But is there any downside, apart from > fetching the pte and reestablishing the spte? No, the downside is fetching the pte without being able to establish a valid spte.