[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F7DDC6C.90304@gmail.com>
Date: Fri, 06 Apr 2012 01:54:52 +0800
From: Xiao Guangrong <xiaoguangrong.eric@...il.com>
To: Avi Kivity <avi@...hat.com>
CC: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: Re: [PATCH 08/13] KVM: MMU: fask check whether page is writable
Hi Avi,
Thanks very much for your review!
Sorry for the delay reply since i was on vacation.
On 04/01/2012 11:52 PM, Avi Kivity wrote:
> On 03/29/2012 11:25 AM, Xiao Guangrong wrote:
>> Using PTE_LIST_WRITE_PROTECT bit in rmap store the write-protect status to
>> avoid unnecessary shadow page walking
>>
>> Also if no shadow page is indirect, the page is write-free
>>
>>
>> @@ -2262,6 +2291,9 @@ static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn,
>> }
>> if (need_unsync)
>> kvm_unsync_pages(vcpu, gfn);
>> +
>> + *rmap &= ~PTE_LIST_WRITE_PROTECT;
>> +
>>
>
> So what are the rules for PTE_LIST_WRITE_PROTECT? Is is a cache for the
> mmu_need_write_protect?
>
> I'd like to understand it, I guess it can be set while write protection
> is unneeded, and cleared on the next check?
>
Yes, it is used as a cache for mmu_need_write_protect.
When the gfn is protected by sync sp or read-only host page we set this bit,
and it is be cleared when the sp become unsync or host page becomes writable.
> Maybe split into two functions, one the normal mmu_need_write_protect
> (but renamed) and a new mmu_need_write_protect(), with locked and
> unlocked variants, calling the old one.
>
Okay, i will split it by introducing a new function named mmu_unsync_gfn_sp
which checks whether sp can become unsync and unsync sp if it is allowed under
the protection of mmu-lock.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists