diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-06-29 21:27:54 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-06-29 21:27:54 +0000 |
commit | 96d9a2022aaea2e5fce2f885bcaf31845fde4a64 (patch) | |
tree | 7d4166ac3a26efd967d0ab663534801dcd8335a4 /sys/kern | |
parent | e90bbc837f0f5c35382558e2f6743480bd6f8db6 (diff) |
SMP support. Mostly works, but occasionally craps out during boot.
ok drahn@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_sched.c | 12 | ||||
-rw-r--r-- | sys/kern/kern_smr.c | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 758aac7af64..6696194314c 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sched.c,v 1.69 2021/02/08 08:18:45 mpi Exp $ */ +/* $OpenBSD: kern_sched.c,v 1.70 2021/06/29 21:27:53 kettenis Exp $ */ /* * Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org> * @@ -638,7 +638,7 @@ sched_start_secondary_cpus(void) CPU_INFO_FOREACH(cii, ci) { struct schedstate_percpu *spc = &ci->ci_schedstate; - if (CPU_IS_PRIMARY(ci)) + if (CPU_IS_PRIMARY(ci) || !CPU_IS_RUNNING(ci)) continue; atomic_clearbits_int(&spc->spc_schedflags, SPCF_SHOULDHALT | SPCF_HALTED); @@ -656,13 +656,14 @@ sched_stop_secondary_cpus(void) CPU_INFO_ITERATOR cii; struct cpu_info *ci; + printf("%s: start\n", __func__); /* * Make sure we stop the secondary CPUs. */ CPU_INFO_FOREACH(cii, ci) { struct schedstate_percpu *spc = &ci->ci_schedstate; - if (CPU_IS_PRIMARY(ci)) + if (CPU_IS_PRIMARY(ci) || !CPU_IS_RUNNING(ci)) continue; cpuset_del(&sched_all_cpus, ci); atomic_setbits_int(&spc->spc_schedflags, SPCF_SHOULDHALT); @@ -671,7 +672,7 @@ sched_stop_secondary_cpus(void) struct schedstate_percpu *spc = &ci->ci_schedstate; struct sleep_state sls; - if (CPU_IS_PRIMARY(ci)) + if (CPU_IS_PRIMARY(ci) || !CPU_IS_RUNNING(ci)) continue; while ((spc->spc_schedflags & SPCF_HALTED) == 0) { sleep_setup(&sls, spc, PZERO, "schedstate", 0); @@ -679,6 +680,7 @@ sched_stop_secondary_cpus(void) (spc->spc_schedflags & SPCF_HALTED) == 0); } } + printf("%s: end\n", __func__); } struct sched_barrier_state { @@ -869,7 +871,7 @@ sysctl_hwsmt(void *oldp, size_t *oldlenp, void *newp, size_t newlen) sched_smt = newsmt; CPU_INFO_FOREACH(cii, ci) { - if (CPU_IS_PRIMARY(ci)) + if (CPU_IS_PRIMARY(ci) || !CPU_IS_RUNNING(ci)) continue; if (ci->ci_smt_id == 0) continue; diff --git a/sys/kern/kern_smr.c b/sys/kern/kern_smr.c index e462b8de5e3..99a6f7395ec 100644 --- a/sys/kern/kern_smr.c +++ b/sys/kern/kern_smr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_smr.c,v 1.9 2020/12/25 12:49:31 visa Exp $ */ +/* $OpenBSD: kern_smr.c,v 1.10 2021/06/29 21:27:53 kettenis Exp $ */ /* * Copyright (c) 2019-2020 Visa Hankala @@ -149,6 +149,8 @@ smr_grace_wait(void) curcpu()->ci_schedstate.spc_smrgp = smrgp; CPU_INFO_FOREACH(cii, ci) { + if (!CPU_IS_RUNNING(ci)) + continue; if (READ_ONCE(ci->ci_schedstate.spc_smrgp) == smrgp) continue; sched_peg_curproc(ci); |