summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-07-04 12:04:52 +0000
committerattilio <attilio@FreeBSD.org>2011-07-04 12:04:52 +0000
commit364d0522f778b206262efce0932d6cea821879c6 (patch)
treef85bc4cd83b575a0c42f08d746e644f6dfc0e2ef /sys/powerpc
parent95ca970257de274a90a1a867048c5ace5acf532d (diff)
downloadFreeBSD-src-364d0522f778b206262efce0932d6cea821879c6.zip
FreeBSD-src-364d0522f778b206262efce0932d6cea821879c6.tar.gz
With retirement of cpumask_t and usage of cpuset_t for representing a
mask of CPUs, pc_other_cpus and pc_cpumask become highly inefficient. Remove them and replace their usage with custom pc_cpuid magic (as, atm, pc_cpumask can be easilly represented by (1 << pc_cpuid) and pc_other_cpus by (all_cpus & ~(1 << pc_cpuid))). This change is not targeted for MFC because of struct pcpu members removal and dependency by cpumask_t retirement. MD review by: marcel, marius, alc Tested by: pluknet MD testing by: marcel, marius, gonzo, andreast
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/aim/mmu_oea.c8
-rw-r--r--sys/powerpc/aim/mmu_oea64.c8
-rw-r--r--sys/powerpc/booke/pmap.c12
-rw-r--r--sys/powerpc/powerpc/mp_machdep.c21
4 files changed, 19 insertions, 30 deletions
diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c
index be80455..23354f9 100644
--- a/sys/powerpc/aim/mmu_oea.c
+++ b/sys/powerpc/aim/mmu_oea.c
@@ -945,9 +945,7 @@ moea_activate(mmu_t mmu, struct thread *td)
pm = &td->td_proc->p_vmspace->vm_pmap;
pmr = pm->pmap_phys;
- sched_pin();
- CPU_OR(&pm->pm_active, PCPU_PTR(cpumask));
- sched_unpin();
+ CPU_SET(PCPU_GET(cpuid), &pm->pm_active);
PCPU_SET(curpmap, pmr);
}
@@ -957,9 +955,7 @@ moea_deactivate(mmu_t mmu, struct thread *td)
pmap_t pm;
pm = &td->td_proc->p_vmspace->vm_pmap;
- sched_pin();
- CPU_NAND(&pm->pm_active, PCPU_PTR(cpumask));
- sched_unpin();
+ CPU_CLR(PCPU_GET(cpuid), &pm->pm_active);
PCPU_SET(curpmap, NULL);
}
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index 8f4028f..f051b61 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -998,9 +998,7 @@ moea64_activate(mmu_t mmu, struct thread *td)
pmap_t pm;
pm = &td->td_proc->p_vmspace->vm_pmap;
- sched_pin();
- CPU_OR(&pm->pm_active, PCPU_PTR(cpumask));
- sched_unpin();
+ CPU_SET(PCPU_GET(cpuid), &pm->pm_active);
#ifdef __powerpc64__
PCPU_SET(userslb, pm->pm_slb);
@@ -1015,9 +1013,7 @@ moea64_deactivate(mmu_t mmu, struct thread *td)
pmap_t pm;
pm = &td->td_proc->p_vmspace->vm_pmap;
- sched_pin();
- CPU_NAND(&pm->pm_active, PCPU_PTR(cpumask));
- sched_unpin();
+ CPU_CLR(PCPU_GET(cpuid), &pm->pm_active);
#ifdef __powerpc64__
PCPU_SET(userslb, NULL);
#else
diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c
index e1cd071..18068fc 100644
--- a/sys/powerpc/booke/pmap.c
+++ b/sys/powerpc/booke/pmap.c
@@ -1826,6 +1826,7 @@ static void
mmu_booke_activate(mmu_t mmu, struct thread *td)
{
pmap_t pmap;
+ u_int cpuid;
pmap = &td->td_proc->p_vmspace->vm_pmap;
@@ -1836,14 +1837,15 @@ mmu_booke_activate(mmu_t mmu, struct thread *td)
mtx_lock_spin(&sched_lock);
- CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask));
+ cpuid = PCPU_GET(cpuid);
+ CPU_SET_ATOMIC(cpuid, &pmap->pm_active);
PCPU_SET(curpmap, pmap);
- if (pmap->pm_tid[PCPU_GET(cpuid)] == TID_NONE)
+ if (pmap->pm_tid[cpuid] == TID_NONE)
tid_alloc(pmap);
/* Load PID0 register with pmap tid value. */
- mtspr(SPR_PID0, pmap->pm_tid[PCPU_GET(cpuid)]);
+ mtspr(SPR_PID0, pmap->pm_tid[cpuid]);
__asm __volatile("isync");
mtx_unlock_spin(&sched_lock);
@@ -1865,9 +1867,7 @@ mmu_booke_deactivate(mmu_t mmu, struct thread *td)
CTR5(KTR_PMAP, "%s: td=%p, proc = '%s', id = %d, pmap = 0x%08x",
__func__, td, td->td_proc->p_comm, td->td_proc->p_pid, pmap);
- sched_pin();
- CPU_NAND_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask));
- sched_unpin();
+ CPU_CLR_ATOMIC(PCPU_GET(cpuid), &pmap->pm_active);
PCPU_SET(curpmap, NULL);
}
diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c
index 3563376..db20a6f 100644
--- a/sys/powerpc/powerpc/mp_machdep.c
+++ b/sys/powerpc/powerpc/mp_machdep.c
@@ -171,9 +171,8 @@ cpu_mp_start(void)
pc->pc_cpuid = bsp.cr_cpuid;
pc->pc_bsp = 1;
}
- CPU_SETOF(pc->pc_cpuid, &pc->pc_cpumask);
pc->pc_hwref = cpu.cr_hwref;
- CPU_OR(&all_cpus, &pc->pc_cpumask);
+ CPU_SET(pc->pc_cpuid, &all_cpus);
next:
error = platform_smp_next_cpu(&cpu);
}
@@ -211,8 +210,6 @@ cpu_mp_unleash(void *dummy)
smp_cpus = 0;
STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
cpus++;
- pc->pc_other_cpus = all_cpus;
- CPU_NAND(&pc->pc_other_cpus, &pc->pc_cpumask);
if (!pc->pc_bsp) {
if (bootverbose)
printf("Waking up CPU %d (dev=%x)\n",
@@ -274,7 +271,7 @@ SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL);
int
powerpc_ipi_handler(void *arg)
{
- cpuset_t self;
+ u_int cpuid;
uint32_t ipimask;
int msg;
@@ -306,14 +303,14 @@ powerpc_ipi_handler(void *arg)
*/
CTR1(KTR_SMP, "%s: IPI_STOP or IPI_STOP_HARD (stop)",
__func__);
- savectx(&stoppcbs[PCPU_GET(cpuid)]);
- self = PCPU_GET(cpumask);
+ cpuid = PCPU_GET(cpuid);
+ savectx(&stoppcbs[cpuid]);
savectx(PCPU_GET(curpcb));
- CPU_OR_ATOMIC(&stopped_cpus, &self);
- while (!CPU_OVERLAP(&started_cpus, &self))
+ CPU_SET_ATOMIC(cpuid, &stopped_cpus);
+ while (!CPU_ISSET(cpuid, &started_cpus))
cpu_spinwait();
- CPU_NAND_ATOMIC(&started_cpus, &self);
- CPU_NAND_ATOMIC(&stopped_cpus, &self);
+ CPU_CLR_ATOMIC(cpuid, &stopped_cpus);
+ CPU_CLR_ATOMIC(cpuid, &started_cpus);
CTR1(KTR_SMP, "%s: IPI_STOP (restart)", __func__);
break;
case IPI_HARDCLOCK:
@@ -346,7 +343,7 @@ ipi_selected(cpuset_t cpus, int ipi)
struct pcpu *pc;
STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
- if (CPU_OVERLAP(&cpus, &pc->pc_cpumask))
+ if (CPU_ISSET(pc->pc_cpuid, &cpus))
ipi_send(pc, ipi);
}
}
OpenPOWER on IntegriCloud