Remove pc_cpumask and pc_other_cpus from MIPS support.

Tested by:	gonzo
This commit is contained in:
Attilio Rao 2011-06-28 12:51:08 +00:00
parent c0757daf1f
commit 9a981857cf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/largeSMP/; revision=223639
2 changed files with 34 additions and 45 deletions

View File

@ -75,8 +75,11 @@ ipi_send(struct pcpu *pc, int ipi)
void void
ipi_all_but_self(int ipi) ipi_all_but_self(int ipi)
{ {
cpuset_t other_cpus;
ipi_selected(PCPU_GET(other_cpus), ipi); other_cpus = all_cpus;
CPU_CLR(PCPU_GET(cpuid), &other_cpus);
ipi_selected(other_cpus, ipi);
} }
/* Send an IPI to a set of cpus. */ /* Send an IPI to a set of cpus. */
@ -86,7 +89,7 @@ ipi_selected(cpuset_t cpus, int ipi)
struct pcpu *pc; struct pcpu *pc;
STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
if (CPU_OVERLAP(&cpus, &pc->pc_cpumask)) { if (CPU_ISSET(pc->pc_cpuid, &cpus)) {
CTR3(KTR_SMP, "%s: pc: %p, ipi: %x\n", __func__, pc, CTR3(KTR_SMP, "%s: pc: %p, ipi: %x\n", __func__, pc,
ipi); ipi);
ipi_send(pc, ipi); ipi_send(pc, ipi);
@ -109,13 +112,10 @@ ipi_cpu(int cpu, u_int ipi)
static int static int
mips_ipi_handler(void *arg) mips_ipi_handler(void *arg)
{ {
int cpu; u_int cpu, ipi, ipi_bitmap;
cpuset_t cpumask;
u_int ipi, ipi_bitmap;
int bit; int bit;
cpu = PCPU_GET(cpuid); cpu = PCPU_GET(cpuid);
cpumask = PCPU_GET(cpumask);
platform_ipi_clear(); /* quiesce the pending ipi interrupt */ platform_ipi_clear(); /* quiesce the pending ipi interrupt */
@ -150,14 +150,14 @@ mips_ipi_handler(void *arg)
tlb_save(); tlb_save();
/* Indicate we are stopped */ /* Indicate we are stopped */
CPU_OR_ATOMIC(&stopped_cpus, &cpumask); CPU_SET_ATOMIC(cpu, &stopped_cpus);
/* Wait for restart */ /* Wait for restart */
while (!CPU_OVERLAP(&started_cpus, &cpumask)) while (!CPU_ISSET(cpu, &started_cpus))
cpu_spinwait(); cpu_spinwait();
CPU_NAND_ATOMIC(&started_cpus, &cpumask); CPU_CLR_ATOMIC(cpu, &started_cpus);
CPU_NAND_ATOMIC(&stopped_cpus, &cpumask); CPU_CLR_ATOMIC(cpu, &stopped_cpus);
CTR0(KTR_SMP, "IPI_STOP (restart)"); CTR0(KTR_SMP, "IPI_STOP (restart)");
break; break;
case IPI_PREEMPT: case IPI_PREEMPT:
@ -243,7 +243,7 @@ void
cpu_mp_start(void) cpu_mp_start(void)
{ {
int error, cpuid; int error, cpuid;
cpuset_t cpumask, ocpus; cpuset_t cpumask;
mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN);
@ -269,16 +269,11 @@ cpu_mp_start(void)
} }
CPU_SET(cpuid, &all_cpus); CPU_SET(cpuid, &all_cpus);
} }
ocpus = all_cpus;
CPU_CLR(PCPU_GET(cpuid), &ocpus);
PCPU_SET(other_cpus, ocpus);
} }
void void
smp_init_secondary(u_int32_t cpuid) smp_init_secondary(u_int32_t cpuid)
{ {
cpuset_t ocpus;
/* TLB */ /* TLB */
mips_wr_wired(0); mips_wr_wired(0);
@ -316,11 +311,6 @@ smp_init_secondary(u_int32_t cpuid)
CTR1(KTR_SMP, "SMP: AP CPU #%d launched", PCPU_GET(cpuid)); CTR1(KTR_SMP, "SMP: AP CPU #%d launched", PCPU_GET(cpuid));
/* Build our map of 'other' CPUs. */
ocpus = all_cpus;
CPU_CLR(PCPU_GET(cpuid), &ocpus);
PCPU_SET(other_cpus, ocpus);
if (bootverbose) if (bootverbose)
printf("SMP: AP CPU #%d launched.\n", PCPU_GET(cpuid)); printf("SMP: AP CPU #%d launched.\n", PCPU_GET(cpuid));

View File

@ -625,19 +625,18 @@ pmap_init(void)
static __inline void static __inline void
pmap_invalidate_all_local(pmap_t pmap) pmap_invalidate_all_local(pmap_t pmap)
{ {
u_int cpuid;
cpuid = PCPU_GET(cpuid);
if (pmap == kernel_pmap) { if (pmap == kernel_pmap) {
tlb_invalidate_all(); tlb_invalidate_all();
return; return;
} }
sched_pin(); if (CPU_ISSET(cpuid, &pmap->pm_active))
if (CPU_OVERLAP(&pmap->pm_active, PCPU_PTR(cpumask))) {
sched_unpin();
tlb_invalidate_all_user(pmap); tlb_invalidate_all_user(pmap);
} else { else
sched_unpin(); pmap->pm_asid[cpuid].gen = 0;
pmap->pm_asid[PCPU_GET(cpuid)].gen = 0;
}
} }
#ifdef SMP #ifdef SMP
@ -666,21 +665,20 @@ pmap_invalidate_all(pmap_t pmap)
static __inline void static __inline void
pmap_invalidate_page_local(pmap_t pmap, vm_offset_t va) pmap_invalidate_page_local(pmap_t pmap, vm_offset_t va)
{ {
u_int cpuid;
cpuid = PCPU_GET(cpuid);
if (is_kernel_pmap(pmap)) { if (is_kernel_pmap(pmap)) {
tlb_invalidate_address(pmap, va); tlb_invalidate_address(pmap, va);
return; return;
} }
sched_pin(); if (pmap->pm_asid[cpuid].gen != PCPU_GET(asid_generation))
if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) {
sched_unpin();
return; return;
} else if (!CPU_OVERLAP(&pmap->pm_active, PCPU_PTR(cpumask))) { else if (!CPU_ISSET(cpuid, &pmap->pm_active)) {
pmap->pm_asid[PCPU_GET(cpuid)].gen = 0; pmap->pm_asid[cpuid].gen = 0;
sched_unpin();
return; return;
} }
sched_unpin();
tlb_invalidate_address(pmap, va); tlb_invalidate_address(pmap, va);
} }
@ -719,21 +717,20 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va)
static __inline void static __inline void
pmap_update_page_local(pmap_t pmap, vm_offset_t va, pt_entry_t pte) pmap_update_page_local(pmap_t pmap, vm_offset_t va, pt_entry_t pte)
{ {
u_int cpuid;
cpuid = PCPU_GET(cpuid);
if (is_kernel_pmap(pmap)) { if (is_kernel_pmap(pmap)) {
tlb_update(pmap, va, pte); tlb_update(pmap, va, pte);
return; return;
} }
sched_pin(); if (pmap->pm_asid[cpuid].gen != PCPU_GET(asid_generation))
if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) {
sched_unpin();
return; return;
} else if (!CPU_OVERLAP(&pmap->pm_active, PCPU_PTR(cpumask))) { else if (!CPU_ISSET(cpuid, &pmap->pm_active)) {
pmap->pm_asid[PCPU_GET(cpuid)].gen = 0; pmap->pm_asid[cpuid].gen = 0;
sched_unpin();
return; return;
} }
sched_unpin();
tlb_update(pmap, va, pte); tlb_update(pmap, va, pte);
} }
@ -2953,19 +2950,21 @@ pmap_activate(struct thread *td)
{ {
pmap_t pmap, oldpmap; pmap_t pmap, oldpmap;
struct proc *p = td->td_proc; struct proc *p = td->td_proc;
u_int cpuid;
critical_enter(); critical_enter();
pmap = vmspace_pmap(p->p_vmspace); pmap = vmspace_pmap(p->p_vmspace);
oldpmap = PCPU_GET(curpmap); oldpmap = PCPU_GET(curpmap);
cpuid = PCPU_GET(cpuid);
if (oldpmap) if (oldpmap)
CPU_NAND_ATOMIC(&oldpmap->pm_active, PCPU_PTR(cpumask)); CPU_CLR_ATOMIC(cpuid, &oldpmap->pm_active);
CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask)); CPU_SET_ATOMIC(cpuid, &pmap->pm_active);
pmap_asid_alloc(pmap); pmap_asid_alloc(pmap);
if (td == curthread) { if (td == curthread) {
PCPU_SET(segbase, pmap->pm_segtab); PCPU_SET(segbase, pmap->pm_segtab);
mips_wr_entryhi(pmap->pm_asid[PCPU_GET(cpuid)].asid); mips_wr_entryhi(pmap->pm_asid[cpuid].asid);
} }
PCPU_SET(curpmap, pmap); PCPU_SET(curpmap, pmap);