Hi Liu, sorry, but there was a US holiday yesterday. :) On Sunday 25 May 2008 22:32:13 Liu Yu wrote: > When guest invalidate a large tlb map, > there may be more than one corresponding shadow tlb maps > that need to be invalidated. > > Use eaddr and eend to find these shadow tlb maps. Hmm, good catch. Did you discover this through inspection, or do you have a guest that triggers this bug? I don't believe there is large page support for e500 Linux userspace (and the kernel mappings don't ever need invalidation)? > diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c > index 75dff7c..04abd83 100644 > --- a/arch/powerpc/kvm/44x_tlb.c > +++ b/arch/powerpc/kvm/44x_tlb.c > @@ -177,7 +177,8 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid, > vcpu->arch.msr & MSR_PR); > } > > -void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, u64 eaddr, u64 asid) > +void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr, > + gva_t eend, u32 asid) > { > unsigned int pid = asid & 0xff; > int i; > @@ -191,7 +192,7 @@ void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, u64 eaddr, u64 asid) > if (!get_tlb_v(stlbe)) > continue; > > - if (eaddr < get_tlb_eaddr(stlbe)) > + if (eend < get_tlb_eaddr(stlbe)) > continue; > > if (eaddr > get_tlb_end(stlbe)) > diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c > index 0000974..8c605d0 100644 > --- a/arch/powerpc/kvm/emulate.c > +++ b/arch/powerpc/kvm/emulate.c > @@ -137,7 +137,7 @@ static int kvmppc_emul_tlbwe(struct kvm_vcpu *vcpu, u32 inst) > if (tlbe->word0 & PPC44x_TLB_VALID) { > eaddr = get_tlb_eaddr(tlbe); > asid = (tlbe->word0 & PPC44x_TLB_TS) | tlbe->tid; > - kvmppc_mmu_invalidate(vcpu, eaddr, asid); > + kvmppc_mmu_invalidate(vcpu, eaddr, get_tlb_end(tlbe), asid); > } > > switch (ws) { Looks good, but do you have a testcase to verify with? -- Hollis Blanchard IBM Linux Technology Center -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html