svn commit: r212170 - in head/sys/powerpc: conf include powerpc
Peter Grehan
grehan at FreeBSD.org
Fri Sep 3 03:56:09 UTC 2010
Author: grehan
Date: Fri Sep 3 03:56:09 2010
New Revision: 212170
URL: http://svn.freebsd.org/changeset/base/212170
Log:
- Bump MAXCPU to 4. Tested on a quad G5 with both 32 and 64-bit kernels.
A make buildkernel -j4 uses ~360% CPU.
- Bracket the AP spinup printf with a mutex to avoid garbled output.
- Enable SMP by default on powerpc64.
Reviewed by: nwhitehorn
Modified:
head/sys/powerpc/conf/GENERIC64
head/sys/powerpc/include/param.h
head/sys/powerpc/powerpc/mp_machdep.c
Modified: head/sys/powerpc/conf/GENERIC64
==============================================================================
--- head/sys/powerpc/conf/GENERIC64 Fri Sep 3 03:48:06 2010 (r212169)
+++ head/sys/powerpc/conf/GENERIC64 Fri Sep 3 03:56:09 2010 (r212170)
@@ -76,8 +76,8 @@ options WITNESS #Enable checks to det
options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed
options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
-# To make an SMP kernel, the next line is needed
-#options SMP # Symmetric MultiProcessor Kernel
+# Make an SMP-capable kernel by default
+options SMP # Symmetric MultiProcessor Kernel
# CPU frequency control
device cpufreq
Modified: head/sys/powerpc/include/param.h
==============================================================================
--- head/sys/powerpc/include/param.h Fri Sep 3 03:48:06 2010 (r212169)
+++ head/sys/powerpc/include/param.h Fri Sep 3 03:56:09 2010 (r212170)
@@ -68,7 +68,7 @@
#endif
#if defined(SMP) || defined(KLD_MODULE)
-#define MAXCPU 2
+#define MAXCPU 4
#else
#define MAXCPU 1
#endif /* SMP || KLD_MODULE */
Modified: head/sys/powerpc/powerpc/mp_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/mp_machdep.c Fri Sep 3 03:48:06 2010 (r212169)
+++ head/sys/powerpc/powerpc/mp_machdep.c Fri Sep 3 03:56:09 2010 (r212170)
@@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/bus.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/pcpu.h>
#include <sys/proc.h>
#include <sys/sched.h>
@@ -60,6 +62,7 @@ volatile static u_int ap_letgo;
volatile static uint32_t ap_decr;
volatile static u_quad_t ap_timebase;
static u_int ipi_msg_cnt[32];
+static struct mtx ap_boot_mtx;
void
machdep_ap_bootstrap(void)
@@ -80,8 +83,11 @@ machdep_ap_bootstrap(void)
mttb(ap_timebase);
__asm __volatile("mtdec %0" :: "r"(ap_decr));
- atomic_add_int(&ap_awake, 1);
+ /* Serialize console output and AP count increment */
+ mtx_lock_spin(&ap_boot_mtx);
+ ap_awake++;
printf("SMP: AP CPU #%d launched\n", PCPU_GET(cpuid));
+ mtx_unlock_spin(&ap_boot_mtx);
/* Initialize curthread */
PCPU_SET(curthread, PCPU_GET(idlethread));
@@ -203,6 +209,8 @@ cpu_mp_unleash(void *dummy)
if (mp_ncpus <= 1)
return;
+ mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN);
+
cpus = 0;
smp_cpus = 0;
SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
More information about the svn-src-head
mailing list