Re: [patch 02/10] KVM: MMU: move local TLB flush to mmu_set_spte

Avi Kivity
2008-09-20T00:21:08Z

Marcelo Tosatti wrote:
> Since the sync page path can collapse flushes.
>
> Also only flush if the spte was writable before.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> @@ -1241,9 +1239,12 @@ static void mmu_set_spte(struct kvm_vcpu
> }
> }
> if (set_spte(vcpu, shadow_pte, pte_access, user_fault, write_fault,
> - dirty, largepage, gfn, pfn, speculative))
> + dirty, largepage, gfn, pfn, speculative)) {
> if (write_fault)
> *ptwrite = 1;
> + if (was_writeble)
> + kvm_x86_ops->tlb_flush(vcpu);
> + }
>
>

I think we had cases where the spte.pfn contents changed, for example
when a large page was replaced by a normal page, and also:

} else if (pfn != spte_to_pfn(*shadow_pte)) {

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.