diff options
| author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-05-01 09:35:51 +0200 |
|---|---|---|
| committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-05-01 09:35:51 +0200 |
| commit | 54562b6ac2f88c6a29264bb20e1fa5292f6ee8b9 (patch) | |
| tree | 8bcdcd606899eb62d80131be82cdf1f9a16c2043 | |
| parent | 97a2f14b1c7960713ba2f7b284a6055cda8e101e (diff) | |
| download | plan9front-54562b6ac2f88c6a29264bb20e1fa5292f6ee8b9.tar.xz | |
kernel: insert memory barrier in the scheduler before setting up->mach = nil
we have to ensure that all stores saving the process state
have completed before setting up->mach = nil in the scheduler.
otherwise, another cpu could observe up->mach == nil while
the stores such as the processes p->sched label have not finnished.
| -rw-r--r-- | sys/src/9/port/proc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/9/port/proc.c b/sys/src/9/port/proc.c index 4d5b98f6f..33166ce39 100644 --- a/sys/src/9/port/proc.c +++ b/sys/src/9/port/proc.c @@ -70,6 +70,9 @@ schedinit(void) /* never returns */ edfrecord(up); m->proc = nil; switch(up->state) { + default: + updatecpu(up); + break; case Running: ready(up); break; @@ -88,8 +91,8 @@ schedinit(void) /* never returns */ mmurelease(up); unlock(&palloc); - up->mach = nil; updatecpu(up); + up->mach = nil; up->qnext = procalloc.free; procalloc.free = up; @@ -99,8 +102,8 @@ schedinit(void) /* never returns */ unlock(&procalloc); sched(); } + coherence(); up->mach = nil; - updatecpu(up); up = nil; } sched(); |
