direct-io.hg
changeset 3272:b3a8d9f9a4e0
bitkeeper revision 1.1159.187.64 (41bec5b2hEqxDdXD0_RNHHR7utG6gA)
schedule_tail is now an indirect function call in x86 architecture.
schedule_tail is now an indirect function call in x86 architecture.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Tue Dec 14 10:51:30 2004 +0000 (2004-12-14) |
parents | e385479288a5 |
children | e606dfe099cc d4b8528d976e |
files | .rootkeys xen/arch/x86/boot/x86_64.S xen/arch/x86/domain.c xen/arch/x86/setup.c xen/arch/x86/smpboot.c xen/arch/x86/x86_32/entry.S xen/common/domain.c xen/include/asm-x86/domain.h xen/include/asm-x86/processor.h xen/include/asm-x86/system.h xen/include/asm-x86/x86_32/current.h xen/include/asm-x86/x86_64/current.h xen/include/xen/domain.h xen/include/xen/sched.h |
line diff
1.1 --- a/.rootkeys Sun Dec 12 17:02:07 2004 +0000 1.2 +++ b/.rootkeys Tue Dec 14 10:51:30 2004 +0000 1.3 @@ -792,7 +792,6 @@ 3ddb79c2jFkPAZTDmU35L6IUssYMgQ xen/inclu 1.4 3ddb79c3r9-31dIsewPV3P3i8HALsQ xen/include/asm-x86/delay.h 1.5 3ddb79c34BFiXjBJ_cCKB0aCsV1IDw xen/include/asm-x86/desc.h 1.6 40715b2dTokMLYGSuD58BnxOqyWVew xen/include/asm-x86/div64.h 1.7 -40f2b4a2hC3HtChu-ArD8LyojxWMjg xen/include/asm-x86/domain.h 1.8 3e20b82fl1jmQiKdLy7fxMcutfpjWA xen/include/asm-x86/domain_page.h 1.9 3ddb79c3NU8Zy40OTrq3D-i30Y3t4A xen/include/asm-x86/fixmap.h 1.10 3e2d29944GI24gf7vOP_7x8EyuqxeA xen/include/asm-x86/flushtlb.h 1.11 @@ -855,6 +854,7 @@ 3ddb79c259jh8hE7vre_8NuE7nwNSA xen/inclu 1.12 3eb165e0eawr3R-p2ZQtSdLWtLRN_A xen/include/xen/console.h 1.13 3ddb79c1V44RD26YqCUm-kqIupM37A xen/include/xen/ctype.h 1.14 3ddb79c05DdHQ0UxX_jKsXdR4QlMCA xen/include/xen/delay.h 1.15 +40f2b4a2hC3HtChu-ArD8LyojxWMjg xen/include/xen/domain.h 1.16 3ddb79c2O729EttZTYu1c8LcsUO_GQ xen/include/xen/elf.h 1.17 3ddb79c0HIghfBF8zFUdmXhOU8i6hA xen/include/xen/errno.h 1.18 3ddb79c1W0lQca8gRV7sN6j3iY4Luw xen/include/xen/event.h
2.1 --- a/xen/arch/x86/boot/x86_64.S Sun Dec 12 17:02:07 2004 +0000 2.2 +++ b/xen/arch/x86/boot/x86_64.S Tue Dec 14 10:51:30 2004 +0000 2.3 @@ -270,9 +270,8 @@ copy_user_generic: 2.4 memcmp: 2.5 idt_tables: 2.6 new_thread: 2.7 -.globl switch_to, continue_nonidle_task, __get_user_1, paging_init, trap_init 2.8 +.globl switch_to, __get_user_1, paging_init, trap_init 2.9 switch_to: 2.10 -continue_nonidle_task: 2.11 __get_user_1: 2.12 paging_init: 2.13 trap_init:
3.1 --- a/xen/arch/x86/domain.c Sun Dec 12 17:02:07 2004 +0000 3.2 +++ b/xen/arch/x86/domain.c Tue Dec 14 10:51:30 2004 +0000 3.3 @@ -48,35 +48,16 @@ 3.4 #define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK) 3.5 #define round_pgdown(_p) ((_p)&PAGE_MASK) 3.6 3.7 -int hlt_counter; 3.8 - 3.9 -void disable_hlt(void) 3.10 +static void default_idle(void) 3.11 { 3.12 - hlt_counter++; 3.13 -} 3.14 - 3.15 -void enable_hlt(void) 3.16 -{ 3.17 - hlt_counter--; 3.18 + __cli(); 3.19 + if ( !softirq_pending(smp_processor_id()) ) 3.20 + safe_halt(); 3.21 + else 3.22 + __sti(); 3.23 } 3.24 3.25 -/* 3.26 - * We use this if we don't have any better 3.27 - * idle routine.. 3.28 - */ 3.29 -static void default_idle(void) 3.30 -{ 3.31 - if ( hlt_counter == 0 ) 3.32 - { 3.33 - __cli(); 3.34 - if ( !softirq_pending(smp_processor_id()) ) 3.35 - safe_halt(); 3.36 - else 3.37 - __sti(); 3.38 - } 3.39 -} 3.40 - 3.41 -void continue_cpu_idle_loop(void) 3.42 +static void idle_loop(void) 3.43 { 3.44 int cpu = smp_processor_id(); 3.45 for ( ; ; ) 3.46 @@ -102,7 +83,7 @@ void startup_cpu_idle_loop(void) 3.47 smp_mb(); 3.48 init_idle(); 3.49 3.50 - continue_cpu_idle_loop(); 3.51 + idle_loop(); 3.52 } 3.53 3.54 static long no_idt[2]; 3.55 @@ -216,20 +197,43 @@ void free_perdomain_pt(struct domain *d) 3.56 free_xenheap_page((unsigned long)d->mm.perdomain_pt); 3.57 } 3.58 3.59 +static void continue_idle_task(struct domain *d) 3.60 +{ 3.61 + reset_stack_and_jump(idle_loop); 3.62 +} 3.63 + 3.64 +static void continue_nonidle_task(struct domain *d) 3.65 +{ 3.66 + reset_stack_and_jump(ret_from_intr); 3.67 +} 3.68 + 3.69 void arch_do_createdomain(struct domain *d) 3.70 { 3.71 - d->shared_info = (void *)alloc_xenheap_page(); 3.72 - memset(d->shared_info, 0, PAGE_SIZE); 3.73 - d->shared_info->arch.mfn_to_pfn_start = 3.74 - virt_to_phys(&machine_to_phys_mapping[0])>>PAGE_SHIFT; 3.75 - SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d); 3.76 - machine_to_phys_mapping[virt_to_phys(d->shared_info) >> 3.77 - PAGE_SHIFT] = INVALID_P2M_ENTRY; 3.78 +#ifdef ARCH_HAS_FAST_TRAP 3.79 + SET_DEFAULT_FAST_TRAP(&d->thread); 3.80 +#endif 3.81 + 3.82 + if ( d->id == IDLE_DOMAIN_ID ) 3.83 + { 3.84 + d->thread.schedule_tail = continue_idle_task; 3.85 + } 3.86 + else 3.87 + { 3.88 + d->thread.schedule_tail = continue_nonidle_task; 3.89 3.90 - d->mm.perdomain_pt = (l1_pgentry_t *)alloc_xenheap_page(); 3.91 - memset(d->mm.perdomain_pt, 0, PAGE_SIZE); 3.92 - machine_to_phys_mapping[virt_to_phys(d->mm.perdomain_pt) >> 3.93 - PAGE_SHIFT] = INVALID_P2M_ENTRY; 3.94 + d->shared_info = (void *)alloc_xenheap_page(); 3.95 + memset(d->shared_info, 0, PAGE_SIZE); 3.96 + d->shared_info->arch.mfn_to_pfn_start = 3.97 + virt_to_phys(&machine_to_phys_mapping[0])>>PAGE_SHIFT; 3.98 + SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d); 3.99 + machine_to_phys_mapping[virt_to_phys(d->shared_info) >> 3.100 + PAGE_SHIFT] = INVALID_P2M_ENTRY; 3.101 + 3.102 + d->mm.perdomain_pt = (l1_pgentry_t *)alloc_xenheap_page(); 3.103 + memset(d->mm.perdomain_pt, 0, PAGE_SIZE); 3.104 + machine_to_phys_mapping[virt_to_phys(d->mm.perdomain_pt) >> 3.105 + PAGE_SHIFT] = INVALID_P2M_ENTRY; 3.106 + } 3.107 } 3.108 3.109 int arch_final_setup_guestos(struct domain *d, full_execution_context_t *c) 3.110 @@ -263,7 +267,6 @@ int arch_final_setup_guestos(struct doma 3.111 sizeof(d->thread.traps)); 3.112 3.113 #ifdef ARCH_HAS_FAST_TRAP 3.114 - SET_DEFAULT_FAST_TRAP(&d->thread); 3.115 if ( (rc = (int)set_fast_trap(d, c->fast_trap_idx)) != 0 ) 3.116 return rc; 3.117 #endif 3.118 @@ -328,9 +331,6 @@ void new_thread(struct domain *d, 3.119 3.120 __save_flags(ec->eflags); 3.121 ec->eflags |= X86_EFLAGS_IF; 3.122 - 3.123 - /* No fast trap at start of day. */ 3.124 - SET_DEFAULT_FAST_TRAP(&d->thread); 3.125 } 3.126 3.127
4.1 --- a/xen/arch/x86/setup.c Sun Dec 12 17:02:07 2004 +0000 4.2 +++ b/xen/arch/x86/setup.c Tue Dec 14 10:51:30 2004 +0000 4.3 @@ -328,6 +328,8 @@ void __init start_of_day(void) 4.4 4.5 sort_exception_tables(); 4.6 4.7 + arch_do_createdomain(current); 4.8 + 4.9 /* Tell the PCI layer not to allocate too close to the RAM area.. */ 4.10 low_mem_size = ((max_page << PAGE_SHIFT) + 0xfffff) & ~0xfffff; 4.11 if ( low_mem_size > pci_mem_start ) pci_mem_start = low_mem_size;
5.1 --- a/xen/arch/x86/smpboot.c Sun Dec 12 17:02:07 2004 +0000 5.2 +++ b/xen/arch/x86/smpboot.c Tue Dec 14 10:51:30 2004 +0000 5.3 @@ -662,10 +662,6 @@ static void __init do_boot_cpu (int apic 5.4 5.5 map_cpu_to_boot_apicid(cpu, apicid); 5.6 5.7 -#if defined(__i386__) 5.8 - SET_DEFAULT_FAST_TRAP(&idle->thread); 5.9 -#endif 5.10 - 5.11 idle_task[cpu] = idle; 5.12 5.13 /* start_eip had better be page-aligned! */
6.1 --- a/xen/arch/x86/x86_32/entry.S Sun Dec 12 17:02:07 2004 +0000 6.2 +++ b/xen/arch/x86/x86_32/entry.S Tue Dec 14 10:51:30 2004 +0000 6.3 @@ -65,10 +65,6 @@ 6.4 andl $~3,reg; \ 6.5 movl (reg),reg; 6.6 6.7 -ENTRY(continue_nonidle_task) 6.8 - GET_CURRENT(%ebx) 6.9 - jmp test_all_events 6.10 - 6.11 ALIGN 6.12 restore_all_guest: 6.13 testb $TF_failsafe_return,DOMAIN_thread_flags(%ebx)
7.1 --- a/xen/common/domain.c Sun Dec 12 17:02:07 2004 +0000 7.2 +++ b/xen/common/domain.c Tue Dec 14 10:51:30 2004 +0000 7.3 @@ -47,20 +47,21 @@ struct domain *do_createdomain(domid_t d 7.4 /* Per-domain PCI-device list. */ 7.5 spin_lock_init(&d->pcidev_lock); 7.6 INIT_LIST_HEAD(&d->pcidev_list); 7.7 + 7.8 + if ( (d->id != IDLE_DOMAIN_ID) && 7.9 + ((init_event_channels(d) != 0) || (grant_table_create(d) != 0)) ) 7.10 + { 7.11 + destroy_event_channels(d); 7.12 + free_domain_struct(d); 7.13 + return NULL; 7.14 + } 7.15 + 7.16 + arch_do_createdomain(d); 7.17 + 7.18 + sched_add_domain(d); 7.19 7.20 if ( d->id != IDLE_DOMAIN_ID ) 7.21 { 7.22 - if ( (init_event_channels(d) != 0) || (grant_table_create(d) != 0) ) 7.23 - { 7.24 - destroy_event_channels(d); 7.25 - free_domain_struct(d); 7.26 - return NULL; 7.27 - } 7.28 - 7.29 - arch_do_createdomain(d); 7.30 - 7.31 - sched_add_domain(d); 7.32 - 7.33 write_lock(&domlist_lock); 7.34 pd = &domain_list; /* NB. domain_list maintained in order of dom_id. */ 7.35 for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_list ) 7.36 @@ -72,10 +73,6 @@ struct domain *do_createdomain(domid_t d 7.37 domain_hash[DOMAIN_HASH(dom_id)] = d; 7.38 write_unlock(&domlist_lock); 7.39 } 7.40 - else 7.41 - { 7.42 - sched_add_domain(d); 7.43 - } 7.44 7.45 return d; 7.46 }
8.1 --- a/xen/include/asm-x86/domain.h Sun Dec 12 17:02:07 2004 +0000 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,14 +0,0 @@ 8.4 - 8.5 -#ifndef __ASM_X86_DOMAIN_H__ 8.6 -#define __ASM_X86_DOMAIN_H__ 8.7 - 8.8 -extern void arch_do_createdomain(struct domain *d); 8.9 - 8.10 -extern int arch_final_setup_guestos( 8.11 - struct domain *d, full_execution_context_t *c); 8.12 - 8.13 -extern void free_perdomain_pt(struct domain *d); 8.14 - 8.15 -extern void domain_relinquish_memory(struct domain *d); 8.16 - 8.17 -#endif /* __ASM_X86_DOMAIN_H__ */
9.1 --- a/xen/include/asm-x86/processor.h Sun Dec 12 17:02:07 2004 +0000 9.2 +++ b/xen/include/asm-x86/processor.h Tue Dec 14 10:51:30 2004 +0000 9.3 @@ -399,6 +399,8 @@ struct thread_struct { 9.4 /* general user-visible register state */ 9.5 execution_context_t user_ctxt; 9.6 9.7 + void (*schedule_tail) (struct domain *); 9.8 + 9.9 /* 9.10 * Return vectors pushed to us by guest OS. 9.11 * The stack frame for events is exactly that of an x86 hardware interrupt. 9.12 @@ -456,14 +458,10 @@ extern struct desc_struct *idt_tables[]; 9.13 9.14 long set_fast_trap(struct domain *p, int idx); 9.15 9.16 -#define INIT_THREAD { fast_trap_idx: 0x20 } 9.17 - 9.18 -#elif defined(__x86_64__) 9.19 +#endif 9.20 9.21 #define INIT_THREAD { 0 } 9.22 9.23 -#endif /* __x86_64__ */ 9.24 - 9.25 extern int gpf_emulate_4gb(struct xen_regs *regs); 9.26 9.27 struct mm_struct {
10.1 --- a/xen/include/asm-x86/system.h Sun Dec 12 17:02:07 2004 +0000 10.2 +++ b/xen/include/asm-x86/system.h Tue Dec 14 10:51:30 2004 +0000 10.3 @@ -271,13 +271,6 @@ static inline int local_irq_is_enabled(v 10.4 return !!(flags & (1<<9)); /* EFLAGS_IF */ 10.5 } 10.6 10.7 -/* 10.8 - * disable hlt during certain critical i/o operations 10.9 - */ 10.10 -#define HAVE_DISABLE_HLT 10.11 -void disable_hlt(void); 10.12 -void enable_hlt(void); 10.13 - 10.14 #define BROKEN_ACPI_Sx 0x0001 10.15 #define BROKEN_INIT_AFTER_S1 0x0002 10.16
11.1 --- a/xen/include/asm-x86/x86_32/current.h Sun Dec 12 17:02:07 2004 +0000 11.2 +++ b/xen/include/asm-x86/x86_32/current.h Tue Dec 14 10:51:30 2004 +0000 11.3 @@ -45,14 +45,11 @@ static inline unsigned long get_stack_to 11.4 return p; 11.5 } 11.6 11.7 -#define schedule_tail(_p) \ 11.8 +#define reset_stack_and_jump(__fn) \ 11.9 __asm__ __volatile__ ( \ 11.10 - "andl %%esp,%0; addl %2,%0; movl %0,%%esp; jmp *%1" \ 11.11 - : : "r" (~(STACK_SIZE-1)), \ 11.12 - "r" (unlikely(is_idle_task((_p))) ? \ 11.13 - continue_cpu_idle_loop : \ 11.14 - continue_nonidle_task), \ 11.15 - "i" (STACK_SIZE-STACK_RESERVED) ) 11.16 + "movl %0,%%esp; jmp "STR(__fn) \ 11.17 + : : "r" (get_execution_context()) ) 11.18 11.19 +#define schedule_tail(_d) ((_d)->thread.schedule_tail)(_d) 11.20 11.21 #endif /* _X86_CURRENT_H */
12.1 --- a/xen/include/asm-x86/x86_64/current.h Sun Dec 12 17:02:07 2004 +0000 12.2 +++ b/xen/include/asm-x86/x86_64/current.h Tue Dec 14 10:51:30 2004 +0000 12.3 @@ -40,15 +40,12 @@ static inline unsigned long get_stack_to 12.4 return p; 12.5 } 12.6 12.7 -#define schedule_tail(_p) \ 12.8 +#define reset_stack_and_jump(__fn) \ 12.9 __asm__ __volatile__ ( \ 12.10 - "andq %%rsp,%0; addq %2,%0; movq %0,%%rsp; jmp *%1" \ 12.11 - : : "r" (~(STACK_SIZE-1)), \ 12.12 - "r" (unlikely(is_idle_task((_p))) ? \ 12.13 - continue_cpu_idle_loop : \ 12.14 - continue_nonidle_task), \ 12.15 - "i" (STACK_SIZE-STACK_RESERVED) ) 12.16 + "movq %0,%%rsp; jmp "STR(__fn) \ 12.17 + : : "r" (get_execution_context()) ) 12.18 12.19 +#define schedule_tail(_d) ((_d)->thread.schedule_tail)(_d) 12.20 12.21 #else 12.22
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/xen/include/xen/domain.h Tue Dec 14 10:51:30 2004 +0000 13.3 @@ -0,0 +1,20 @@ 13.4 + 13.5 +#ifndef __XEN_DOMAIN_H__ 13.6 +#define __XEN_DOMAIN_H__ 13.7 + 13.8 + 13.9 + 13.10 +/* 13.11 + * Arch-specifics. 13.12 + */ 13.13 + 13.14 +extern void arch_do_createdomain(struct domain *d); 13.15 + 13.16 +extern int arch_final_setup_guestos( 13.17 + struct domain *d, full_execution_context_t *c); 13.18 + 13.19 +extern void free_perdomain_pt(struct domain *d); 13.20 + 13.21 +extern void domain_relinquish_memory(struct domain *d); 13.22 + 13.23 +#endif /* __XEN_DOMAIN_H__ */
14.1 --- a/xen/include/xen/sched.h Sun Dec 12 17:02:07 2004 +0000 14.2 +++ b/xen/include/xen/sched.h Tue Dec 14 10:51:30 2004 +0000 14.3 @@ -214,9 +214,6 @@ void domain_init(void); 14.4 int idle_cpu(int cpu); /* Is CPU 'cpu' idle right now? */ 14.5 14.6 void startup_cpu_idle_loop(void); 14.7 -void continue_cpu_idle_loop(void); 14.8 - 14.9 -void continue_nonidle_task(void); 14.10 14.11 unsigned long hypercall_create_continuation( 14.12 unsigned int op, unsigned int nr_args, ...); 14.13 @@ -295,6 +292,6 @@ static inline void domain_unpause_by_sys 14.14 #define VM_ASSIST(_d,_t) (test_bit((_t), &(_d)->vm_assist)) 14.15 14.16 #include <xen/slab.h> 14.17 -#include <asm/domain.h> 14.18 +#include <xen/domain.h> 14.19 14.20 #endif /* __SCHED_H__ */