direct-io.hg

changeset 2201:adf2043c9382

bitkeeper revision 1.1159.17.17 (411b544doTQiJqVLC1XKbmd3zpnhzQ)

Use multicalls for context switch.
author cl349@freefall.cl.cam.ac.uk
date Thu Aug 12 11:28:13 2004 +0000 (2004-08-12)
parents be6e22d4e208
children a3feaa0784a7
files linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c
line diff
     1.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c	Thu Aug 12 09:26:13 2004 +0000
     1.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c	Thu Aug 12 11:28:13 2004 +0000
     1.3 @@ -46,6 +46,8 @@
     1.4  #include <asm/i387.h>
     1.5  #include <asm/irq.h>
     1.6  #include <asm/desc.h>
     1.7 +#include <asm-xen/multicall.h>
     1.8 +#include <asm/hypervisor-ifs/dom0_ops.h>
     1.9  #ifdef CONFIG_MATH_EMULATION
    1.10  #include <asm/math_emu.h>
    1.11  #endif
    1.12 @@ -501,6 +503,7 @@ struct task_struct fastcall * __switch_t
    1.13  	int cpu = smp_processor_id();
    1.14  	struct tss_struct *tss = init_tss + cpu;
    1.15  	unsigned long flags;
    1.16 +	dom0_op_t op;
    1.17  
    1.18  	local_irq_save(flags);
    1.19  
    1.20 @@ -522,30 +525,51 @@ struct task_struct fastcall * __switch_t
    1.21  		"xorl %%eax,%%eax; movl %%eax,%%fs; movl %%eax,%%gs" : : :
    1.22  		"eax" );
    1.23  
    1.24 -	flush_page_update_queue();
    1.25 +	MULTICALL_flush_page_update_queue();
    1.26  
    1.27  	/* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
    1.28  
    1.29 -	__unlazy_fpu(prev_p);
    1.30 +	/*
    1.31 +	 * This is basically '__unlazy_fpu', except that we queue a
    1.32 +	 * multicall to indicate FPU task switch, rather than
    1.33 +	 * synchronously trapping to Xen.
    1.34 +	 */
    1.35 +	if (prev_p->thread_info->status & TS_USEDFPU) {
    1.36 +		save_init_fpu(prev_p);
    1.37 +		queue_multicall0(__HYPERVISOR_fpu_taskswitch);
    1.38 +	}
    1.39  
    1.40  	/*
    1.41  	 * Reload esp0, LDT and the page table pointer:
    1.42 +	 * This is load_esp0(tss, next) with a multicall.
    1.43  	 */
    1.44 -	load_esp0(tss, next);
    1.45 +	tss->esp0 = next->esp0;
    1.46 +	/* This can only happen when SEP is enabled, no need to test
    1.47 +	 * "SEP"arately */
    1.48 +	if (unlikely(tss->ss1 != next->sysenter_cs)) {
    1.49 +		tss->ss1 = next->sysenter_cs;
    1.50 +		wrmsr(MSR_IA32_SYSENTER_CS, next->sysenter_cs, 0);
    1.51 +	}
    1.52 +	queue_multicall2(__HYPERVISOR_stack_switch, tss->ss0, tss->esp0);
    1.53  
    1.54  	/*
    1.55  	 * Load the per-thread Thread-Local Storage descriptor.
    1.56 +	 * This is load_TLS(next, cpu) with multicalls.
    1.57  	 */
    1.58 -	load_TLS(next, cpu);
    1.59 +#define C(i) queue_multicall3(__HYPERVISOR_update_descriptor, virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i]), ((u32 *)&next->tls_array[i])[0], ((u32 *)&next->tls_array[i])[1])
    1.60 +	C(0); C(1); C(2);
    1.61 +#undef C
    1.62  
    1.63  	if (start_info.flags & SIF_PRIVILEGED) {
    1.64 -		dom0_op_t op;
    1.65  		op.cmd           = DOM0_IOPL;
    1.66  		op.u.iopl.domain = DOMID_SELF;
    1.67  		op.u.iopl.iopl   = next->io_pl;
    1.68 -		HYPERVISOR_dom0_op(&op);
    1.69 +		queue_multicall1(__HYPERVISOR_dom0_op, (unsigned long)&op);
    1.70  	}
    1.71  
    1.72 +	/* EXECUTE ALL TASK SWITCH XEN SYSCALLS AT THIS POINT. */
    1.73 +	execute_multicall_list();
    1.74 +
    1.75  	local_irq_restore(flags);
    1.76  
    1.77  	/*