Commit a6c372de6e4b9a8188b66badcee3e3792eccdd26
1 parent
b43e352139
Exists in
master
and in
7 other branches
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>
Showing 2 changed files with 5 additions and 5 deletions Side-by-side Diff
drivers/lguest/interrupts_and_traps.c
... | ... | @@ -511,9 +511,9 @@ |
511 | 511 | |
512 | 512 | /* Remember the first interrupt is the timer interrupt. */ |
513 | 513 | set_bit(0, cpu->irqs_pending); |
514 | - /* If the Guest is actually stopped, we need to wake it up. */ | |
515 | - if (cpu->halted) | |
516 | - wake_up_process(cpu->tsk); | |
514 | + /* Guest may be stopped or running on another CPU. */ | |
515 | + if (!wake_up_process(cpu->tsk)) | |
516 | + kick_process(cpu->tsk); | |
517 | 517 | return HRTIMER_NORESTART; |
518 | 518 | } |
519 | 519 |
drivers/lguest/lguest_user.c
... | ... | @@ -24,8 +24,8 @@ |
24 | 24 | |
25 | 25 | if (on) { |
26 | 26 | cpu->break_out = 1; |
27 | - /* Pop it out of the Guest (may be running on different CPU) */ | |
28 | - wake_up_process(cpu->tsk); | |
27 | + if (!wake_up_process(cpu->tsk)) | |
28 | + kick_process(cpu->tsk); | |
29 | 29 | /* Wait for them to reset it */ |
30 | 30 | return wait_event_interruptible(cpu->break_wq, !cpu->break_out); |
31 | 31 | } else { |