Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jun 2011 07:25:53 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r223141 - projects/largeSMP/sys/sparc64/sparc64
Message-ID:  <201106160725.p5G7PrGL017521@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Thu Jun 16 07:25:53 2011
New Revision: 223141
URL: http://svn.freebsd.org/changeset/base/223141

Log:
  Remove entirely pc_other_cpus usage and pc_cpumask usage from sparc64.
  
  Tested and reviewed by:	marius

Modified:
  projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c
  projects/largeSMP/sys/sparc64/sparc64/pmap.c
  projects/largeSMP/sys/sparc64/sparc64/tlb.c

Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c
==============================================================================
--- projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c	Thu Jun 16 07:16:02 2011	(r223140)
+++ projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c	Thu Jun 16 07:25:53 2011	(r223141)
@@ -283,7 +283,6 @@ sun4u_startcpu(phandle_t cpu, void *func
 void
 cpu_mp_start(void)
 {
-	cpuset_t ocpus;
 
 	mtx_init(&ipi_mtx, "ipi", NULL, MTX_SPIN);
 
@@ -300,9 +299,6 @@ cpu_mp_start(void)
 	KASSERT(!isjbus || mp_ncpus <= IDR_JALAPENO_MAX_BN_PAIRS,
 	    ("%s: can only IPI a maximum of %d JBus-CPUs",
 	    __func__, IDR_JALAPENO_MAX_BN_PAIRS));
-	ocpus = all_cpus;
-	CPU_CLR(curcpu, &ocpus);
-	PCPU_SET(other_cpus, ocpus);
 	smp_active = 1;
 }
 
@@ -424,7 +420,6 @@ cpu_mp_unleash(void *v)
 void
 cpu_mp_bootstrap(struct pcpu *pc)
 {
-	cpuset_t ocpus;
 	volatile struct cpu_start_args *csa;
 
 	csa = &cpu_start_args;
@@ -466,9 +461,6 @@ cpu_mp_bootstrap(struct pcpu *pc)
 
 	smp_cpus++;
 	KASSERT(curthread != NULL, ("%s: curthread", __func__));
-	ocpus = all_cpus;
-	CPU_CLR(curcpu, &ocpus);
-	PCPU_SET(other_cpus, ocpus);
 	printf("SMP: AP CPU #%d Launched!\n", curcpu);
 
 	csa->csa_count--;
@@ -491,13 +483,14 @@ cpu_mp_shutdown(void)
 	int i;
 
 	critical_enter();
-	shutdown_cpus = PCPU_GET(other_cpus);
+	shutdown_cpus = all_cpus;
+	CPU_CLR(PCPU_GET(cpuid), &shutdown_cpus);
 	cpus = shutdown_cpus;
 
 	/* XXX: Stop all the CPUs which aren't already. */
 	if (CPU_CMP(&stopped_cpus, &cpus)) {
 
-		/* pc_other_cpus is just a flat "on" mask without curcpu. */
+		/* cpus is just a flat "on" mask without curcpu. */
 		CPU_NAND(&cpus, &stopped_cpus);
 		stop_cpus(cpus);
 	}
@@ -520,23 +513,23 @@ cpu_ipi_ast(struct trapframe *tf)
 static void
 cpu_ipi_stop(struct trapframe *tf)
 {
-	cpuset_t tcmask;
+	u_int cpuid;
 
 	CTR2(KTR_SMP, "%s: stopped %d", __func__, curcpu);
 	sched_pin();
 	savectx(&stoppcbs[curcpu]);
-	tcmask = PCPU_GET(cpumask);
-	CPU_OR_ATOMIC(&stopped_cpus, &tcmask);
-	while (!CPU_OVERLAP(&started_cpus, &tcmask)) {
-		if (CPU_OVERLAP(&shutdown_cpus, &tcmask)) {
-			CPU_NAND_ATOMIC(&shutdown_cpus, &tcmask);
+	cpuid = PCPU_GET(cpuid);
+	CPU_SET_ATOMIC(cpuid, &stopped_cpus);
+	while (!CPU_ISSET(cpuid, &started_cpus)) {
+		if (CPU_ISSET(cpuid, &shutdown_cpus)) {
+			CPU_CLR_ATOMIC(cpuid, &shutdown_cpus);
 			(void)intr_disable();
 			for (;;)
 				;
 		}
 	}
-	CPU_NAND_ATOMIC(&started_cpus, &tcmask);
-	CPU_NAND_ATOMIC(&stopped_cpus, &tcmask);
+	CPU_CLR_ATOMIC(cpuid, &started_cpus);
+	CPU_CLR_ATOMIC(cpuid, &stopped_cpus);
 	sched_unpin();
 	CTR2(KTR_SMP, "%s: restarted %d", __func__, curcpu);
 }

Modified: projects/largeSMP/sys/sparc64/sparc64/pmap.c
==============================================================================
--- projects/largeSMP/sys/sparc64/sparc64/pmap.c	Thu Jun 16 07:16:02 2011	(r223140)
+++ projects/largeSMP/sys/sparc64/sparc64/pmap.c	Thu Jun 16 07:25:53 2011	(r223141)
@@ -2230,7 +2230,7 @@ pmap_activate(struct thread *td)
 	PCPU_SET(tlb_ctx, context + 1);
 
 	pm->pm_context[curcpu] = context;
-	CPU_OR(&pm->pm_active, PCPU_PTR(cpumask));
+	CPU_SET(PCPU_GET(cpuid), &pm->pm_active);
 	PCPU_SET(pmap, pm);
 
 	stxa(AA_DMMU_TSB, ASI_DMMU, pm->pm_tsb);

Modified: projects/largeSMP/sys/sparc64/sparc64/tlb.c
==============================================================================
--- projects/largeSMP/sys/sparc64/sparc64/tlb.c	Thu Jun 16 07:16:02 2011	(r223140)
+++ projects/largeSMP/sys/sparc64/sparc64/tlb.c	Thu Jun 16 07:25:53 2011	(r223141)
@@ -80,7 +80,7 @@ tlb_context_demap(struct pmap *pm)
 	PMAP_STATS_INC(tlb_ncontext_demap);
 	cookie = ipi_tlb_context_demap(pm);
 	s = intr_disable();
-	if (CPU_OVERLAP(&pm->pm_active, PCPU_PTR(cpumask))) {
+	if (CPU_ISSET(PCPU_GET(cpuid), &pm->pm_active)) {
 		KASSERT(pm->pm_context[curcpu] != -1,
 		    ("tlb_context_demap: inactive pmap?"));
 		stxa(TLB_DEMAP_PRIMARY | TLB_DEMAP_CONTEXT, ASI_DMMU_DEMAP, 0);
@@ -101,7 +101,7 @@ tlb_page_demap(struct pmap *pm, vm_offse
 	PMAP_STATS_INC(tlb_npage_demap);
 	cookie = ipi_tlb_page_demap(pm, va);
 	s = intr_disable();
-	if (CPU_OVERLAP(&pm->pm_active, PCPU_PTR(cpumask))) {
+	if (CPU_ISSET(PCPU_GET(cpuid), &pm->pm_active)) {
 		KASSERT(pm->pm_context[curcpu] != -1,
 		    ("tlb_page_demap: inactive pmap?"));
 		if (pm == kernel_pmap)
@@ -128,7 +128,7 @@ tlb_range_demap(struct pmap *pm, vm_offs
 	PMAP_STATS_INC(tlb_nrange_demap);
 	cookie = ipi_tlb_range_demap(pm, start, end);
 	s = intr_disable();
-	if (CPU_OVERLAP(&pm->pm_active, PCPU_PTR(cpumask))) {
+	if (CPU_ISSET(PCPU_GET(cpuid), &pm->pm_active)) {
 		KASSERT(pm->pm_context[curcpu] != -1,
 		    ("tlb_range_demap: inactive pmap?"));
 		if (pm == kernel_pmap)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106160725.p5G7PrGL017521>