Commit 5e232f4f authored by Glauber de Oliveira Costa's avatar Glauber de Oliveira Costa Committed by Rusty Russell

lguest: make pending notifications per-vcpu

this patch makes the pending_notify field, used to control
pending notifications, per-vcpu, instead of per-guest
Signed-off-by: default avatarGlauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 4665ac8e
...@@ -186,10 +186,10 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user) ...@@ -186,10 +186,10 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
/* It's possible the Guest did a NOTIFY hypercall to the /* It's possible the Guest did a NOTIFY hypercall to the
* Launcher, in which case we return from the read() now. */ * Launcher, in which case we return from the read() now. */
if (lg->pending_notify) { if (cpu->pending_notify) {
if (put_user(lg->pending_notify, user)) if (put_user(cpu->pending_notify, user))
return -EFAULT; return -EFAULT;
return sizeof(lg->pending_notify); return sizeof(cpu->pending_notify);
} }
/* Check for signals */ /* Check for signals */
......
...@@ -91,7 +91,7 @@ static void do_hcall(struct lg_cpu *cpu, struct hcall_args *args) ...@@ -91,7 +91,7 @@ static void do_hcall(struct lg_cpu *cpu, struct hcall_args *args)
cpu->halted = 1; cpu->halted = 1;
break; break;
case LHCALL_NOTIFY: case LHCALL_NOTIFY:
lg->pending_notify = args->arg1; cpu->pending_notify = args->arg1;
break; break;
default: default:
/* It should be an architecture-specific hypercall. */ /* It should be an architecture-specific hypercall. */
...@@ -154,7 +154,7 @@ static void do_async_hcalls(struct lg_cpu *cpu) ...@@ -154,7 +154,7 @@ static void do_async_hcalls(struct lg_cpu *cpu)
/* Stop doing hypercalls if they want to notify the Launcher: /* Stop doing hypercalls if they want to notify the Launcher:
* it needs to service this first. */ * it needs to service this first. */
if (lg->pending_notify) if (cpu->pending_notify)
break; break;
} }
} }
...@@ -219,7 +219,7 @@ void do_hypercalls(struct lg_cpu *cpu) ...@@ -219,7 +219,7 @@ void do_hypercalls(struct lg_cpu *cpu)
/* If we stopped reading the hypercall ring because the Guest did a /* If we stopped reading the hypercall ring because the Guest did a
* NOTIFY to the Launcher, we want to return now. Otherwise we do * NOTIFY to the Launcher, we want to return now. Otherwise we do
* the hypercall. */ * the hypercall. */
if (!cpu->lg->pending_notify) { if (!cpu->pending_notify) {
do_hcall(cpu, cpu->hcall); do_hcall(cpu, cpu->hcall);
/* Tricky point: we reset the hcall pointer to mark the /* Tricky point: we reset the hcall pointer to mark the
* hypercall as "done". We use the hcall pointer rather than * hypercall as "done". We use the hcall pointer rather than
......
...@@ -51,6 +51,8 @@ struct lg_cpu { ...@@ -51,6 +51,8 @@ struct lg_cpu {
u32 esp1; u32 esp1;
u8 ss1; u8 ss1;
unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */
/* At end of a page shared mapped over lguest_pages in guest. */ /* At end of a page shared mapped over lguest_pages in guest. */
unsigned long regs_page; unsigned long regs_page;
struct lguest_regs *regs; struct lguest_regs *regs;
...@@ -95,7 +97,6 @@ struct lguest ...@@ -95,7 +97,6 @@ struct lguest
struct pgdir pgdirs[4]; struct pgdir pgdirs[4];
unsigned long noirq_start, noirq_end; unsigned long noirq_start, noirq_end;
unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */
unsigned int stack_pages; unsigned int stack_pages;
u32 tsc_khz; u32 tsc_khz;
......
...@@ -89,8 +89,8 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o) ...@@ -89,8 +89,8 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
/* If we returned from read() last time because the Guest notified, /* If we returned from read() last time because the Guest notified,
* clear the flag. */ * clear the flag. */
if (lg->pending_notify) if (cpu->pending_notify)
lg->pending_notify = 0; cpu->pending_notify = 0;
/* Run the Guest until something interesting happens. */ /* Run the Guest until something interesting happens. */
return run_guest(cpu, (unsigned long __user *)user); return run_guest(cpu, (unsigned long __user *)user);
......
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