diff options
author | alc <alc@FreeBSD.org> | 2015-05-11 19:55:01 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2015-05-11 19:55:01 +0000 |
commit | e4e7fd4992595fb9f75f13f12fe8717d830a2e30 (patch) | |
tree | 4393a0b45cc2fdb78723fac7e946aa212aa774bb /sys/arm | |
parent | 28058b62b6ff7a26228f68ebb63918a4ff708eec (diff) | |
download | FreeBSD-src-e4e7fd4992595fb9f75f13f12fe8717d830a2e30.zip FreeBSD-src-e4e7fd4992595fb9f75f13f12fe8717d830a2e30.tar.gz |
Retire pmap_lazyfix(). This function only existed in the new armv6 pmap
because the i386 pmap on which the new armv6 pmap is based had it, and in
r281707 pmap_lazyfix() was removed from the i386 pmap.
Discussed with: kib
Submitted by: Michal Meloun (via Svatopluk Kraus)
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/mp_machdep.c | 6 | ||||
-rw-r--r-- | sys/arm/arm/pmap-v6-new.c | 101 | ||||
-rw-r--r-- | sys/arm/arm/swtch.S | 8 | ||||
-rw-r--r-- | sys/arm/include/pmap-v6.h | 1 | ||||
-rw-r--r-- | sys/arm/include/smp.h | 1 |
5 files changed, 2 insertions, 115 deletions
diff --git a/sys/arm/arm/mp_machdep.c b/sys/arm/arm/mp_machdep.c index 55ba355..c0f723c 100644 --- a/sys/arm/arm/mp_machdep.c +++ b/sys/arm/arm/mp_machdep.c @@ -309,12 +309,6 @@ ipi_handler(void *arg) CTR1(KTR_SMP, "%s: IPI_TLB", __func__); cpufuncs.cf_tlb_flushID(); break; -#ifdef ARM_NEW_PMAP - case IPI_LAZYPMAP: - CTR1(KTR_SMP, "%s: IPI_LAZYPMAP", __func__); - pmap_lazyfix_action(); - break; -#endif default: panic("Unknown IPI 0x%0x on cpu %d", ipi, curcpu); } diff --git a/sys/arm/arm/pmap-v6-new.c b/sys/arm/arm/pmap-v6-new.c index f404214..8fd6222 100644 --- a/sys/arm/arm/pmap-v6-new.c +++ b/sys/arm/arm/pmap-v6-new.c @@ -2166,104 +2166,6 @@ pmap_pinit(pmap_t pmap) return (1); } -#ifdef SMP -/* - * Deal with a SMP shootdown of other users of the pmap that we are - * trying to dispose of. This can be a bit hairy. - */ -static cpuset_t *lazymask; -static ttb_entry_t lazyttb; -static volatile u_int lazywait; - -void -pmap_lazyfix_action(void) -{ - -#ifdef COUNT_IPIS - (*ipi_lazypmap_counts[PCPU_GET(cpuid)])++; -#endif - spinlock_enter(); - if (cp15_ttbr_get() == lazyttb) { - cp15_ttbr_set(curthread->td_pcb->pcb_pagedir); - } - CPU_CLR_ATOMIC(PCPU_GET(cpuid), lazymask); - atomic_store_rel_int(&lazywait, 1); - spinlock_exit(); - -} - -static void -pmap_lazyfix_self(u_int cpuid) -{ - - spinlock_enter(); - if (cp15_ttbr_get() == lazyttb) { - cp15_ttbr_set(curthread->td_pcb->pcb_pagedir); - } - CPU_CLR_ATOMIC(cpuid, lazymask); - spinlock_exit(); -} - -static void -pmap_lazyfix(pmap_t pmap) -{ - cpuset_t mymask, mask; - u_int cpuid, spins; - int lsb; - - mask = pmap->pm_active; - while (!CPU_EMPTY(&mask)) { - spins = 50000000; - - /* Find least significant set bit. */ - lsb = CPU_FFS(&mask); - MPASS(lsb != 0); - lsb--; - CPU_SETOF(lsb, &mask); - mtx_lock_spin(&smp_ipi_mtx); - - lazyttb = pmap_ttb_get(pmap); - cpuid = PCPU_GET(cpuid); - - /* Use a cpuset just for having an easy check. */ - CPU_SETOF(cpuid, &mymask); - if (!CPU_CMP(&mask, &mymask)) { - lazymask = &pmap->pm_active; - pmap_lazyfix_self(cpuid); - } else { - atomic_store_rel_int((u_int *)&lazymask, - (u_int)&pmap->pm_active); - atomic_store_rel_int(&lazywait, 0); - ipi_selected(mask, IPI_LAZYPMAP); - while (lazywait == 0) { - if (--spins == 0) - break; - } - } - mtx_unlock_spin(&smp_ipi_mtx); - if (spins == 0) - printf("%s: spun for 50000000\n", __func__); - mask = pmap->pm_active; - } -} -#else /* SMP */ -/* - * Cleaning up on uniprocessor is easy. For various reasons, we're - * unlikely to have to even execute this code, including the fact - * that the cleanup is deferred until the parent does a wait(2), which - * means that another userland process has run. - */ -static void -pmap_lazyfix(pmap_t pmap) -{ - - if (!CPU_EMPTY(&pmap->pm_active)) { - cp15_ttbr_set(curthread->td_pcb->pcb_pagedir); - CPU_ZERO(&pmap->pm_active); - } -} -#endif /* SMP */ - #ifdef INVARIANTS static boolean_t pt2tab_user_is_empty(pt2_entry_t *tab) @@ -2292,8 +2194,9 @@ pmap_release(pmap_t pmap) pmap->pm_stats.resident_count)); KASSERT(pt2tab_user_is_empty(pmap->pm_pt2tab), ("%s: has allocated user PT2(s)", __func__)); + KASSERT(CPU_EMPTY(&pmap->pm_active), + ("%s: pmap %p is active on some CPU(s)", __func__, pmap)); - pmap_lazyfix(pmap); mtx_lock_spin(&allpmaps_lock); LIST_REMOVE(pmap, pm_list); mtx_unlock_spin(&allpmaps_lock); diff --git a/sys/arm/arm/swtch.S b/sys/arm/arm/swtch.S index 77d1c55..4773557 100644 --- a/sys/arm/arm/swtch.S +++ b/sys/arm/arm/swtch.S @@ -624,14 +624,6 @@ ENTRY(cpu_switch) cmp r0, r1 /* Switching to the TTB? */ beq sw0 /* same TTB, skip */ -#if 1 /* Lazy context switch */ - /* Don't switch mapping for kernel threads */ - ldr r1, =pmap_kern_ttb - ldr r1, [r1] /* r1 = kernel TTB */ - cmp r0, r1 /* Switching to kernel TTB? */ - beq sw0 /* kernel TTB, skip */ -#endif - #ifdef INVARIANTS cmp r0, #0 /* new thread? */ beq badsw4 /* no, panic */ diff --git a/sys/arm/include/pmap-v6.h b/sys/arm/include/pmap-v6.h index bb58682..304dec6 100644 --- a/sys/arm/include/pmap-v6.h +++ b/sys/arm/include/pmap-v6.h @@ -193,7 +193,6 @@ void pmap_unmapdev(vm_offset_t, vm_size_t); void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t); void pmap_kremove_device(vm_offset_t, vm_size_t); void pmap_set_pcb_pagedir(pmap_t , struct pcb *); -void pmap_lazyfix_action(void); void pmap_tlb_flush(pmap_t , vm_offset_t ); void pmap_tlb_flush_range(pmap_t , vm_offset_t , vm_size_t ); diff --git a/sys/arm/include/smp.h b/sys/arm/include/smp.h index 1abe398..bce8b4f 100644 --- a/sys/arm/include/smp.h +++ b/sys/arm/include/smp.h @@ -14,7 +14,6 @@ #define IPI_HARDCLOCK 6 #define IPI_TLB 7 #define IPI_CACHE 8 -#define IPI_LAZYPMAP 9 void init_secondary(int cpu); void mpentry(void); |