Commit 5dac051b authored by Rusty Russell's avatar Rusty Russell

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: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 659a0e66
...@@ -209,10 +209,6 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user) ...@@ -209,10 +209,6 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
if (signal_pending(current)) if (signal_pending(current))
return -ERESTARTSYS; return -ERESTARTSYS;
/* If Waker set break_out, return to Launcher. */
if (cpu->break_out)
return -EAGAIN;
/* Check if there are any interrupts which can be delivered now: /* Check if there are any interrupts which can be delivered now:
* if so, this sets up the hander to be executed when we next * if so, this sets up the hander to be executed when we next
* run the Guest. */ * run the Guest. */
...@@ -231,13 +227,12 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user) ...@@ -231,13 +227,12 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
break; break;
/* If the Guest asked to be stopped, we sleep. The Guest's /* If the Guest asked to be stopped, we sleep. The Guest's
* clock timer or LHREQ_BREAK from the Waker will wake us. */ * clock timer will wake us. */
if (cpu->halted) { if (cpu->halted) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
/* Just before we sleep, make sure nothing snuck in /* Just before we sleep, make sure no interrupt snuck in
* which we should be doing. */ * which we should be doing. */
if (interrupt_pending(cpu, &more) < LGUEST_IRQS if (interrupt_pending(cpu, &more) < LGUEST_IRQS)
|| cpu->break_out)
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
else else
schedule(); schedule();
......
...@@ -71,9 +71,7 @@ struct lg_cpu { ...@@ -71,9 +71,7 @@ struct lg_cpu {
/* Virtual clock device */ /* Virtual clock device */
struct hrtimer hrt; struct hrtimer hrt;
/* Do we need to stop what we're doing and return to userspace? */ /* Did the Guest tell us to halt? */
int break_out;
wait_queue_head_t break_wq;
int halted; int halted;
/* Pending virtual interrupts */ /* Pending virtual interrupts */
......
...@@ -11,32 +11,6 @@ ...@@ -11,32 +11,6 @@
#include <linux/file.h> #include <linux/file.h>
#include "lg.h" #include "lg.h"
/*L:055 When something happens, the Waker process needs a way to stop the
* kernel running the Guest and return to the Launcher. So the Waker writes
* LHREQ_BREAK and the value "1" to /dev/lguest to do this. Once the Launcher
* has done whatever needs attention, it writes LHREQ_BREAK and "0" to release
* the Waker. */
static int break_guest_out(struct lg_cpu *cpu, const unsigned long __user*input)
{
unsigned long on;
/* Fetch whether they're turning break on or off. */
if (get_user(on, input) != 0)
return -EFAULT;
if (on) {
cpu->break_out = 1;
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 {
cpu->break_out = 0;
wake_up(&cpu->break_wq);
return 0;
}
}
bool send_notify_to_eventfd(struct lg_cpu *cpu) bool send_notify_to_eventfd(struct lg_cpu *cpu)
{ {
unsigned int i; unsigned int i;
...@@ -202,9 +176,6 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) ...@@ -202,9 +176,6 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip)
* address. */ * address. */
lguest_arch_setup_regs(cpu, start_ip); lguest_arch_setup_regs(cpu, start_ip);
/* Initialize the queue for the Waker to wait on */
init_waitqueue_head(&cpu->break_wq);
/* We keep a pointer to the Launcher task (ie. current task) for when /* We keep a pointer to the Launcher task (ie. current task) for when
* other Guests want to wake this one (eg. console input). */ * other Guests want to wake this one (eg. console input). */
cpu->tsk = current; cpu->tsk = current;
...@@ -344,8 +315,6 @@ static ssize_t write(struct file *file, const char __user *in, ...@@ -344,8 +315,6 @@ static ssize_t write(struct file *file, const char __user *in,
return initialize(file, input); return initialize(file, input);
case LHREQ_IRQ: case LHREQ_IRQ:
return user_send_irq(cpu, input); return user_send_irq(cpu, input);
case LHREQ_BREAK:
return break_guest_out(cpu, input);
case LHREQ_EVENTFD: case LHREQ_EVENTFD:
return attach_eventfd(lg, input); return attach_eventfd(lg, input);
default: default:
......
...@@ -57,7 +57,7 @@ enum lguest_req ...@@ -57,7 +57,7 @@ enum lguest_req
LHREQ_INITIALIZE, /* + base, pfnlimit, start */ LHREQ_INITIALIZE, /* + base, pfnlimit, start */
LHREQ_GETDMA, /* No longer used */ LHREQ_GETDMA, /* No longer used */
LHREQ_IRQ, /* + irq */ LHREQ_IRQ, /* + irq */
LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ LHREQ_BREAK, /* No longer used */
LHREQ_EVENTFD, /* + address, fd. */ LHREQ_EVENTFD, /* + address, fd. */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment