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)
This commit is contained in:
Alan Cox 2015-05-11 19:55:01 +00:00
parent ae4fa2223a
commit dfb378345f
5 changed files with 2 additions and 115 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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 */

View File

@ -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 );

View File

@ -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);