diff options
author | grehan <grehan@FreeBSD.org> | 2010-09-03 03:56:09 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2010-09-03 03:56:09 +0000 |
commit | ff1a91885dc88347c1ab8c5152a643f4cf2e3eca (patch) | |
tree | a2b3aaefb175b6377ced82df19a2c97764fd2e3b | |
parent | c5088c509ec1217c573d1e4a4330b9bbef13d6f3 (diff) | |
download | FreeBSD-src-ff1a91885dc88347c1ab8c5152a643f4cf2e3eca.zip FreeBSD-src-ff1a91885dc88347c1ab8c5152a643f4cf2e3eca.tar.gz |
- 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
-rw-r--r-- | sys/powerpc/conf/GENERIC64 | 4 | ||||
-rw-r--r-- | sys/powerpc/include/param.h | 2 | ||||
-rw-r--r-- | sys/powerpc/powerpc/mp_machdep.c | 10 |
3 files changed, 12 insertions, 4 deletions
diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 79bd1d8..88963d9 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -76,8 +76,8 @@ options WITNESS #Enable checks to detect deadlocks and cycles 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 diff --git a/sys/powerpc/include/param.h b/sys/powerpc/include/param.h index 91bb238..d71d048 100644 --- a/sys/powerpc/include/param.h +++ b/sys/powerpc/include/param.h @@ -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 */ diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c index 19b46a9..46f0295 100644 --- a/sys/powerpc/powerpc/mp_machdep.c +++ b/sys/powerpc/powerpc/mp_machdep.c @@ -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) { |