lkml.org 
[lkml]   [2012]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 11/13] KVM: MMU: fast path of handling guest page fault
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



\
 
 \ /
  Last update: 2012-04-03 15:07    [W:0.072 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site