Re: [patch 05/13] KVM: MMU: do not write-protect large mappings

Marcelo Tosatti
2008-09-07T20:55:38Z

On Sun, Sep 07, 2008 at 12:04:59PM +0300, Avi Kivity wrote:
> Marcelo Tosatti wrote:
>> There is not much point in write protecting large mappings. This
>> can only happen when a page is shadowed during the window between
>> is_largepage_backed and mmu_lock acquision. Zap the entry instead, so
>> the next pagefault will find a shadowed page via is_largepage_backed and
>> fallback to 4k translations.
>>
>> Simplifies out of sync shadow.
>>
>> @@ -1222,6 +1221,14 @@ static void mmu_set_spte(struct kvm_vcpu
>> if (write_fault)
>> *ptwrite = 1;
>> }
>> + /*
>> + * Do not create write protected large translations.
>> + */
>> + if (largepage && has_wrprotected_page(vcpu->kvm, gfn)) {
>> + spte = shadow_trap_nonpresent_pte;
>> + was_writeble = 0;
>> + *ptwrite = 0;
>> + }
>> }
>>
>
> Why are you clearing was_writable?

No idea. Its wrong.