lguest: fix lguest wake on guest clock tick, or fd activity
The Launcher could be inside the Guest on another CPU; wake_up_process
will do nothing because it is "running". kick_process will knock it
back into our kernel in this case, otherwise we'll miss it until the
next guest exit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
index 6e99adb..9ea26ad 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -511,9 +511,9 @@
/* Remember the first interrupt is the timer interrupt. */
set_bit(0, cpu->irqs_pending);
- /* If the Guest is actually stopped, we need to wake it up. */
- if (cpu->halted)
- wake_up_process(cpu->tsk);
+ /* Guest may be stopped or running on another CPU. */
+ if (!wake_up_process(cpu->tsk))
+ kick_process(cpu->tsk);
return HRTIMER_NORESTART;
}
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index b8ee103..bcdcf34 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -24,8 +24,8 @@
if (on) {
cpu->break_out = 1;
- /* Pop it out of the Guest (may be running on different CPU) */
- wake_up_process(cpu->tsk);
+ if (!wake_up_process(cpu->tsk))
+ kick_process(cpu->tsk);
/* Wait for them to reset it */
return wait_event_interruptible(cpu->break_wq, !cpu->break_out);
} else {