diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-06-13 00:27:02 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-06-12 08:57:02 -0400 |
commit | abd41f037e1a64543000ed73b42f616d04d92700 (patch) | |
tree | d9013e66f4d8fc66fc92ce0587f8d126e156b253 /drivers/lguest/lg.h | |
parent | ebf9a5a99c1a464afe0b4dfa64416fc8b273bc5c (diff) |
lguest: fix race in halt code
When the Guest does the LHCALL_HALT hypercall, we go to sleep, expecting
that a timer or the Waker will wake_up_process() us.
But we do it in a stupid way, leaving a classic missing wakeup race.
So split maybe_do_interrupt() into interrupt_pending() and
try_deliver_interrupt(), and check maybe_do_interrupt() and the
"break_out" flag before calling schedule.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/lg.h')
-rw-r--r-- | drivers/lguest/lg.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index af92a176697f..6743cf147d97 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h | |||
@@ -139,7 +139,8 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user); | |||
139 | #define pgd_pfn(x) (pgd_val(x) >> PAGE_SHIFT) | 139 | #define pgd_pfn(x) (pgd_val(x) >> PAGE_SHIFT) |
140 | 140 | ||
141 | /* interrupts_and_traps.c: */ | 141 | /* interrupts_and_traps.c: */ |
142 | void maybe_do_interrupt(struct lg_cpu *cpu); | 142 | unsigned int interrupt_pending(struct lg_cpu *cpu); |
143 | void try_deliver_interrupt(struct lg_cpu *cpu, unsigned int irq); | ||
143 | bool deliver_trap(struct lg_cpu *cpu, unsigned int num); | 144 | bool deliver_trap(struct lg_cpu *cpu, unsigned int num); |
144 | void load_guest_idt_entry(struct lg_cpu *cpu, unsigned int i, | 145 | void load_guest_idt_entry(struct lg_cpu *cpu, unsigned int i, |
145 | u32 low, u32 hi); | 146 | u32 low, u32 hi); |