diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-02-18 02:46:21 -0500 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-03-30 02:36:00 -0400 |
commit | b407fc57b815b2016186220baabc76cc8264206e (patch) | |
tree | 29949f727af8b6c19fd689fa10f123ea84c03cb0 /arch/x86/kernel/vmi_32.c | |
parent | 7fd7d83d49914f03aefffba6aee09032fcd54cce (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/vmi_32.c')
-rw-r--r-- | arch/x86/kernel/vmi_32.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index 2cc4a90e2cb3..950929c607d3 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
@@ -473,16 +473,22 @@ static void vmi_enter_lazy_cpu(void) | |||
473 | vmi_ops.set_lazy_mode(2); | 473 | vmi_ops.set_lazy_mode(2); |
474 | } | 474 | } |
475 | 475 | ||
476 | static void vmi_leave_lazy_cpu(void) | ||
477 | { | ||
478 | vmi_ops.set_lazy_mode(0); | ||
479 | paravirt_leave_lazy_cpu(); | ||
480 | } | ||
481 | |||
476 | static void vmi_enter_lazy_mmu(void) | 482 | static void vmi_enter_lazy_mmu(void) |
477 | { | 483 | { |
478 | paravirt_enter_lazy_mmu(); | 484 | paravirt_enter_lazy_mmu(); |
479 | vmi_ops.set_lazy_mode(1); | 485 | vmi_ops.set_lazy_mode(1); |
480 | } | 486 | } |
481 | 487 | ||
482 | static void vmi_leave_lazy(void) | 488 | static void vmi_leave_lazy_mmu(void) |
483 | { | 489 | { |
484 | paravirt_leave_lazy(paravirt_get_lazy_mode()); | ||
485 | vmi_ops.set_lazy_mode(0); | 490 | vmi_ops.set_lazy_mode(0); |
491 | paravirt_leave_lazy_mmu(); | ||
486 | } | 492 | } |
487 | 493 | ||
488 | static inline int __init check_vmi_rom(struct vrom_header *rom) | 494 | static inline int __init check_vmi_rom(struct vrom_header *rom) |
@@ -718,12 +724,12 @@ static inline int __init activate_vmi(void) | |||
718 | 724 | ||
719 | para_wrap(pv_cpu_ops.lazy_mode.enter, vmi_enter_lazy_cpu, | 725 | para_wrap(pv_cpu_ops.lazy_mode.enter, vmi_enter_lazy_cpu, |
720 | set_lazy_mode, SetLazyMode); | 726 | set_lazy_mode, SetLazyMode); |
721 | para_wrap(pv_cpu_ops.lazy_mode.leave, vmi_leave_lazy, | 727 | para_wrap(pv_cpu_ops.lazy_mode.leave, vmi_leave_lazy_cpu, |
722 | set_lazy_mode, SetLazyMode); | 728 | set_lazy_mode, SetLazyMode); |
723 | 729 | ||
724 | para_wrap(pv_mmu_ops.lazy_mode.enter, vmi_enter_lazy_mmu, | 730 | para_wrap(pv_mmu_ops.lazy_mode.enter, vmi_enter_lazy_mmu, |
725 | set_lazy_mode, SetLazyMode); | 731 | set_lazy_mode, SetLazyMode); |
726 | para_wrap(pv_mmu_ops.lazy_mode.leave, vmi_leave_lazy, | 732 | para_wrap(pv_mmu_ops.lazy_mode.leave, vmi_leave_lazy_mmu, |
727 | set_lazy_mode, SetLazyMode); | 733 | set_lazy_mode, SetLazyMode); |
728 | 734 | ||
729 | /* user and kernel flush are just handled with different flags to FlushTLB */ | 735 | /* user and kernel flush are just handled with different flags to FlushTLB */ |