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.
This commit is contained in:
parent
97a2f14b1c
commit
54562b6ac2
1 changed files with 5 additions and 2 deletions
|
@ -70,6 +70,9 @@ schedinit(void) /* never returns */
|
||||||
edfrecord(up);
|
edfrecord(up);
|
||||||
m->proc = nil;
|
m->proc = nil;
|
||||||
switch(up->state) {
|
switch(up->state) {
|
||||||
|
default:
|
||||||
|
updatecpu(up);
|
||||||
|
break;
|
||||||
case Running:
|
case Running:
|
||||||
ready(up);
|
ready(up);
|
||||||
break;
|
break;
|
||||||
|
@ -88,8 +91,8 @@ schedinit(void) /* never returns */
|
||||||
mmurelease(up);
|
mmurelease(up);
|
||||||
unlock(&palloc);
|
unlock(&palloc);
|
||||||
|
|
||||||
up->mach = nil;
|
|
||||||
updatecpu(up);
|
updatecpu(up);
|
||||||
|
up->mach = nil;
|
||||||
|
|
||||||
up->qnext = procalloc.free;
|
up->qnext = procalloc.free;
|
||||||
procalloc.free = up;
|
procalloc.free = up;
|
||||||
|
@ -99,8 +102,8 @@ schedinit(void) /* never returns */
|
||||||
unlock(&procalloc);
|
unlock(&procalloc);
|
||||||
sched();
|
sched();
|
||||||
}
|
}
|
||||||
|
coherence();
|
||||||
up->mach = nil;
|
up->mach = nil;
|
||||||
updatecpu(up);
|
|
||||||
up = nil;
|
up = nil;
|
||||||
}
|
}
|
||||||
sched();
|
sched();
|
||||||
|
|
Loading…
Reference in a new issue