From d6d31e0900c8d8583f2ffed11e2eb0cf1be90ffc Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Mon, 3 Apr 2006 23:56:40 +0000 Subject: [PATCH] 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. --- sys/ia64/ia64/interrupt.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/ia64/ia64/interrupt.c b/sys/ia64/ia64/interrupt.c index dbd3d6867e6e..423cd86ac8cd 100644 --- a/sys/ia64/ia64/interrupt.c +++ b/sys/ia64/ia64/interrupt.c @@ -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++;