Messages in this thread | | | Date | Sun, 01 Apr 2012 18:53:10 +0300 | From | Avi Kivity <> | Subject | Re: [PATCH 09/13] KVM: MMU: get expected spte out of mmu-lock |
| |
On 03/29/2012 11:25 AM, Xiao Guangrong wrote: > It depends on PTE_LIST_WRITE_PROTECT bit in rmap which let us quickly know > whether the page is writable out of mmu-lock > > Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> > --- > arch/x86/kvm/mmu.c | 17 +++++++++++++---- > arch/x86/kvm/paging_tmpl.h | 2 +- > 2 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > index 3887a07..c029185 100644 > --- a/arch/x86/kvm/mmu.c > +++ b/arch/x86/kvm/mmu.c > @@ -1148,6 +1148,12 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn) > > *rmapp |= PTE_LIST_WRITE_PROTECT; > > + /* > + * Setting PTE_LIST_WRITE_PROTECT bit before doing page > + * write-protect. > + */ > + smp_mb(); > +
wmb only needed.
Would it be better to store this bit in all the sptes instead? We're touching them in any case. More work to clear them, but un-write-protecting a page is beneficial anyway as it can save a fault.
-- error compiling committee.c: too many arguments to function
| |