summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-03-12 20:24:49 +0100
committerRichard Braun <rbraun@sceen.net>2013-03-12 20:24:49 +0100
commit4b402df37320dd649bb2178c5012e155025a0848 (patch)
treeee4a25f1881a9eca802f2c985b7556baf35266b8
parent732240c23c640669e54a3d343b62ac632ac648d7 (diff)
x86/cpu: make cpu_halt_broadcast asynchronous
If an error occurs in the scheduling code when a run queue is locked, the associated processor may not be able to progress and acknowledge the halting procedure.
-rw-r--r--arch/x86/machine/cpu.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c
index 1bbdc419..a5a62499 100644
--- a/arch/x86/machine/cpu.c
+++ b/arch/x86/machine/cpu.c
@@ -25,7 +25,6 @@
#include <kern/stdint.h>
#include <kern/string.h>
#include <machine/acpimp.h>
-#include <machine/atomic.h>
#include <machine/biosmem.h>
#include <machine/boot.h>
#include <machine/cpu.h>
@@ -90,8 +89,6 @@ static struct cpu_gate_desc cpu_idt[CPU_IDT_SIZE] __aligned(8);
static unsigned long cpu_double_fault_handler;
static char cpu_double_fault_stack[STACK_SIZE] __aligned(DATA_ALIGN);
-static volatile unsigned long cpu_nr_halts;
-
static void
cpu_seg_set_null(char *table, unsigned int selector)
{
@@ -575,7 +572,6 @@ cpu_ap_sync(void)
void
cpu_halt_broadcast(void)
{
- unsigned long nr_halts;
unsigned int nr_cpus;
assert(!cpu_intr_enabled());
@@ -585,18 +581,7 @@ cpu_halt_broadcast(void)
if (nr_cpus == 1)
return;
- nr_halts = atomic_cas(&cpu_nr_halts, 0, nr_cpus - 1);
-
- /* Another CPU has started a halt, emulate the IPI handler */
- if (nr_halts != 0) {
- atomic_add(&cpu_nr_halts, -1);
- cpu_halt();
- }
-
lapic_ipi_broadcast(TRAP_CPU_HALT);
-
- while (cpu_nr_halts != 0)
- cpu_pause();
}
void
@@ -606,6 +591,5 @@ cpu_halt_intr(struct trap_frame *frame)
lapic_eoi();
- atomic_add(&cpu_nr_halts, -1);
cpu_halt();
}