lguest: fix lguest wake on guest clock tick, or fd activity
authorRusty Russell <rusty@rustcorp.com.au>
Sat, 13 Jun 2009 04:27:01 +0000 (22:27 -0600)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 12 Jun 2009 12:57:01 +0000 (22:27 +0930)
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>
drivers/lguest/interrupts_and_traps.c
drivers/lguest/lguest_user.c

index 6e99adbe1946e8810951460872fdd59d79985ebf..9ea26ad88c9d2a75be325a4e8f1d2ee7de0f8821 100644 (file)
@@ -511,9 +511,9 @@ static enum hrtimer_restart clockdev_fn(struct hrtimer *timer)
 
        /* 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;
 }
 
index b8ee103eed5f503e44ad5ebb27aab75e81ba5bec..bcdcf3453e7811c264a2dc5b7eb76a1e57a2800d 100644 (file)
@@ -24,8 +24,8 @@ static int break_guest_out(struct lg_cpu *cpu, const unsigned long __user*input)
 
        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 {