diff options
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore.S | 25 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 21 |
2 files changed, 18 insertions, 28 deletions
diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S index 355d0dae81a..2cf4cfc7b3d 100644 --- a/sys/arch/mvme88k/mvme88k/locore.S +++ b/sys/arch/mvme88k/mvme88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.50 2007/10/10 15:53:52 art Exp $ */ +/* $OpenBSD: locore.S,v 1.51 2007/10/28 19:45:52 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -310,29 +310,6 @@ GLOBAL(secondary_start) stcr r11, CPU /* - * Since there may be more than one secondary MPU, compete with them - * to initialize safely. - */ - or.u r11, r0, hi16(_C_LABEL(cpu_mutex)) - or r11, r11, lo16(_C_LABEL(cpu_mutex)) -1: - or r22, r0, 1 - xmem r22, r11, r0 /* If r22 gets 0, we have the lock... */ - bcnd eq0, r22, 4f /* ...but if not, we must wait */ -2: - /* just watch the lock until it looks clear */ - ld r22, r11, r0 - bcnd eq0, r22, 1b - /* since we can be here with caches off, add a few nops to - keep the bus from getting overloaded */ - or r2, r0, lo16(1000) -3: - subu r2, r2, 1 - bcnd ne0, r2, 3b - br 1b -4: - - /* * While holding the cpu_mutex, the secondary cpu can use the slavestack * to call secondary_pre_main() to determine its cpu number. * After that, however, it should allocate its own stack and switch diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 7d91cf6f9d0..b9d6fe5610c 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.195 2007/10/28 19:42:12 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.196 2007/10/28 19:45:52 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -135,7 +135,7 @@ struct vm_map *exec_map = NULL; struct vm_map *phys_map = NULL; #ifdef MULTIPROCESSOR -__cpu_simple_lock_t cpu_mutex = __SIMPLELOCK_UNLOCKED; +__cpu_simple_lock_t cpu_boot_mutex; #endif /* @@ -706,6 +706,8 @@ secondary_pre_main() ci->ci_idle_pcb = (struct pcb *)uvm_km_zalloc(kernel_map, USPACE); if (ci->ci_idle_pcb == NULL) { printf("cpu%d: unable to allocate idle stack\n", ci->ci_cpuid); + __cpu_simple_unlock(&cpu_boot_mutex); + for (;;) ; } } @@ -724,7 +726,8 @@ secondary_main() cpu_configuration_print(0); sched_init_cpu(ci); ncpus++; - __cpu_simple_unlock(&cpu_mutex); + + __cpu_simple_unlock(&cpu_boot_mutex); microuptime(&ci->ci_schedstate.spc_runtime); ci->ci_curproc = NULL; @@ -1046,10 +1049,20 @@ cpu_boot_secondary_processors() #endif for (cpu = 0; cpu < max_cpus; cpu++) { if (cpu != curcpu()->ci_cpuid) { + __cpu_simple_lock(&cpu_boot_mutex); rc = spin_cpu(cpu, (vaddr_t)secondary_start); - if (rc != 0 && rc != FORKMPU_NO_MPU) + switch (rc) { + case 0: + __cpu_simple_lock(&cpu_boot_mutex); + break; + default: printf("cpu%d: spin_cpu error %d\n", cpu, rc); + /* FALLTHROUGH */ + case FORKMPU_NO_MPU: + break; + } + __cpu_simple_unlock(&cpu_boot_mutex); } } break; |