Re: [PATCH 11/13] KVM: MMU: fast path of handling guest page fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/01/2012 07:23 PM, Avi Kivity wrote:
> On 03/29/2012 11:27 AM, Xiao Guangrong wrote:
> > If the the present bit of page fault error code is set, it indicates
> > the shadow page is populated on all levels, it means what we do is only
> > modify the access bit which can be done out of mmu-lock
> >
> > The tricks in this patch is avoiding the race between fast page fault
> > path and write-protect path, write-protect path is a read-check-modify
> > path:
> > read spte, check W bit, then clear W bit. What we do is populating a
> > identification in spte, if write-protect meets it, it modify the spte
> > even if the spte is readonly. See the comment in the code to get more
> > information
> >
> > +
> > +static bool page_fault_can_be_fast(struct kvm_vcpu *vcpu, gfn_t gfn,
> > +				   u32 error_code)
> > +{
> > +	unsigned long *rmap;
> > +	bool write = error_code & PFERR_WRITE_MASK;
> > +
> > +	/*
> > +	 * #PF can be fast only if the shadow page table is present, that
> > +	 * means we just need change the access bits (e.g: R/W, U/S...)
> > +	 * which can be done out of mmu-lock.
> > +	 */
> > +	if (!(error_code & PFERR_PRESENT_MASK))
> > +		return false;
> > +
> > +	if (unlikely(vcpu->vcpu_id > max_vcpu_spte()))
> > +		return false;
> > +
> > +	rmap = gfn_to_rmap(vcpu->kvm, gfn, PT_PAGE_TABLE_LEVEL);
>
> What prevents sp->gfns from being freed while this is going on?  Did I
> miss the patch that makes mmu pages freed by rcu?  Also need barriers in
> kvm_mmu_get_page() to make sure sp->gfns is made visible before the page
> is hashed in.
>

Ah, it's call_rcu in kvm_mmu_commit_zap_page().

-- 
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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux