aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-02-18 14:18:57 -0500
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-03-30 02:36:01 -0400
commit224101ed69d3fbb486868e0f6e0f9fa37302efb4 (patch)
tree46830842a99659421eeabee65d299ab4c3b59f28 /arch/x86/kernel
parentb407fc57b815b2016186220baabc76cc8264206e (diff)
x86/paravirt: finish change from lazy cpu to context switch start/end
Impact: fix lazy context switch API Pass the previous and next tasks into the context switch start end calls, so that the called functions can properly access the task state (esp in end_context_switch, in which the next task is not yet completely current). Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/paravirt.c14
-rw-r--r--arch/x86/kernel/process_32.c2
-rw-r--r--arch/x86/kernel/process_64.c2
-rw-r--r--arch/x86/kernel/vmi_32.c12
4 files changed, 14 insertions, 16 deletions
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 430a0e30577..cf1437503ba 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -270,20 +270,20 @@ void paravirt_leave_lazy_mmu(void)
270 leave_lazy(PARAVIRT_LAZY_MMU); 270 leave_lazy(PARAVIRT_LAZY_MMU);
271} 271}
272 272
273void paravirt_enter_lazy_cpu(void) 273void paravirt_start_context_switch(struct task_struct *prev)
274{ 274{
275 if (percpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) { 275 if (percpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) {
276 arch_leave_lazy_mmu_mode(); 276 arch_leave_lazy_mmu_mode();
277 set_thread_flag(TIF_LAZY_MMU_UPDATES); 277 set_ti_thread_flag(task_thread_info(prev), TIF_LAZY_MMU_UPDATES);
278 } 278 }
279 enter_lazy(PARAVIRT_LAZY_CPU); 279 enter_lazy(PARAVIRT_LAZY_CPU);
280} 280}
281 281
282void paravirt_leave_lazy_cpu(void) 282void paravirt_end_context_switch(struct task_struct *next)
283{ 283{
284 leave_lazy(PARAVIRT_LAZY_CPU); 284 leave_lazy(PARAVIRT_LAZY_CPU);
285 285
286 if (test_and_clear_thread_flag(TIF_LAZY_MMU_UPDATES)) 286 if (test_and_clear_ti_thread_flag(task_thread_info(next), TIF_LAZY_MMU_UPDATES))
287 arch_enter_lazy_mmu_mode(); 287 arch_enter_lazy_mmu_mode();
288} 288}
289 289
@@ -399,10 +399,8 @@ struct pv_cpu_ops pv_cpu_ops = {
399 .set_iopl_mask = native_set_iopl_mask, 399 .set_iopl_mask = native_set_iopl_mask,
400 .io_delay = native_io_delay, 400 .io_delay = native_io_delay,
401 401
402 .lazy_mode = { 402 .start_context_switch = paravirt_nop,
403 .enter = paravirt_nop, 403 .end_context_switch = paravirt_nop,
404 .leave = paravirt_nop,
405 },
406}; 404};
407 405
408struct pv_apic_ops pv_apic_ops = { 406struct pv_apic_ops pv_apic_ops = {
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 57e49a8278a..d766c7616fd 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -407,7 +407,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
407 * done before math_state_restore, so the TS bit is up 407 * done before math_state_restore, so the TS bit is up
408 * to date. 408 * to date.
409 */ 409 */
410 arch_end_context_switch(); 410 arch_end_context_switch(next_p);
411 411
412 /* If the task has used fpu the last 5 timeslices, just do a full 412 /* If the task has used fpu the last 5 timeslices, just do a full
413 * restore of the math state immediately to avoid the trap; the 413 * restore of the math state immediately to avoid the trap; the
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 7115e608532..e8a9aaf9df8 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -428,7 +428,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
428 * done before math_state_restore, so the TS bit is up 428 * done before math_state_restore, so the TS bit is up
429 * to date. 429 * to date.
430 */ 430 */
431 arch_end_context_switch(); 431 arch_end_context_switch(next_p);
432 432
433 /* 433 /*
434 * Switch FS and GS. 434 * Switch FS and GS.
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index 950929c607d..55a5d6938e5 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -467,16 +467,16 @@ vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
467} 467}
468#endif 468#endif
469 469
470static void vmi_enter_lazy_cpu(void) 470static void vmi_start_context_switch(struct task_struct *prev)
471{ 471{
472 paravirt_enter_lazy_cpu(); 472 paravirt_start_context_switch(prev);
473 vmi_ops.set_lazy_mode(2); 473 vmi_ops.set_lazy_mode(2);
474} 474}
475 475
476static void vmi_leave_lazy_cpu(void) 476static void vmi_end_context_switch(struct task_struct *next)
477{ 477{
478 vmi_ops.set_lazy_mode(0); 478 vmi_ops.set_lazy_mode(0);
479 paravirt_leave_lazy_cpu(); 479 paravirt_end_context_switch(next);
480} 480}
481 481
482static void vmi_enter_lazy_mmu(void) 482static void vmi_enter_lazy_mmu(void)
@@ -722,9 +722,9 @@ static inline int __init activate_vmi(void)
722 para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask); 722 para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask);
723 para_fill(pv_cpu_ops.io_delay, IODelay); 723 para_fill(pv_cpu_ops.io_delay, IODelay);
724 724
725 para_wrap(pv_cpu_ops.lazy_mode.enter, vmi_enter_lazy_cpu, 725 para_wrap(pv_cpu_ops.start_context_switch, vmi_start_context_switch,
726 set_lazy_mode, SetLazyMode); 726 set_lazy_mode, SetLazyMode);
727 para_wrap(pv_cpu_ops.lazy_mode.leave, vmi_leave_lazy_cpu, 727 para_wrap(pv_cpu_ops.end_context_switch, vmi_end_context_switch,
728 set_lazy_mode, SetLazyMode); 728 set_lazy_mode, SetLazyMode);
729 729
730 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,