aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/lguest/lg.h3
-rw-r--r--drivers/lguest/lguest_user.c8
-rw-r--r--drivers/lguest/x86/core.c4
3 files changed, 8 insertions, 7 deletions
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 94e518da9aa8..f1c4c33e4153 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -57,6 +57,8 @@ struct lg_cpu {
57 unsigned long regs_page; 57 unsigned long regs_page;
58 struct lguest_regs *regs; 58 struct lguest_regs *regs;
59 59
60 struct lguest_pages *last_pages;
61
60 int cpu_pgd; /* which pgd this cpu is currently using */ 62 int cpu_pgd; /* which pgd this cpu is currently using */
61 63
62 /* If a hypercall was asked for, this points to the arguments. */ 64 /* If a hypercall was asked for, this points to the arguments. */
@@ -92,7 +94,6 @@ struct lguest
92 94
93 /* Bitmap of what has changed: see CHANGED_* above. */ 95 /* Bitmap of what has changed: see CHANGED_* above. */
94 int changed; 96 int changed;
95 struct lguest_pages *last_pages;
96 97
97 struct pgdir pgdirs[4]; 98 struct pgdir pgdirs[4];
98 99
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index f4f6df85bece..a87fca678c6b 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -131,6 +131,10 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip)
131 * reference, it is destroyed before close() is called. */ 131 * reference, it is destroyed before close() is called. */
132 cpu->mm = get_task_mm(cpu->tsk); 132 cpu->mm = get_task_mm(cpu->tsk);
133 133
134 /* We remember which CPU's pages this Guest used last, for optimization
135 * when the same Guest runs on the same CPU twice. */
136 cpu->last_pages = NULL;
137
134 return 0; 138 return 0;
135} 139}
136 140
@@ -192,10 +196,6 @@ static int initialize(struct file *file, const unsigned long __user *input)
192 if (err) 196 if (err)
193 goto free_regs; 197 goto free_regs;
194 198
195 /* We remember which CPU's pages this Guest used last, for optimization
196 * when the same Guest runs on the same CPU twice. */
197 lg->last_pages = NULL;
198
199 /* We keep our "struct lguest" in the file's private_data. */ 199 /* We keep our "struct lguest" in the file's private_data. */
200 file->private_data = lg; 200 file->private_data = lg;
201 201
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 10eab6748d84..f8dfdc9a3e5b 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -80,9 +80,9 @@ static void copy_in_guest_info(struct lg_cpu *cpu, struct lguest_pages *pages)
80 * same Guest we ran last time (and that Guest hasn't run anywhere else 80 * same Guest we ran last time (and that Guest hasn't run anywhere else
81 * meanwhile). If that's not the case, we pretend everything in the 81 * meanwhile). If that's not the case, we pretend everything in the
82 * Guest has changed. */ 82 * Guest has changed. */
83 if (__get_cpu_var(last_cpu) != cpu || lg->last_pages != pages) { 83 if (__get_cpu_var(last_cpu) != cpu || cpu->last_pages != pages) {
84 __get_cpu_var(last_cpu) = cpu; 84 __get_cpu_var(last_cpu) = cpu;
85 lg->last_pages = pages; 85 cpu->last_pages = pages;
86 lg->changed = CHANGED_ALL; 86 lg->changed = CHANGED_ALL;
87 } 87 }
88 88