- 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
This commit is contained in:
Peter Grehan 2010-09-03 03:56:09 +00:00
parent 42908e80e6
commit d8acfb88ad
3 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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) {