Re: [patch 06/10] KVM: x86: trap invlpg

Marcelo Tosatti
2008-09-21T00:45:08Z

On Fri, Sep 19, 2008 at 05:53:22PM -0700, Avi Kivity wrote:
> Marcelo Tosatti wrote:
>> +static int FNAME(shadow_invlpg_entry)(struct kvm_shadow_walk *_sw,
>> + struct kvm_vcpu *vcpu, u64 addr,
>> + u64 *sptep, int level)
>> +{
>> +
>> + if (level == PT_PAGE_TABLE_LEVEL) {
>> + if (is_shadow_present_pte(*sptep))
>> + rmap_remove(vcpu->kvm, sptep);
>> + set_shadow_pte(sptep, shadow_trap_nonpresent_pte);
>>
>
> Need to flush the real tlb as well.

The local TLB you mean?

+void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva)
+{
+ spin_lock(&vcpu->kvm->mmu_lock);
+ vcpu->arch.mmu.invlpg(vcpu, gva);
+ spin_unlock(&vcpu->kvm->mmu_lock);
+ kvm_mmu_flush_tlb(vcpu);
+}
+EXPORT_SYMBOL_GPL(kvm_mmu_invlpg);