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

Avi Kivity
2008-08-28T15:29:21Z

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.

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.