diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-03-15 00:16:44 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-03-15 00:16:44 +0000 |
commit | 998e4cfacfe9217a1d96e9300fbce22cf7e8b6bb (patch) | |
tree | dae6b6e851344579442d3bb7b920cd7511854b0c /xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c | |
parent | b500121df2e813156a8fe6220c1e0917be35744e (diff) | |
download | xen-998e4cfacfe9217a1d96e9300fbce22cf7e8b6bb.tar.gz xen-998e4cfacfe9217a1d96e9300fbce22cf7e8b6bb.tar.bz2 xen-998e4cfacfe9217a1d96e9300fbce22cf7e8b6bb.zip |
bitkeeper revision 1.131 (3e7270ecL24hQl_PjDBYoS8hhB8GTA)
multicall.h:
new file
Many files:
Multicall now available, so that Xen syscalls can be batched to amortise cost of trap to ring 0. Used by xenolinux to reduce the cost of a context switch.
Diffstat (limited to 'xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c')
-rw-r--r-- | xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c index a4e4cd2497..32ce1a66ab 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c @@ -43,6 +43,7 @@ #include <asm/i387.h> #include <asm/desc.h> #include <asm/mmu_context.h> +#include <asm/multicall.h> #include <linux/irq.h> @@ -85,7 +86,7 @@ void cpu_idle (void) while (1) { while (!current->need_resched) - HYPERVISOR_do_sched_op(NULL); + HYPERVISOR_yield(); schedule(); check_pgt_cache(); } @@ -334,9 +335,28 @@ void __switch_to(struct task_struct *prev_p, struct task_struct *next_p) struct thread_struct *prev = &prev_p->thread, *next = &next_p->thread; - unlazy_fpu(prev_p); + /* + * This is basically 'unlazy_fpu', except that we queue a multicall to + * indicate FPU task switch, rather than synchronously trapping to Xen. + */ + if ( prev_p->flags & PF_USEDFPU ) + { + if ( cpu_has_fxsr ) + asm volatile( "fxsave %0 ; fnclex" + : "=m" (prev_p->thread.i387.fxsave) ); + else + asm volatile( "fnsave %0 ; fwait" + : "=m" (prev_p->thread.i387.fsave) ); + prev_p->flags &= ~PF_USEDFPU; + queue_multicall0(__HYPERVISOR_fpu_taskswitch); + } + + if ( next->esp0 != 0 ) + queue_multicall2(__HYPERVISOR_stack_switch, __KERNEL_DS, next->esp0); - HYPERVISOR_stack_and_ldt_switch(__KERNEL_DS, next->esp0, 0); + /* EXECUTE ALL TASK SWITCH XEN SYSCALLS AT THIS POINT. */ + execute_multicall_list(); + sti(); /* matches 'cli' in switch_mm() */ /* * Save away %fs and %gs. No need to save %es and %ds, as |