Index: sys/arch/arm/arm32/pmap.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/arm32/pmap.c,v retrieving revision 1.334 diff -u -p -u -p -r1.334 pmap.c --- sys/arch/arm/arm32/pmap.c 14 Jul 2016 05:00:51 -0000 1.334 +++ sys/arch/arm/arm32/pmap.c 14 Jul 2016 15:40:24 -0000 @@ -5013,11 +5013,34 @@ pmap_update(pmap_t pm) "pmap/asid %p/%#x != %s cur pmap/asid %p/%#x", pm, pm->pm_pai[0].pai_asid, curcpu()->ci_data.cpu_name, curcpu()->ci_pmap_cur, curcpu()->ci_pmap_asid_cur); + +#ifdef MULTIPROCESSOR /* * Finish up the pmap_remove_all() optimisation by flushing * all our ASIDs. */ - pmap_tlb_asid_release_all(pm); + // This should be the last CPU with this pmap onproc + KASSERT(!kcpuset_isotherset(pm->pm_onproc, cpu_index(curcpu()))); + if (kcpuset_isset(pm->pm_onproc, cpu_index(curcpu()))) { + if (pm != pmap_kernel()) { + struct cpu_info * const ci = curcpu(); + KASSERT(!cpu_intr_p()); + /* + * The bits in pm_onproc that belong to this + * TLB can be changed while this TLBs lock is + * not held as long as we use atomic ops. + */ + kcpuset_atomic_clear(pm->pm_onproc, + cpu_index(ci)); + } + } + KASSERT(kcpuset_iszero(pm->pm_onproc)); +#endif + struct pmap_asid_info * const pai = + PMAP_PAI(pm, cpu_tlb_info(ci)); + + tlb_invalidate_asids(pai->pai_asid, pai->pai_asid); + #else /* * Finish up the pmap_remove_all() optimisation by flushing Index: sys/uvm/pmap/pmap_tlb.c =================================================================== RCS file: /cvsroot/src/sys/uvm/pmap/pmap_tlb.c,v retrieving revision 1.15 diff -u -p -u -p -r1.15 pmap_tlb.c --- sys/uvm/pmap/pmap_tlb.c 14 Jul 2016 04:51:47 -0000 1.15 +++ sys/uvm/pmap/pmap_tlb.c 14 Jul 2016 15:40:29 -0000 @@ -628,7 +628,7 @@ bool pmap_tlb_shootdown_bystanders(pmap_t pm) { /* - * We don't need to deal our own TLB. + * We don't need to deal with our own TLB. */ UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist); @@ -978,7 +978,7 @@ pmap_tlb_asid_deactivate(pmap_t pm) kcpuset_atomic_clear(pm->pm_onproc, cpu_index(ci)); } #endif - curcpu()->ci_pmap_asid_cur = 0; + curcpu()->ci_pmap_asid_cur = KERNEL_PID; UVMHIST_LOG(maphist, " <-- done (pm=%p)", pm, 0, 0, 0); tlb_set_asid(KERNEL_PID); pmap_tlb_pai_check(cpu_tlb_info(curcpu())); @@ -1030,7 +1030,7 @@ pmap_tlb_asid_release_all(struct pmap *p #endif #else /* - * Handle the case of an UP kernel which only has, at most, one ASID. + * Handle the case of an UP kernel which only has, at most, one TLB. * If the pmap has an ASID allocated, free it. */ struct pmap_tlb_info * const ti = &pmap_tlb0_info;