Prev: apr testsuite: Spinning forever in sys_futex() [SIGSTOP does not work]
Next: kvm, faster and simpler version of get_user_page_and_protection()
From: Marcelo Tosatti on 16 Jul 2010 21:50 On Fri, Jul 16, 2010 at 10:13:04AM +0800, Lai Jiangshan wrote: > add host_writable parameter for some functions, > no functionality changed, prepare for using RO pages. > > > Signed-off-by: Lai Jiangshan <laijs(a)cn.fujitsu.com> > --- > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > index 0867ced..8ba9b0d 100644 > --- a/arch/x86/kvm/mmu.c > +++ b/arch/x86/kvm/mmu.c > @@ -1861,7 +1861,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, > unsigned pte_access, int user_fault, > int write_fault, int dirty, int level, > gfn_t gfn, pfn_t pfn, bool speculative, > - bool can_unsync, bool reset_host_protection) > + bool can_unsync, bool host_writable) > { > u64 spte; > int ret = 0; > @@ -1888,8 +1888,10 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, > spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, > kvm_is_mmio_pfn(pfn)); > > - if (reset_host_protection) > + if (host_writable) > spte |= SPTE_HOST_WRITEABLE; > + else > + pte_access &= ~ACC_WRITE_MASK; Two vcpus faulting the same address with different access type can now race: vcpu0 vcpu1 read fault write fault gfn_to_pfn readonly gfn_to_pfn write, break COW set writable spte to COWed page vcpu writes to page set spte to original page vcpu reads stale content Should not instantiate a new spte if (pfn != spte_to_pfn(*sptep)), to cause a refault. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Avi Kivity on 18 Jul 2010 10:20
On 07/16/2010 05:13 AM, Lai Jiangshan wrote: > add host_writable parameter for some functions, > no functionality changed, prepare for using RO pages. > > This simple patch really clarifies the code. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |