aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/paravirt.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-02-18 02:46:21 -0500
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-03-30 02:36:00 -0400
commitb407fc57b815b2016186220baabc76cc8264206e (patch)
tree29949f727af8b6c19fd689fa10f123ea84c03cb0 /arch/x86/kernel/paravirt.c
parent7fd7d83d49914f03aefffba6aee09032fcd54cce (diff)
x86/paravirt: flush pending mmu updates on context switch
Impact: allow preemption during lazy mmu updates If we're in lazy mmu mode when context switching, leave lazy mmu mode, but remember the task's state in TIF_LAZY_MMU_UPDATES. When we resume the task, check this flag and re-enter lazy mmu mode if its set. This sets things up for allowing lazy mmu mode while preemptible, though that won't actually be active until the next change. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Diffstat (limited to 'arch/x86/kernel/paravirt.c')
-rw-r--r--arch/x86/kernel/paravirt.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 5eea9548216b..430a0e30577b 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -252,7 +252,7 @@ static inline void enter_lazy(enum paravirt_lazy_mode mode)
252 __get_cpu_var(paravirt_lazy_mode) = mode; 252 __get_cpu_var(paravirt_lazy_mode) = mode;
253} 253}
254 254
255void paravirt_leave_lazy(enum paravirt_lazy_mode mode) 255static void leave_lazy(enum paravirt_lazy_mode mode)
256{ 256{
257 BUG_ON(__get_cpu_var(paravirt_lazy_mode) != mode); 257 BUG_ON(__get_cpu_var(paravirt_lazy_mode) != mode);
258 BUG_ON(preemptible()); 258 BUG_ON(preemptible());
@@ -267,17 +267,24 @@ void paravirt_enter_lazy_mmu(void)
267 267
268void paravirt_leave_lazy_mmu(void) 268void paravirt_leave_lazy_mmu(void)
269{ 269{
270 paravirt_leave_lazy(PARAVIRT_LAZY_MMU); 270 leave_lazy(PARAVIRT_LAZY_MMU);
271} 271}
272 272
273void paravirt_enter_lazy_cpu(void) 273void paravirt_enter_lazy_cpu(void)
274{ 274{
275 if (percpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) {
276 arch_leave_lazy_mmu_mode();
277 set_thread_flag(TIF_LAZY_MMU_UPDATES);
278 }
275 enter_lazy(PARAVIRT_LAZY_CPU); 279 enter_lazy(PARAVIRT_LAZY_CPU);
276} 280}
277 281
278void paravirt_leave_lazy_cpu(void) 282void paravirt_leave_lazy_cpu(void)
279{ 283{
280 paravirt_leave_lazy(PARAVIRT_LAZY_CPU); 284 leave_lazy(PARAVIRT_LAZY_CPU);
285
286 if (test_and_clear_thread_flag(TIF_LAZY_MMU_UPDATES))
287 arch_enter_lazy_mmu_mode();
281} 288}
282 289
283enum paravirt_lazy_mode paravirt_get_lazy_mode(void) 290enum paravirt_lazy_mode paravirt_get_lazy_mode(void)