Improve handling of IPI_STOP:

o  use atomic operations to fiddle with stopped_cpus and started_cpus.
o  disable interrupts while we're waiting to be started.
o  remove logic relating to cpustop_restartfunc as it's not used.
This commit is contained in:
Marcel Moolenaar 2006-04-03 23:56:40 +00:00
parent bfcdefd8aa
commit d6d31e0900
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157449

View File

@ -220,20 +220,17 @@ interrupt(u_int64_t vector, struct trapframe *tf)
CTR1(KTR_SMP, "IPI_RENDEZVOUS, cpuid=%d", PCPU_GET(cpuid));
smp_rendezvous_action();
} else if (vector == ipi_vector[IPI_STOP]) {
u_int32_t mybit = PCPU_GET(cpumask);
register_t intr;
cpumask_t mybit = PCPU_GET(cpumask);
CTR1(KTR_SMP, "IPI_STOP, cpuid=%d", PCPU_GET(cpuid));
intr = intr_disable();
savectx(PCPU_GET(pcb));
stopped_cpus |= mybit;
atomic_set_int(&stopped_cpus, mybit);
while ((started_cpus & mybit) == 0)
/* spin */;
started_cpus &= ~mybit;
stopped_cpus &= ~mybit;
if (PCPU_GET(cpuid) == 0 && cpustop_restartfunc != NULL) {
void (*f)(void) = cpustop_restartfunc;
cpustop_restartfunc = NULL;
(*f)();
}
atomic_clear_int(&started_cpus, mybit);
atomic_clear_int(&stopped_cpus, mybit);
intr_restore(intr);
} else if (vector == ipi_vector[IPI_TEST]) {
CTR1(KTR_SMP, "IPI_TEST, cpuid=%d", PCPU_GET(cpuid));
mp_ipi_test++;