Re: [patch 3/3] KVM: MMU: prepopulate the shadow on invlpg

Marcelo Tosatti
2008-11-02T16:09:15Z

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.