Re: [PATCH] KVM: SVM: fix random segfaults with NPT enabled

Joerg Roedel
2008-08-28T15:58:26Z

On Thu, Aug 28, 2008 at 06:29:19PM +0300, Avi Kivity wrote:
> Avi Kivity wrote:
> > Joerg Rodel wrote:
> >
> >> I did a bit meditation about the softmmu code today. In the path of the
> >> NPT fault the function kvm_mmu_free_some_pages() is called which itself
> >> calls kvm_mmu_zap_page(). There the two functions
> >> kvm_mmu_page_unlink_children() and kvm_mmu_unlink_parents() are called.
> >> They both call mmu_page_remove_parent_pte() which modifies ptes. But
> >> only the first function, kvm_mmu_page_unlink_children(), flushes remote
> >> TLBs. The function kvm_mmu_unlink_parents() does not. Is this correct?
> >>
> >>
> >>
> >
> > It isn't correct. I'll move the flush below. Good catch.
> >
> > However, I can't believe this is responsible. There is very little page
> > zapping going on with npt.
> >
> >
>
> Indeed, the mmu_shadow_zapped counter for the guest I'm testing is zero,
> so this code path was never hit.

Ok, but at least we found another missing flush :)

Joerg