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@xxxxxxxxxxxxxxxxxx> > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html