aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-06-13 00:27:10 -0400
committerRusty Russell <rusty@rustcorp.com.au>2009-06-12 08:57:11 -0400
commit5dac051bc6030963181b69faddd9e0ad04f85fa8 (patch)
tree4a0456e1d971bbe9f68f4ac13d31716c12fbb618
parent659a0e6633567246edcb7bd400c7e2bece9237d9 (diff)
lguest: remove obsolete LHREQ_BREAK call
We no longer need an efficient mechanism to force the Guest back into host userspace, as each device is serviced without bothering the main Guest process (aka. the Launcher). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--drivers/lguest/core.c11
-rw-r--r--drivers/lguest/lg.h4
-rw-r--r--drivers/lguest/lguest_user.c31
-rw-r--r--include/linux/lguest_launcher.h2
4 files changed, 5 insertions, 43 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 508569c9571a..a6974e9b8ebf 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -209,10 +209,6 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
209 if (signal_pending(current)) 209 if (signal_pending(current))
210 return -ERESTARTSYS; 210 return -ERESTARTSYS;
211 211
212 /* If Waker set break_out, return to Launcher. */
213 if (cpu->break_out)
214 return -EAGAIN;
215
216 /* Check if there are any interrupts which can be delivered now: 212 /* Check if there are any interrupts which can be delivered now:
217 * if so, this sets up the hander to be executed when we next 213 * if so, this sets up the hander to be executed when we next
218 * run the Guest. */ 214 * run the Guest. */
@@ -231,13 +227,12 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
231 break; 227 break;
232 228
233 /* If the Guest asked to be stopped, we sleep. The Guest's 229 /* If the Guest asked to be stopped, we sleep. The Guest's
234 * clock timer or LHREQ_BREAK from the Waker will wake us. */ 230 * clock timer will wake us. */
235 if (cpu->halted) { 231 if (cpu->halted) {
236 set_current_state(TASK_INTERRUPTIBLE); 232 set_current_state(TASK_INTERRUPTIBLE);
237 /* Just before we sleep, make sure nothing snuck in 233 /* Just before we sleep, make sure no interrupt snuck in
238 * which we should be doing. */ 234 * which we should be doing. */
239 if (interrupt_pending(cpu, &more) < LGUEST_IRQS 235 if (interrupt_pending(cpu, &more) < LGUEST_IRQS)
240 || cpu->break_out)
241 set_current_state(TASK_RUNNING); 236 set_current_state(TASK_RUNNING);
242 else 237 else
243 schedule(); 238 schedule();
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 32fefdc6ad3e..d4e8979735cb 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -71,9 +71,7 @@ struct lg_cpu {
71 /* Virtual clock device */ 71 /* Virtual clock device */
72 struct hrtimer hrt; 72 struct hrtimer hrt;
73 73
74 /* Do we need to stop what we're doing and return to userspace? */ 74 /* Did the Guest tell us to halt? */
75 int break_out;
76 wait_queue_head_t break_wq;
77 int halted; 75 int halted;
78 76
79 /* Pending virtual interrupts */ 77 /* Pending virtual interrupts */
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index f6bf255f1837..32e297121058 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -11,32 +11,6 @@
11#include <linux/file.h> 11#include <linux/file.h>
12#include "lg.h" 12#include "lg.h"
13 13
14/*L:055 When something happens, the Waker process needs a way to stop the
15 * kernel running the Guest and return to the Launcher. So the Waker writes
16 * LHREQ_BREAK and the value "1" to /dev/lguest to do this. Once the Launcher
17 * has done whatever needs attention, it writes LHREQ_BREAK and "0" to release
18 * the Waker. */
19static int break_guest_out(struct lg_cpu *cpu, const unsigned long __user*input)
20{
21 unsigned long on;
22
23 /* Fetch whether they're turning break on or off. */
24 if (get_user(on, input) != 0)
25 return -EFAULT;
26
27 if (on) {
28 cpu->break_out = 1;
29 if (!wake_up_process(cpu->tsk))
30 kick_process(cpu->tsk);
31 /* Wait for them to reset it */
32 return wait_event_interruptible(cpu->break_wq, !cpu->break_out);
33 } else {
34 cpu->break_out = 0;
35 wake_up(&cpu->break_wq);
36 return 0;
37 }
38}
39
40bool send_notify_to_eventfd(struct lg_cpu *cpu) 14bool send_notify_to_eventfd(struct lg_cpu *cpu)
41{ 15{
42 unsigned int i; 16 unsigned int i;
@@ -202,9 +176,6 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip)
202 * address. */ 176 * address. */
203 lguest_arch_setup_regs(cpu, start_ip); 177 lguest_arch_setup_regs(cpu, start_ip);
204 178
205 /* Initialize the queue for the Waker to wait on */
206 init_waitqueue_head(&cpu->break_wq);
207
208 /* We keep a pointer to the Launcher task (ie. current task) for when 179 /* We keep a pointer to the Launcher task (ie. current task) for when
209 * other Guests want to wake this one (eg. console input). */ 180 * other Guests want to wake this one (eg. console input). */
210 cpu->tsk = current; 181 cpu->tsk = current;
@@ -344,8 +315,6 @@ static ssize_t write(struct file *file, const char __user *in,
344 return initialize(file, input); 315 return initialize(file, input);
345 case LHREQ_IRQ: 316 case LHREQ_IRQ:
346 return user_send_irq(cpu, input); 317 return user_send_irq(cpu, input);
347 case LHREQ_BREAK:
348 return break_guest_out(cpu, input);
349 case LHREQ_EVENTFD: 318 case LHREQ_EVENTFD:
350 return attach_eventfd(lg, input); 319 return attach_eventfd(lg, input);
351 default: 320 default:
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index 9de964b90586..bfefbdf7498a 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -57,7 +57,7 @@ enum lguest_req
57 LHREQ_INITIALIZE, /* + base, pfnlimit, start */ 57 LHREQ_INITIALIZE, /* + base, pfnlimit, start */
58 LHREQ_GETDMA, /* No longer used */ 58 LHREQ_GETDMA, /* No longer used */
59 LHREQ_IRQ, /* + irq */ 59 LHREQ_IRQ, /* + irq */
60 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ 60 LHREQ_BREAK, /* No longer used */
61 LHREQ_EVENTFD, /* + address, fd. */ 61 LHREQ_EVENTFD, /* + address, fd. */
62}; 62};
63 63