svn commit: r223142 - in projects/largeSMP/sys/powerpc: aim booke powerpc

Attilio Rao attilio at FreeBSD.org
Thu Jun 16 07:27:14 UTC 2011


Author: attilio
Date: Thu Jun 16 07:27:13 2011
New Revision: 223142
URL: http://svn.freebsd.org/changeset/base/223142

Log:
  Remove pc_other_cpus and pc_cpumask usage from powerpc support.
  
  Tested and reviewed by:	andreast

Modified:
  projects/largeSMP/sys/powerpc/aim/mmu_oea.c
  projects/largeSMP/sys/powerpc/aim/mmu_oea64.c
  projects/largeSMP/sys/powerpc/booke/pmap.c
  projects/largeSMP/sys/powerpc/powerpc/mp_machdep.c

Modified: projects/largeSMP/sys/powerpc/aim/mmu_oea.c
==============================================================================
--- projects/largeSMP/sys/powerpc/aim/mmu_oea.c	Thu Jun 16 07:25:53 2011	(r223141)
+++ projects/largeSMP/sys/powerpc/aim/mmu_oea.c	Thu Jun 16 07:27:13 2011	(r223142)
@@ -945,9 +945,7 @@ moea_activate(mmu_t mmu, struct thread *
 	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
 	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);
 }
 

Modified: projects/largeSMP/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- projects/largeSMP/sys/powerpc/aim/mmu_oea64.c	Thu Jun 16 07:25:53 2011	(r223141)
+++ projects/largeSMP/sys/powerpc/aim/mmu_oea64.c	Thu Jun 16 07:27:13 2011	(r223142)
@@ -998,9 +998,7 @@ moea64_activate(mmu_t mmu, struct thread
 	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 thre
 	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

Modified: projects/largeSMP/sys/powerpc/booke/pmap.c
==============================================================================
--- projects/largeSMP/sys/powerpc/booke/pmap.c	Thu Jun 16 07:25:53 2011	(r223141)
+++ projects/largeSMP/sys/powerpc/booke/pmap.c	Thu Jun 16 07:27:13 2011	(r223142)
@@ -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 thr
 
 	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 t
 	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);
 }
 

Modified: projects/largeSMP/sys/powerpc/powerpc/mp_machdep.c
==============================================================================
--- projects/largeSMP/sys/powerpc/powerpc/mp_machdep.c	Thu Jun 16 07:25:53 2011	(r223141)
+++ projects/largeSMP/sys/powerpc/powerpc/mp_machdep.c	Thu Jun 16 07:27:13 2011	(r223142)
@@ -175,9 +175,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);
 	}
@@ -215,8 +214,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",
@@ -278,7 +275,7 @@ SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_
 int
 powerpc_ipi_handler(void *arg)
 {
-	cpuset_t self;
+	u_int cpuid;
 	uint32_t ipimask;
 	int msg;
 
@@ -310,14 +307,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:
@@ -350,7 +347,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);
 	}
 }


More information about the svn-src-projects mailing list