diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-05 21:55:16 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-05 21:55:16 +0000 |
commit | 5899f1c3618e6db2f37f47ef99fa640ebdda5506 (patch) | |
tree | 23aa4af326c0906aa1f95896a649ff0abe3933f1 /sys/arch | |
parent | aabaf8175cf6f13ee3461c2e7d7058c41204e5ae (diff) |
Change SMP secondary processor startup to have them ``hatch'' earlier,
so that they can invoke sched_init_cpu() before the scheduler starts,
which allows the horrible kluge in cpu_configure() to die.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mvme88k/dev/mainbus.c | 17 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/autoconf.c | 23 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 30 |
3 files changed, 39 insertions, 31 deletions
diff --git a/sys/arch/mvme88k/dev/mainbus.c b/sys/arch/mvme88k/dev/mainbus.c index 2bcd69abf25..8e4f7f26fc3 100644 --- a/sys/arch/mvme88k/dev/mainbus.c +++ b/sys/arch/mvme88k/dev/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.23 2007/11/27 16:22:13 martynas Exp $ */ +/* $OpenBSD: mainbus.c,v 1.24 2009/03/05 21:55:12 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 2004, Miodrag Vallat. @@ -287,6 +287,7 @@ mainbus_scan(struct device *parent, void *child, void *args) void mainbus_attach(struct device *parent, struct device *self, void *args) { + extern void cpu_hatch_secondary_processors(void *); extern char cpu_model[]; printf(": %s\n", cpu_model); @@ -316,5 +317,19 @@ mainbus_attach(struct device *parent, struct device *self, void *args) if (bs_extent == NULL) panic("unable to allocate bus_space extent"); +#ifdef MULTIPROCESSOR + /* + * Spin up the other processors, but do not give them work to + * do yet. + * On MVME188 boards, the system hangs if secondary processors + * try to issue BUG calls (i.e. when printing their information + * on console), so we postpone this to the end of autoconf. + */ + if (brdtyp == BRD_188) + startuphook_establish(cpu_hatch_secondary_processors, NULL); + else + cpu_hatch_secondary_processors(NULL); +#endif + (void)config_search(mainbus_scan, self, args); } diff --git a/sys/arch/mvme88k/mvme88k/autoconf.c b/sys/arch/mvme88k/mvme88k/autoconf.c index 7a15b613705..789731a164b 100644 --- a/sys/arch/mvme88k/mvme88k/autoconf.c +++ b/sys/arch/mvme88k/mvme88k/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.42 2008/07/21 04:35:54 todd Exp $ */ +/* $OpenBSD: autoconf.c,v 1.43 2009/03/05 21:55:15 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -72,26 +72,6 @@ struct device *bootdv; /* set by device drivers (if found) */ void cpu_configure() { -#ifdef MULTIPROCESSOR - /* - * XXX This is gross. We can not invoke sched_init_cpu after - * XXX init has been forked. But since we start secondary - * XXX processors very late in the boot process, it is not - * XXX possible to do this from the secondary processors - * XXX themselves. - * XXX Instead, do this now, even though this may cause - * XXX idle procs to be allocated for missing or unreliable - * XXX processors. - */ - cpuid_t cpu; - for (cpu = 0; cpu < max_cpus; cpu++) { - if (cpu == curcpu()->ci_cpuid) - continue; - - sched_init_cpu(&m88k_cpus[cpu]); - } -#endif - if (config_rootfound("mainbus", "mainbus") == 0) panic("no mainbus found"); @@ -107,6 +87,7 @@ cpu_configure() */ cn_tab = NULL; cninit(); + cold = 0; } diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index b459bfbe607..419b5ad545c 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.226 2009/02/27 05:19:36 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.227 2009/03/05 21:55:15 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -97,6 +97,7 @@ caddr_t allocsys(caddr_t); void consinit(void); +void cpu_hatch_secondary_processors(void *); void dumb_delay(int); void dumpconf(void); void dumpsys(void); @@ -147,7 +148,8 @@ struct vm_map *exec_map = NULL; struct vm_map *phys_map = NULL; #ifdef MULTIPROCESSOR -__cpu_simple_lock_t cpu_boot_mutex; +__cpu_simple_lock_t cpu_hatch_mutex; +__cpu_simple_lock_t cpu_boot_mutex = __SIMPLELOCK_LOCKED; #endif /* @@ -734,7 +736,7 @@ secondary_pre_main() if (init_stack == (vaddr_t)NULL) { printf("cpu%d: unable to allocate startup stack\n", ci->ci_cpuid); - __cpu_simple_unlock(&cpu_boot_mutex); + __cpu_simple_unlock(&cpu_hatch_mutex); for (;;) ; } @@ -756,17 +758,21 @@ secondary_main() cpu_configuration_print(0); ncpus++; + sched_init_cpu(ci); microuptime(&ci->ci_schedstate.spc_runtime); ci->ci_curproc = NULL; ci->ci_randseed = random(); SET(ci->ci_flags, CIF_ALIVE); + __cpu_simple_unlock(&cpu_hatch_mutex); + + /* wait for cpu_boot_secondary_processors() */ + __cpu_simple_lock(&cpu_boot_mutex); __cpu_simple_unlock(&cpu_boot_mutex); - set_psr(get_psr() & ~PSR_IND); spl0(); - SCHED_LOCK(s); + set_psr(get_psr() & ~PSR_IND); cpu_switchto(NULL, sched_chooseproc()); } @@ -1070,7 +1076,7 @@ mvme_bootstrap() #ifdef MULTIPROCESSOR void -cpu_boot_secondary_processors() +cpu_hatch_secondary_processors(void *unused) { struct cpu_info *ci = curcpu(); cpuid_t cpu; @@ -1087,11 +1093,11 @@ cpu_boot_secondary_processors() #endif for (cpu = 0; cpu < max_cpus; cpu++) { if (cpu != ci->ci_cpuid) { - __cpu_simple_lock(&cpu_boot_mutex); + __cpu_simple_lock(&cpu_hatch_mutex); rc = spin_cpu(cpu, (vaddr_t)secondary_start); switch (rc) { case 0: - __cpu_simple_lock(&cpu_boot_mutex); + __cpu_simple_lock(&cpu_hatch_mutex); break; default: printf("cpu%d: spin_cpu error %d\n", @@ -1100,7 +1106,7 @@ cpu_boot_secondary_processors() case FORKMPU_NO_MPU: break; } - __cpu_simple_unlock(&cpu_boot_mutex); + __cpu_simple_unlock(&cpu_hatch_mutex); } } break; @@ -1109,6 +1115,12 @@ cpu_boot_secondary_processors() break; } } + +void +cpu_boot_secondary_processors() +{ + __cpu_simple_unlock(&cpu_boot_mutex); +} #endif /* |