ia64/xen-unstable
changeset 1885:a2d2b4ac2439
bitkeeper revision 1.1108.12.1 (4100e788EN1VntqfvMe4jTLeq56uIQ)
Merge
Merge
author | xenbk@gandalf.hpl.hp.com |
---|---|
date | Fri Jul 23 10:25:12 2004 +0000 (2004-07-23) |
parents | f8df05dd9dbf 51f8d2380c82 |
children | 277bd0f6186d |
files | .rootkeys linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c linux-2.6.7-xen-sparse/drivers/xen/net/network.c tools/Makefile tools/python/setup.py tools/python/xen/sv/DomInfo.py tools/python/xen/sv/DomList.py tools/python/xen/sv/GenTabbed.py tools/python/xen/sv/HTMLBase.py tools/python/xen/sv/Main.py tools/python/xen/sv/NodeInfo.py tools/python/xen/sv/TabView.py tools/python/xen/sv/__init__.py tools/python/xen/sv/util.py tools/python/xen/xend/XendClient.py tools/python/xen/xend/server/SrvServer.py tools/python/xen/xend/sv/DomInfo.py tools/python/xen/xend/sv/DomList.py tools/python/xen/xend/sv/GenTabbed.py tools/python/xen/xend/sv/HTMLBase.py tools/python/xen/xend/sv/Main.py tools/python/xen/xend/sv/Main.rpy tools/python/xen/xend/sv/NodeInfo.py tools/python/xen/xend/sv/TabView.py tools/python/xen/xend/sv/XendClientDeferred.py tools/python/xen/xend/sv/__init__.py tools/python/xen/xend/sv/images/internet copy.jpg tools/python/xen/xend/sv/images/internet.jpg tools/python/xen/xend/sv/images/internet.psd tools/python/xen/xend/sv/images/left-end-highlight.jpg tools/python/xen/xend/sv/images/left-end-no-highlight.jpg tools/python/xen/xend/sv/images/middle-highlight.jpg tools/python/xen/xend/sv/images/middle-no-highlight.jpg tools/python/xen/xend/sv/images/orb_01.jpg tools/python/xen/xend/sv/images/orb_02.jpg tools/python/xen/xend/sv/images/right-end-highlight.jpg tools/python/xen/xend/sv/images/right-end-no-highlight.jpg tools/python/xen/xend/sv/images/seperator-left-highlight.jpg tools/python/xen/xend/sv/images/seperator-right-highlight.jpg tools/python/xen/xend/sv/images/seperator.jpg tools/python/xen/xend/sv/images/xen.png tools/python/xen/xend/sv/inc/style.css tools/python/xen/xend/sv/util.py tools/sv/Main.rpy tools/sv/Makefile tools/sv/images/left-end-highlight.jpg tools/sv/images/left-end-no-highlight.jpg tools/sv/images/middle-highlight.jpg tools/sv/images/middle-no-highlight.jpg tools/sv/images/orb_01.jpg tools/sv/images/orb_02.jpg tools/sv/images/right-end-highlight.jpg tools/sv/images/right-end-no-highlight.jpg tools/sv/images/seperator-left-highlight.jpg tools/sv/images/seperator-right-highlight.jpg tools/sv/images/seperator.jpg tools/sv/images/xen.png tools/sv/inc/style.css tools/xfrd/Makefile xen/arch/x86/memory.c xen/common/memory.c xen/common/sched_bvt.c xen/common/sched_fair_bvt.c xen/common/sched_rrobin.c xen/common/schedule.c xen/include/xen/sched-if.h xen/include/xen/sched.h |
line diff
1.1 --- a/.rootkeys Thu Jul 22 16:41:11 2004 +0000 1.2 +++ b/.rootkeys Fri Jul 23 10:25:12 2004 +0000 1.3 @@ -369,6 +369,15 @@ 3fbd0a42l40lM0IICw2jXbQBVZSdZg tools/pyt 1.4 40dc4076St6AmPTmQPrtQ6LGHPxGmw tools/python/xen/lowlevel/xu/__init__.py 1.5 40dc4076pVeE1kEEWzcUaNZin65kCA tools/python/xen/lowlevel/xu/domain_controller.h 1.6 40dc4076CwBYRTUQDdbdU1L6KcLgSw tools/python/xen/lowlevel/xu/xu.c 1.7 +40fcefb2qm13BbRZBydAatOavaS0fQ tools/python/xen/sv/DomInfo.py 1.8 +40fcefb2-RIU8GB67mJMRzybME9bxw tools/python/xen/sv/DomList.py 1.9 +40fcefb23FfQn-ZBCbcHqA0cPGqQxw tools/python/xen/sv/GenTabbed.py 1.10 +40fcefb2QZAn3u3sX-M7NXBjOv5HGg tools/python/xen/sv/HTMLBase.py 1.11 +40fcefb2vnfDbl4w_yCTedROPuqs0g tools/python/xen/sv/Main.py 1.12 +40fcefb24h-04WaHag-Tg4nxWPhTig tools/python/xen/sv/NodeInfo.py 1.13 +40fcefb2Sif__6AqrANeBQZZfvP-6w tools/python/xen/sv/TabView.py 1.14 +40fcefb2DqteqCCZYDCvvh4Q5jBd0w tools/python/xen/sv/__init__.py 1.15 +40fcefb4rnaZNjqsBu7A5V2rlLyqRw tools/python/xen/sv/util.py 1.16 40d8915cyoVA0hJxiBFNymL7YvDaRg tools/python/xen/util/Brctl.py 1.17 40dfd40aGqGkiopOOgJxSF4iCbHM0Q tools/python/xen/util/__init__.py 1.18 4055ee4dwy4l0MghZosxoiu6zmhc9Q tools/python/xen/util/console_client.py 1.19 @@ -417,33 +426,6 @@ 40d83983OXjt-y3HjSCcuoPp9rzvmw tools/pyt 1.20 40c9c469yrm31i60pGKslTi2Zgpotg tools/python/xen/xend/server/messages.py 1.21 40c9c46925x-Rjb0Cv2f1-l2jZrPYg tools/python/xen/xend/server/netif.py 1.22 40c9c469ZqILEQ8x6yWy0_51jopiCg tools/python/xen/xend/server/params.py 1.23 -40fcefb2qm13BbRZBydAatOavaS0fQ tools/python/xen/xend/sv/DomInfo.py 1.24 -40fcefb2-RIU8GB67mJMRzybME9bxw tools/python/xen/xend/sv/DomList.py 1.25 -40fcefb23FfQn-ZBCbcHqA0cPGqQxw tools/python/xen/xend/sv/GenTabbed.py 1.26 -40fcefb2QZAn3u3sX-M7NXBjOv5HGg tools/python/xen/xend/sv/HTMLBase.py 1.27 -40fcefb2vnfDbl4w_yCTedROPuqs0g tools/python/xen/xend/sv/Main.py 1.28 -40fcefb2K1xqVVT4D-p7nL2GzS4scg tools/python/xen/xend/sv/Main.rpy 1.29 -40fcefb24h-04WaHag-Tg4nxWPhTig tools/python/xen/xend/sv/NodeInfo.py 1.30 -40fcefb2Sif__6AqrANeBQZZfvP-6w tools/python/xen/xend/sv/TabView.py 1.31 -40fcefb23s0sQlDfl4sPP0Un8oZGhg tools/python/xen/xend/sv/XendClientDeferred.py 1.32 -40fcefb2DqteqCCZYDCvvh4Q5jBd0w tools/python/xen/xend/sv/__init__.py 1.33 -40fcefb2Nhe-sT74KBB_3mYQg9Dl4Q tools/python/xen/xend/sv/images/internet copy.jpg 1.34 -40fcefb2QmVa4xdjdnSTXEdF2fZCDA tools/python/xen/xend/sv/images/internet.jpg 1.35 -40fcefb2g8Ez5jJIPHGN_KX7GtxV4w tools/python/xen/xend/sv/images/internet.psd 1.36 -40fcefb3wXQMsl9WkgQAVtdrupm4sw tools/python/xen/xend/sv/images/left-end-highlight.jpg 1.37 -40fcefb3K6ESt5sQhD9aCQRscQIlXQ tools/python/xen/xend/sv/images/left-end-no-highlight.jpg 1.38 -40fcefb3BUT98zPzW8kAFKuxGdh4XA tools/python/xen/xend/sv/images/middle-highlight.jpg 1.39 -40fcefb38OTgsUKHBpwshLLIsiIaCA tools/python/xen/xend/sv/images/middle-no-highlight.jpg 1.40 -40fcefb32SPtrw36c4S6YGFlLvkKuw tools/python/xen/xend/sv/images/orb_01.jpg 1.41 -40fcefb3Ok5qkX3iM7ZEPVkRInrUpg tools/python/xen/xend/sv/images/orb_02.jpg 1.42 -40fcefb3JnT5XeKTuVF4yUMGOtuNZg tools/python/xen/xend/sv/images/right-end-highlight.jpg 1.43 -40fcefb3-DuYOS7noo2W7b_0p7TOUg tools/python/xen/xend/sv/images/right-end-no-highlight.jpg 1.44 -40fcefb3qNbAZR5FYGPAZ9sFPVMTDA tools/python/xen/xend/sv/images/seperator-left-highlight.jpg 1.45 -40fcefb3dgsa24WLk_BJeYQHrDLuOg tools/python/xen/xend/sv/images/seperator-right-highlight.jpg 1.46 -40fcefb3FtiX4Pd2kT8wDlp8u8xRhQ tools/python/xen/xend/sv/images/seperator.jpg 1.47 -40fcefb3yMSrZvApO9ToIi-iQwnchA tools/python/xen/xend/sv/images/xen.png 1.48 -40fcefb3zGC9XNBkSwTEobCoq8YClA tools/python/xen/xend/sv/inc/style.css 1.49 -40fcefb4rnaZNjqsBu7A5V2rlLyqRw tools/python/xen/xend/sv/util.py 1.50 40c9c469LNxLVizOUpOjEaTKKCm8Aw tools/python/xen/xend/sxp.py 1.51 40d05079aFRp6NQdo5wIh5Ly31c0cg tools/python/xen/xm/__init__.py 1.52 40cf2937gKQcATgXKGtNeWb1PDH5nA tools/python/xen/xm/create.py 1.53 @@ -452,6 +434,21 @@ 40e41cd2w0I4En6qrJn4em8HkK_oxQ tools/pyt 1.54 40cf2937isyS250zyd0Q2GuEDoNXfQ tools/python/xen/xm/main.py 1.55 40cf2937PSslwBliN1g7ofDy2H_RhA tools/python/xen/xm/opts.py 1.56 40cf2937Z8WCNOnO2FcWdubvEAF9QQ tools/python/xen/xm/shutdown.py 1.57 +40fcefb2K1xqVVT4D-p7nL2GzS4scg tools/sv/Main.rpy 1.58 +40ffbcb66Dj5F-1kCK9BcgSqCWkt1w tools/sv/Makefile 1.59 +40fcefb3wXQMsl9WkgQAVtdrupm4sw tools/sv/images/left-end-highlight.jpg 1.60 +40fcefb3K6ESt5sQhD9aCQRscQIlXQ tools/sv/images/left-end-no-highlight.jpg 1.61 +40fcefb3BUT98zPzW8kAFKuxGdh4XA tools/sv/images/middle-highlight.jpg 1.62 +40fcefb38OTgsUKHBpwshLLIsiIaCA tools/sv/images/middle-no-highlight.jpg 1.63 +40fcefb32SPtrw36c4S6YGFlLvkKuw tools/sv/images/orb_01.jpg 1.64 +40fcefb3Ok5qkX3iM7ZEPVkRInrUpg tools/sv/images/orb_02.jpg 1.65 +40fcefb3JnT5XeKTuVF4yUMGOtuNZg tools/sv/images/right-end-highlight.jpg 1.66 +40fcefb3-DuYOS7noo2W7b_0p7TOUg tools/sv/images/right-end-no-highlight.jpg 1.67 +40fcefb3qNbAZR5FYGPAZ9sFPVMTDA tools/sv/images/seperator-left-highlight.jpg 1.68 +40fcefb3dgsa24WLk_BJeYQHrDLuOg tools/sv/images/seperator-right-highlight.jpg 1.69 +40fcefb3FtiX4Pd2kT8wDlp8u8xRhQ tools/sv/images/seperator.jpg 1.70 +40fcefb3yMSrZvApO9ToIi-iQwnchA tools/sv/images/xen.png 1.71 +40fcefb3zGC9XNBkSwTEobCoq8YClA tools/sv/inc/style.css 1.72 403a3edbrr8RE34gkbR40zep98SXbg tools/xentrace/Makefile 1.73 40a107afN60pFdURgBv9KwEzgRl5mQ tools/xentrace/formats 1.74 4050c413PhhLNAYk3TEwP37i_iLw9Q tools/xentrace/xentrace.8
2.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c Thu Jul 22 16:41:11 2004 +0000 2.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c Fri Jul 23 10:25:12 2004 +0000 2.3 @@ -87,14 +87,11 @@ EXPORT_SYMBOL(i8253_lock); 2.4 2.5 struct timer_opts *cur_timer = &timer_none; 2.6 2.7 -/* These are peridically updated in shared_info, and then copied here. */ 2.8 -static u32 shadow_tsc_stamp; 2.9 -static u64 shadow_system_time; 2.10 -static u32 shadow_time_version; 2.11 -static struct timeval shadow_tv; 2.12 +extern u64 shadow_system_time; 2.13 +extern void __get_time_values_from_xen(void); 2.14 2.15 /* Keep track of last time we did processing/updating of jiffies and xtime. */ 2.16 -static u64 processed_system_time; /* System time (ns) at last processing. */ 2.17 +u64 processed_system_time; /* System time (ns) at last processing. */ 2.18 2.19 #define NS_PER_TICK (1000000000ULL/HZ) 2.20 2.21 @@ -215,32 +212,12 @@ EXPORT_SYMBOL(monotonic_clock); 2.22 2.23 2.24 /* 2.25 - * Reads a consistent set of time-base values from Xen, into a shadow data 2.26 - * area. Must be called with the xtime_lock held for writing. 2.27 - */ 2.28 -static void __get_time_values_from_xen(void) 2.29 -{ 2.30 - do { 2.31 - shadow_time_version = HYPERVISOR_shared_info->time_version2; 2.32 - rmb(); 2.33 - shadow_tv.tv_sec = HYPERVISOR_shared_info->wc_sec; 2.34 - shadow_tv.tv_usec = HYPERVISOR_shared_info->wc_usec; 2.35 - shadow_tsc_stamp = HYPERVISOR_shared_info->tsc_timestamp.tsc_bits; 2.36 - shadow_system_time = HYPERVISOR_shared_info->system_time; 2.37 - rmb(); 2.38 - } 2.39 - while ( shadow_time_version != HYPERVISOR_shared_info->time_version1 ); 2.40 -} 2.41 - 2.42 -/* 2.43 * timer_interrupt() needs to keep up the real-time clock, 2.44 * as well as call the "do_timer()" routine every clocktick 2.45 */ 2.46 static inline void do_timer_interrupt(int irq, void *dev_id, 2.47 struct pt_regs *regs) 2.48 { 2.49 - s64 delta; 2.50 - unsigned long ticks = 0; 2.51 2.52 #ifdef CONFIG_X86_IO_APIC 2.53 if (timer_ack) { 2.54 @@ -258,23 +235,8 @@ static inline void do_timer_interrupt(in 2.55 } 2.56 #endif 2.57 2.58 - __get_time_values_from_xen(); 2.59 - 2.60 - delta = (s64)(shadow_system_time - processed_system_time); 2.61 - if (delta < 0) { 2.62 - printk("Timer ISR: Time went backwards: %lld\n", delta); 2.63 - return; 2.64 - } 2.65 - 2.66 - /* Process elapsed jiffies since last call. */ 2.67 - while (delta >= NS_PER_TICK) { 2.68 - ticks++; 2.69 - delta -= NS_PER_TICK; 2.70 - processed_system_time += NS_PER_TICK; 2.71 - 2.72 - if (regs) 2.73 - do_timer_interrupt_hook(regs); 2.74 - } 2.75 + if (regs) 2.76 + do_timer_interrupt_hook(regs); 2.77 2.78 #if 0 /* XEN PRIV */ 2.79 /* 2.80 @@ -325,6 +287,8 @@ static inline void do_timer_interrupt(in 2.81 */ 2.82 irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 2.83 { 2.84 + s64 delta; 2.85 + 2.86 /* 2.87 * Here we are in the timer irq handler. We just have irqs locally 2.88 * disabled but we don't know if the timer_bh is running on the other 2.89 @@ -334,10 +298,22 @@ irqreturn_t timer_interrupt(int irq, voi 2.90 */ 2.91 write_seqlock(&xtime_lock); 2.92 2.93 + __get_time_values_from_xen(); 2.94 + 2.95 + delta = (s64)(shadow_system_time - processed_system_time); 2.96 + if (delta < 0) { 2.97 + printk("Timer ISR: Time went backwards: %lld\n", delta); 2.98 + goto out; 2.99 + } 2.100 + 2.101 + if (delta < NS_PER_TICK) 2.102 + goto out; 2.103 + 2.104 cur_timer->mark_offset(); 2.105 2.106 do_timer_interrupt(irq, NULL, regs); 2.107 2.108 + out: 2.109 write_sequnlock(&xtime_lock); 2.110 return IRQ_HANDLED; 2.111 } 2.112 @@ -447,7 +423,7 @@ void __init time_init(void) 2.113 #endif 2.114 xtime.tv_sec = HYPERVISOR_shared_info->wc_sec; 2.115 wall_to_monotonic.tv_sec = -xtime.tv_sec; 2.116 - xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); 2.117 + xtime.tv_nsec = HYPERVISOR_shared_info->wc_usec * 1000; 2.118 wall_to_monotonic.tv_nsec = -xtime.tv_nsec; 2.119 2.120 cur_timer = select_timer();
3.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c Thu Jul 22 16:41:11 2004 +0000 3.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c Fri Jul 23 10:25:12 2004 +0000 3.3 @@ -34,12 +34,9 @@ int tsc_disable __initdata = 0; 3.4 extern spinlock_t i8253_lock; 3.5 3.6 static int use_tsc; 3.7 -/* Number of usecs that the last interrupt was delayed */ 3.8 -static int delay_at_last_interrupt; 3.9 3.10 -static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */ 3.11 -static unsigned long last_tsc_high; /* msb 32 bits of Time Stamp Counter */ 3.12 static unsigned long long monotonic_base; 3.13 +static u32 monotonic_offset; 3.14 static seqlock_t monotonic_lock = SEQLOCK_UNLOCKED; 3.15 3.16 /* convert from cycles(64bits) => nanoseconds (64bits) 3.17 @@ -85,15 +82,19 @@ static unsigned long fast_gettimeoffset_ 3.18 3.19 /* These are peridically updated in shared_info, and then copied here. */ 3.20 static u32 shadow_tsc_stamp; 3.21 -static u64 shadow_system_time; 3.22 +u64 shadow_system_time; 3.23 static u32 shadow_time_version; 3.24 static struct timeval shadow_tv; 3.25 +static unsigned int rdtsc_bitshift; 3.26 +extern u64 processed_system_time; 3.27 + 3.28 +#define NS_PER_TICK (1000000000ULL/HZ) 3.29 3.30 /* 3.31 * Reads a consistent set of time-base values from Xen, into a shadow data 3.32 * area. Must be called with the xtime_lock held for writing. 3.33 */ 3.34 -static void __get_time_values_from_xen(void) 3.35 +void __get_time_values_from_xen(void) 3.36 { 3.37 do { 3.38 shadow_time_version = HYPERVISOR_shared_info->time_version2; 3.39 @@ -120,16 +121,16 @@ static unsigned long get_offset_tsc(void 3.40 rdtsc(eax,edx); 3.41 3.42 /* .. relative to previous jiffy (32 bits is enough) */ 3.43 - eax -= last_tsc_low; /* tsc_low delta */ 3.44 + eax -= (shadow_tsc_stamp << rdtsc_bitshift) & 0xffffffff; 3.45 3.46 /* 3.47 - * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient 3.48 - * = (tsc_low delta) * (usecs_per_clock) 3.49 - * = (tsc_low delta) * (usecs_per_jiffy / clocks_per_jiffy) 3.50 + * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient 3.51 + * = (tsc_low delta) * (usecs_per_clock) 3.52 + * = (tsc_low delta) * (usecs_per_jiffy / clocks_per_jiffy) 3.53 * 3.54 * Using a mull instead of a divl saves up to 31 clock cycles 3.55 * in the critical path. 3.56 - */ 3.57 + */ 3.58 3.59 __asm__("mull %2" 3.60 :"=a" (eax), "=d" (edx) 3.61 @@ -137,7 +138,7 @@ static unsigned long get_offset_tsc(void 3.62 "0" (eax)); 3.63 3.64 /* our adjusted time offset in microseconds */ 3.65 - return delay_at_last_interrupt + edx; 3.66 + return edx; 3.67 } 3.68 3.69 static unsigned long long monotonic_clock_tsc(void) 3.70 @@ -148,7 +149,7 @@ static unsigned long long monotonic_cloc 3.71 /* atomically read monotonic base & last_offset */ 3.72 do { 3.73 seq = read_seqbegin(&monotonic_lock); 3.74 - last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low; 3.75 + last_offset = monotonic_offset << rdtsc_bitshift; 3.76 base = monotonic_base; 3.77 } while (read_seqretry(&monotonic_lock, seq)); 3.78 3.79 @@ -186,122 +187,25 @@ unsigned long long sched_clock(void) 3.80 3.81 static void mark_offset_tsc(void) 3.82 { 3.83 - unsigned long lost,delay; 3.84 - unsigned long delta = last_tsc_low; 3.85 -#if 0 3.86 - int count; 3.87 - int countmp; 3.88 - static int count1 = 0; 3.89 -#endif 3.90 - unsigned long long this_offset, last_offset; 3.91 - static int lost_count = 0; 3.92 - 3.93 - write_seqlock(&monotonic_lock); 3.94 - last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low; 3.95 - /* 3.96 - * It is important that these two operations happen almost at 3.97 - * the same time. We do the RDTSC stuff first, since it's 3.98 - * faster. To avoid any inconsistencies, we need interrupts 3.99 - * disabled locally. 3.100 - */ 3.101 + s64 delta; 3.102 + unsigned int ticks = 0; 3.103 3.104 - /* 3.105 - * Interrupts are just disabled locally since the timer irq 3.106 - * has the SA_INTERRUPT flag set. -arca 3.107 - */ 3.108 - 3.109 - /* read Pentium cycle counter */ 3.110 - 3.111 - rdtsc(last_tsc_low, last_tsc_high); 3.112 - 3.113 -#if 0 3.114 - spin_lock(&i8253_lock); 3.115 - outb_p(0x00, PIT_MODE); /* latch the count ASAP */ 3.116 + write_seqlock(&monotonic_lock); 3.117 3.118 - count = inb_p(PIT_CH0); /* read the latched count */ 3.119 - count |= inb(PIT_CH0) << 8; 3.120 - 3.121 - /* 3.122 - * VIA686a test code... reset the latch if count > max + 1 3.123 - * from timer_pit.c - cjb 3.124 - */ 3.125 - if (count > LATCH) { 3.126 - outb_p(0x34, PIT_MODE); 3.127 - outb_p(LATCH & 0xff, PIT_CH0); 3.128 - outb(LATCH >> 8, PIT_CH0); 3.129 - count = LATCH - 1; 3.130 - } 3.131 - 3.132 - spin_unlock(&i8253_lock); 3.133 + delta = (s64)(shadow_system_time - processed_system_time); 3.134 3.135 - if (pit_latch_buggy) { 3.136 - /* get center value of last 3 time lutch */ 3.137 - if ((count2 >= count && count >= count1) 3.138 - || (count1 >= count && count >= count2)) { 3.139 - count2 = count1; count1 = count; 3.140 - } else if ((count1 >= count2 && count2 >= count) 3.141 - || (count >= count2 && count2 >= count1)) { 3.142 - countmp = count;count = count2; 3.143 - count2 = count1;count1 = countmp; 3.144 - } else { 3.145 - count2 = count1; count1 = count; count = count1; 3.146 - } 3.147 + /* Process elapsed jiffies since last call. */ 3.148 + while (delta >= NS_PER_TICK) { 3.149 + ticks++; 3.150 + delta -= NS_PER_TICK; 3.151 + processed_system_time += NS_PER_TICK; 3.152 } 3.153 -#endif 3.154 - 3.155 - /* lost tick compensation */ 3.156 - delta = last_tsc_low - delta; 3.157 - { 3.158 - register unsigned long eax, edx; 3.159 - eax = delta; 3.160 - __asm__("mull %2" 3.161 - :"=a" (eax), "=d" (edx) 3.162 - :"rm" (fast_gettimeoffset_quotient), 3.163 - "0" (eax)); 3.164 - delta = edx; 3.165 - } 3.166 - delta += delay_at_last_interrupt; 3.167 - lost = delta/(1000000/HZ); 3.168 - delay = delta%(1000000/HZ); 3.169 - if (lost >= 2) { 3.170 - jiffies_64 += lost-1; 3.171 + jiffies_64 += ticks - 1; 3.172 3.173 - /* sanity check to ensure we're not always losing ticks */ 3.174 - if (lost_count++ > 100) { 3.175 - printk(KERN_WARNING "Losing too many ticks!\n"); 3.176 - printk(KERN_WARNING "TSC cannot be used as a timesource. \n"); 3.177 - printk(KERN_WARNING "Possible reasons for this are:\n"); 3.178 - printk(KERN_WARNING " You're running with Speedstep,\n"); 3.179 - printk(KERN_WARNING " You don't have DMA enabled for your hard disk (see hdparm),\n"); 3.180 - printk(KERN_WARNING " Incorrect TSC synchronization on an SMP system (see dmesg).\n"); 3.181 - printk(KERN_WARNING "Falling back to a sane timesource now.\n"); 3.182 - 3.183 - clock_fallback(); 3.184 - } 3.185 - /* ... but give the TSC a fair chance */ 3.186 - if (lost_count > 25) 3.187 - cpufreq_delayed_get(); 3.188 - } else 3.189 - lost_count = 0; 3.190 /* update the monotonic base value */ 3.191 - this_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low; 3.192 - monotonic_base += cycles_2_ns(this_offset - last_offset); 3.193 + monotonic_base = shadow_system_time; 3.194 + monotonic_offset = shadow_tsc_stamp; 3.195 write_sequnlock(&monotonic_lock); 3.196 - 3.197 -#if 0 3.198 - /* calculate delay_at_last_interrupt */ 3.199 - count = ((LATCH-1) - count) * TICK_SIZE; 3.200 - delay_at_last_interrupt = (count + LATCH/2) / LATCH; 3.201 -#else 3.202 - delay_at_last_interrupt = 0; 3.203 -#endif 3.204 - 3.205 - /* catch corner case where tick rollover occured 3.206 - * between tsc and pit reads (as noted when 3.207 - * usec delta is > 90% # of usecs/tick) 3.208 - */ 3.209 - if (lost && abs(delay - delay_at_last_interrupt) > (900000/HZ)) 3.210 - jiffies_64++; 3.211 } 3.212 3.213 static void delay_tsc(unsigned long loops) 3.214 @@ -410,7 +314,7 @@ static unsigned long cpu_khz_ref = 0; 3.215 3.216 static int 3.217 time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, 3.218 - void *data) 3.219 + void *data) 3.220 { 3.221 struct cpufreq_freqs *freq = data; 3.222 3.223 @@ -486,9 +390,12 @@ static int __init init_tsc(char* overrid 3.224 "0" (eax), "1" (edx)); 3.225 } 3.226 3.227 + rdtsc_bitshift = HYPERVISOR_shared_info->tsc_timestamp.tsc_bitshift; 3.228 + 3.229 set_cyc2ns_scale(cpu_khz/1000); 3.230 3.231 __get_time_values_from_xen(); 3.232 + processed_system_time = shadow_system_time; 3.233 3.234 rdtscll(alarm); 3.235
4.1 --- a/linux-2.6.7-xen-sparse/drivers/xen/net/network.c Thu Jul 22 16:41:11 2004 +0000 4.2 +++ b/linux-2.6.7-xen-sparse/drivers/xen/net/network.c Fri Jul 23 10:25:12 2004 +0000 4.3 @@ -275,6 +275,9 @@ static void network_alloc_rx_buffers(str 4.4 } 4.5 while ( (++i - np->rx_resp_cons) != NETIF_RX_RING_SIZE ); 4.6 4.7 + if ( unlikely(nr_pfns == 0) ) 4.8 + return; 4.9 + 4.10 /* 4.11 * We may have allocated buffers which have entries outstanding in the page 4.12 * update queue -- make sure we flush those first!
5.1 --- a/tools/Makefile Thu Jul 22 16:41:11 2004 +0000 5.2 +++ b/tools/Makefile Fri Jul 23 10:25:12 2004 +0000 5.3 @@ -16,6 +16,7 @@ install: all 5.4 $(MAKE) -C xentrace install 5.5 $(MAKE) -C python install 5.6 $(MAKE) -C xfrd install 5.7 + $(MAKE) -C sv install 5.8 5.9 dist: $(TARGET) 5.10 $(MAKE) prefix=`pwd`/../../install dist=yes install
6.1 --- a/tools/python/setup.py Thu Jul 22 16:41:11 2004 +0000 6.2 +++ b/tools/python/setup.py Fri Jul 23 10:25:12 2004 +0000 6.3 @@ -42,7 +42,7 @@ setup(name = 'xen', 6.4 'xen.util', 6.5 'xen.xend', 6.6 'xen.xend.server', 6.7 - 'xen.xend.sv', 6.8 + 'xen.sv', 6.9 'xen.xm', 6.10 ], 6.11 ext_package = "xen.lowlevel",
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/tools/python/xen/sv/DomInfo.py Fri Jul 23 10:25:12 2004 +0000 7.3 @@ -0,0 +1,82 @@ 7.4 +from xen.xend.XendClient import aserver as server 7.5 +from xen.xend import PrettyPrint 7.6 + 7.7 +from xen.sv.HTMLBase import HTMLBase 7.8 +from xen.sv.util import * 7.9 +from xen.sv.GenTabbed import * 7.10 + 7.11 +class DomInfo( GenTabbed ): 7.12 + 7.13 + def __init__( self, urlWriter ): 7.14 + 7.15 + self.dom = 0; 7.16 + 7.17 + def tabUrlWriter( tab ): 7.18 + return urlWriter( "mod=info&dom=%s%s" % ( self.dom, tab ) ) 7.19 + 7.20 + GenTabbed.__init__( self, tabUrlWriter, [ 'General', 'SXP', 'Devices' ], [ DomGenTab, DomSXPTab, NullTab ] ) 7.21 + 7.22 + def write_BODY( self, request ): 7.23 + dom = request.args.get('dom') 7.24 + 7.25 + if dom is None or len(dom) != 1: 7.26 + request.write( "<p>Please Select a Domain</p>" ) 7.27 + return None 7.28 + else: 7.29 + self.dom = dom[0] 7.30 + 7.31 + GenTabbed.write_BODY( self, request ) 7.32 + 7.33 +class DomGenTab( GeneralTab ): 7.34 + 7.35 + def __init__( self ): 7.36 + 7.37 + titles = {} 7.38 + 7.39 + titles[ 'ID' ] = 'dom' 7.40 + titles[ 'Name' ] = 'name' 7.41 + titles[ 'CPU' ] = 'cpu' 7.42 + titles[ 'Memory' ] = ( 'mem', memoryFormatter ) 7.43 + titles[ 'State' ] = ( 'state', stateFormatter ) 7.44 + titles[ 'Total CPU' ] = ( 'cpu_time', smallTimeFormatter ) 7.45 + titles[ 'Up Time' ] = ( 'up_time', bigTimeFormatter ) 7.46 + 7.47 + GeneralTab.__init__( self, "General Domain Info", {}, titles ) 7.48 + 7.49 + def write_BODY( self, request ): 7.50 + 7.51 + dom = request.args.get('dom') 7.52 + 7.53 + if dom is None or len(dom) != 1: 7.54 + request.write( "<p>Please Select a Domain</p>" ) 7.55 + return None 7.56 + else: 7.57 + self.dom = dom[0] 7.58 + 7.59 + self.dict = getDomInfoHash( self.dom ) 7.60 + 7.61 + GeneralTab.write_BODY( self, request ) 7.62 + 7.63 +class DomSXPTab( PreTab ): 7.64 + 7.65 + def __init__( self ): 7.66 + self.dom = 0 7.67 + PreTab.__init__( self, "" ) 7.68 + 7.69 + 7.70 + def write_BODY( self, request ): 7.71 + dom = request.args.get('dom') 7.72 + 7.73 + if dom is None or len(dom) != 1: 7.74 + request.write( "<p>Please Select a Domain</p>" ) 7.75 + return None 7.76 + else: 7.77 + self.dom = dom[0] 7.78 + 7.79 + domInfo = server.xend_domain( self.dom ) 7.80 + 7.81 + self.source = sxp2string( domInfo ) 7.82 + 7.83 + PreTab.write_BODY( self, request ) 7.84 + 7.85 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/tools/python/xen/sv/DomList.py Fri Jul 23 10:25:12 2004 +0000 8.3 @@ -0,0 +1,62 @@ 8.4 +from xen.xend.XendClient import server 8.5 +from xen.xend import sxp 8.6 + 8.7 +from xen.sv.HTMLBase import HTMLBase 8.8 +from xen.sv.util import * 8.9 + 8.10 +class DomList( HTMLBase ): 8.11 + 8.12 + isLeaf = True 8.13 + 8.14 + def __init__( self, urlWriter ): 8.15 + HTMLBase.__init__(self) 8.16 + self.urlWriter = urlWriter 8.17 + 8.18 + def write_BODY( self, request, head=True, long=True ): 8.19 + 8.20 + domains = server.xend_domains() 8.21 + 8.22 + request.write( "\n<table style='border:0px solid white' cellspacing='0' cellpadding='0' border='0' width='100%'>\n" ) 8.23 + 8.24 + if head: 8.25 + request.write( "<tr class='domainInfoHead'>" ) 8.26 + self.write_DOMAIN_HEAD( request, long ) 8.27 + request.write( "</tr>" ) 8.28 + 8.29 + odd = True 8.30 + 8.31 + for domain in domains: 8.32 + if odd: 8.33 + request.write( "<tr class='domainInfoOdd'>\n" ) 8.34 + odd = False 8.35 + else: 8.36 + request.write( "<tr class='domainInfoEven'>\n" ) 8.37 + odd = True 8.38 + self.write_DOMAIN( request, getDomInfoHash( domain ), long ) 8.39 + request.write( "</tr>\n" ) 8.40 + 8.41 + request.write( "</table>\n" ) 8.42 + 8.43 + def write_DOMAIN( self, request, domInfoHash, long=True ): 8.44 + request.write( "<td class='domainInfo' align='center'>%(dom)-4d</td>\n" % domInfoHash ) 8.45 + 8.46 + url = self.urlWriter( "mod=info&dom=%(dom)-4d" % domInfoHash ) 8.47 + 8.48 + request.write( "<td class='domainInfo' align='center'><a href='%s'>%s</a></td>\n" % ( url, domInfoHash['name'] ) ) 8.49 + if long: 8.50 + request.write( "<td class='domainInfo' align='center'>%(mem)7d</td>\n" % domInfoHash ) 8.51 + request.write( "<td class='domainInfo' align='center'>%(cpu)3d</td>\n" % domInfoHash ) 8.52 + request.write( "<td class='domainInfo' align='center'>%(state)5s</td>\n" % domInfoHash ) 8.53 + if long: 8.54 + request.write( "<td class='domainInfo' align='center'>%(cpu_time)7.1f</td>\n" % domInfoHash ) 8.55 + 8.56 + def write_DOMAIN_HEAD( self, request, long=True ): 8.57 + request.write( "<td class='domainInfoHead' align='center'>Domain</td>\n" ) 8.58 + request.write( "<td class='domainInfoHead' align='center'>Name</td>\n" ) 8.59 + if long: 8.60 + request.write( "<td class='domainInfoHead' align='center'>Memory / Mb</td>\n" ) 8.61 + request.write( "<td class='domainInfoHead' align='center'>CPU</td>\n" ) 8.62 + request.write( "<td class='domainInfoHead' align='center'>State</td>\n" ) 8.63 + if long: 8.64 + request.write( "<td class='domainInfoHead' align='center'>CPU time / s</td>\n" ) 8.65 +
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/tools/python/xen/sv/GenTabbed.py Fri Jul 23 10:25:12 2004 +0000 9.3 @@ -0,0 +1,93 @@ 9.4 +import types 9.5 + 9.6 +from xen.sv.HTMLBase import HTMLBase 9.7 +from xen.sv.TabView import TabView 9.8 + 9.9 +class GenTabbed( HTMLBase ): 9.10 + 9.11 + def __init__( self, urlWriter, tabStrings, tabObjects ): 9.12 + HTMLBase.__init__(self) 9.13 + self.tab = 0; 9.14 + self.tabStrings = tabStrings 9.15 + self.tabObjects = tabObjects 9.16 + self.urlWriter = urlWriter 9.17 + 9.18 + def write_BODY( self, request, urlWriter = None ): 9.19 + tab = request.args.get('tab') 9.20 + 9.21 + if tab is None or len( tab) != 1: 9.22 + self.tab = 0 9.23 + else: 9.24 + self.tab = int( tab[0] ) 9.25 + 9.26 + request.write( "<table style='' width='100%' border='0' cellspacing='0' cellpadding='0'>" ) 9.27 + request.write( "<tr><td>" ) 9.28 + 9.29 + TabView( self.tab, self.tabStrings, self.urlWriter ).write_BODY( request ) 9.30 + 9.31 + request.write( "</td></tr><tr><td>" ) 9.32 + 9.33 + render_tab = self.tabObjects[ self.tab ]() 9.34 + 9.35 + if render_tab is None: 9.36 + request.write( "<p>Bad Tab</p>" ) 9.37 + self.finish_BODY( request ) 9.38 + else: 9.39 + render_tab.write_BODY( request ) 9.40 + 9.41 + request.write( "</td></tr></table>" ) 9.42 + 9.43 +class PreTab( HTMLBase ): 9.44 + 9.45 + def __init__( self, source ): 9.46 + HTMLBase.__init__( self ) 9.47 + self.source = source 9.48 + 9.49 + def write_BODY( self, request ): 9.50 + 9.51 + request.write( "<div style='display: block; overflow: auto; border: 0px solid black; height: 400px; width: 540px; padding: 5px; z-index:0; align: center'><pre>" ) 9.52 + 9.53 + request.write( self.source ) 9.54 + 9.55 + request.write( "</pre></div>" ) 9.56 + 9.57 +class GeneralTab( HTMLBase ): 9.58 + 9.59 + def __init__( self, title, dict, titles ): 9.60 + HTMLBase.__init__( self ) 9.61 + self.title = title 9.62 + self.dict = dict 9.63 + self.titles = titles 9.64 + 9.65 + def write_BODY( self, request ): 9.66 + 9.67 + request.write( "<p><u>%s</u></p>" % self.title ) 9.68 + 9.69 + request.write( "<table width='100%' cellspacing='0' cellpadding='0' border='0'>" ) 9.70 + 9.71 + def writeAttr( niceName, attr, formatter=None ): 9.72 + if type( attr ) is types.TupleType: 9.73 + ( attr, formatter ) = attr 9.74 + 9.75 + if attr in self.dict: 9.76 + if formatter: 9.77 + temp = formatter( self.dict[ attr ] ) 9.78 + else: 9.79 + temp = str( self.dict[ attr ] ) 9.80 + request.write( "<tr><td width='50%%'><p>%s:</p></td><td width='50%%'><p>%s</p></td></tr>" % ( niceName, temp ) ) 9.81 + 9.82 + for niceName, attr in self.titles.items(): 9.83 + writeAttr( niceName, attr ) 9.84 + 9.85 + request.write( "</table>" ) 9.86 + 9.87 +class NullTab( HTMLBase ): 9.88 + 9.89 + def __init__( self ): 9.90 + HTMLBase.__init__( self ) 9.91 + self.title = "Null Tab" 9.92 + 9.93 + def write_BODY( self, request ): 9.94 + request.write( "<p>%s</p>" % self.title ) 9.95 + 9.96 +
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/tools/python/xen/sv/HTMLBase.py Fri Jul 23 10:25:12 2004 +0000 10.3 @@ -0,0 +1,25 @@ 10.4 +from twisted.web.resource import Resource 10.5 + 10.6 +class HTMLBase( Resource ): 10.7 + 10.8 + isLeaf = True 10.9 + 10.10 + def __init__( self ): 10.11 + Resource.__init__(self) 10.12 + 10.13 + def render_GET( self, request ): 10.14 + self.write_TOP( request ) 10.15 + self.write_BODY( request ) 10.16 + self.write_BOTTOM( request ) 10.17 + request.finish() 10.18 + return '' 10.19 + 10.20 + def write_BODY( self, request ): 10.21 + request.write( "BODY" ) 10.22 + 10.23 + def write_TOP( self, request ): 10.24 + request.write( '<html><head><title>Xen</title><link rel="stylesheet" type="text/css" href="inc/style.css" />' ) 10.25 + request.write( '</head><body>' ) 10.26 + 10.27 + def write_BOTTOM( self, request ): 10.28 + request.write( "</body></html>" )
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/tools/python/xen/sv/Main.py Fri Jul 23 10:25:12 2004 +0000 11.3 @@ -0,0 +1,63 @@ 11.4 +from xen.sv.HTMLBase import HTMLBase 11.5 +from xen.sv import DomList, NodeInfo, DomInfo 11.6 + 11.7 +class Main( HTMLBase ): 11.8 + 11.9 + isLeaf = True 11.10 + 11.11 + def __init__( self ): 11.12 + HTMLBase.__init__(self) 11.13 + 11.14 + def render_POST( self, request ): 11.15 + return self.render_GET( request ) 11.16 + 11.17 + def mainUrlWriter( self, s ): 11.18 + return "Main.rpy?%s" % s 11.19 + 11.20 + def write_BODY( self, request ): 11.21 + 11.22 + request.write( "\n<table style='border:0px solid black; background: url(images/orb_01.jpg) no-repeat' cellspacing='0' cellpadding='0' border='0' width='780px' height='536px'>\n" ) 11.23 + request.write( "<tr>\n" ) 11.24 + request.write( " <td width='15px'> </td>" ) 11.25 + request.write( " <td width='175px' align='center' valign'center'>" ) 11.26 + request.write( " <table cellspacing='0' cellpadding='0' border='0' width='100%' height='100%'>" ) 11.27 + request.write( " <tr><td height='200px' align='center' valign='center'><a href='http://www.cl.cam.ac.uk/Research/SRG/netos/xen/'>" ) 11.28 + request.write( " <img src='images/xen.png' width='150' height='75' border='0'/></a></td></tr>" ) 11.29 + request.write( " <tr><td align='center' valign='top'>" ) 11.30 + 11.31 + request.write( " <p class='small'><a href='Main.rpy?mod=node'>Node details</a></p>" ) 11.32 + request.write( " <p class='small'><a href='Main.rpy?mod=list'>Domains summary</a></p>" ) 11.33 + 11.34 + DomList.DomList( self.mainUrlWriter ).write_BODY( request, True, False ) 11.35 + 11.36 + request.write( " </td></tr>" ) 11.37 + request.write( " </table>" ) 11.38 + request.write( " " ) 11.39 + request.write( " </td>\n" ) 11.40 + request.write( " <td width='15px'> </td>" ) 11.41 + request.write( " <td width='558px' align='left' valign='top'>" ) 11.42 + request.write( " <table cellspacing='0' cellpadding='0' border='0' width='100%' height='100%'>" ) 11.43 + request.write( " <tr><td height='20px'></td></tr>" ) 11.44 + request.write( " <tr><td align='center' valign='top'>" ) 11.45 + 11.46 + mod = request.args.get('mod') 11.47 + 11.48 + if mod is None or len(mod) != 1: 11.49 + request.write( '<p>Please select a module</p>' ) 11.50 + elif mod[0] == 'info': 11.51 + DomInfo.DomInfo( self.mainUrlWriter ).write_BODY( request ) 11.52 + elif mod[0] == 'list': 11.53 + DomList.DomList( self.mainUrlWriter ).write_BODY( request ) 11.54 + elif mod[0] == 'node': 11.55 + NodeInfo.NodeInfo( self.mainUrlWriter ).write_BODY( request ) 11.56 + else: 11.57 + request.write( '<p>Invalid module. Please select another</p>' ) 11.58 + 11.59 + request.write( " </td></tr>" ) 11.60 + request.write( " </table>" ) 11.61 + request.write( " </td>\n" ) 11.62 + request.write( " <td width='17px'> </td>" ) 11.63 + request.write( "</tr>\n" ) 11.64 + 11.65 + request.write( "</table>\n" ) 11.66 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/tools/python/xen/sv/NodeInfo.py Fri Jul 23 10:25:12 2004 +0000 12.3 @@ -0,0 +1,50 @@ 12.4 +from xen.xend.XendClient import server 12.5 + 12.6 +from xen.sv.util import * 12.7 +from xen.sv.GenTabbed import * 12.8 + 12.9 +class NodeInfo( GenTabbed ): 12.10 + 12.11 + def __init__( self, urlWriter ): 12.12 + 12.13 + def newUrlWriter( url ): 12.14 + return urlWriter( "mod=node%s" % url ) 12.15 + 12.16 + GenTabbed.__init__( self, newUrlWriter, [ 'General', 'Dmesg' ], [ NodeGenTab, NodeDmesgTab ] ) 12.17 + 12.18 +class NodeGenTab( PreTab ): 12.19 + def __init__( self ): 12.20 + text = sxp2string( server.xend_node() ) 12.21 + PreTab.__init__( self, text ) 12.22 + 12.23 +class NodeGeneralTab( GeneralTab ): 12.24 + 12.25 + def __init__( self ): 12.26 + 12.27 + nodeInfo = server.xend_node() 12.28 + 12.29 + dictNodeInfo = {} 12.30 + 12.31 + for l in nodeInfo: 12.32 + dictNodeInfo[ l[0] ] = l[1] 12.33 + 12.34 + dictTitles = {} 12.35 + dictTitles[ 'System' ] = 'system' 12.36 + dictTitles[ 'Hostname' ] = 'host' 12.37 + dictTitles[ 'Release' ] = 'release' 12.38 + dictTitles[ 'Version' ] ='version' 12.39 + dictTitles[ 'Machine' ] = 'machine' 12.40 + dictTitles[ 'Cores' ] = 'cores' 12.41 + dictTitles[ 'Hyperthreading' ] = ( 'hyperthreads_per_core', hyperthreadFormatter ) 12.42 + dictTitles[ 'CPU Speed' ] = ( 'cpu_mhz', cpuFormatter ) 12.43 + dictTitles[ 'Memory' ] = ( 'memory', memoryFormatter ) 12.44 + dictTitles[ 'Free Memory' ] = ( 'free_memory', memoryFormatter ) 12.45 + 12.46 + GeneralTab.__init__( self, title="General Node Info", dict=dictNodeInfo, titles=dictTitles ) 12.47 + 12.48 +class NodeDmesgTab( PreTab ): 12.49 + 12.50 + def __init__( self ): 12.51 + dmesg = server.xend_node_dmesg() 12.52 + PreTab.__init__( self, dmesg[ 1 ] ) 12.53 +
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/tools/python/xen/sv/TabView.py Fri Jul 23 10:25:12 2004 +0000 13.3 @@ -0,0 +1,49 @@ 13.4 +from xen.sv.HTMLBase import HTMLBase 13.5 + 13.6 +class TabView( HTMLBase ): 13.7 + 13.8 + def __init__( self, tab, tabs, urlWriter ): 13.9 + HTMLBase.__init__(self) 13.10 + self.tab = tab # interger - tab id 13.11 + self.tabs = tabs 13.12 + self.urlWriter = urlWriter 13.13 + 13.14 + def write_BODY( self, request ): 13.15 + request.write( "<table style='' border='0' cellspacing='0' cellpadding='0' align='center'>" ) 13.16 + request.write( "<tr height='22'>" ) 13.17 + 13.18 + if self.tab == 0: 13.19 + image = "left-end-highlight.jpg" 13.20 + else: 13.21 + image = "left-end-no-highlight.jpg" 13.22 + 13.23 + request.write( "<td height='22' width='14'><image src='images/%s' width='14' height='22'></td>" % image ) 13.24 + 13.25 + count = len( self.tabs ) 13.26 + 13.27 + for i in range( count ): 13.28 + 13.29 + if i == self.tab: 13.30 + image = "middle-highlight.jpg" 13.31 + else: 13.32 + image = "middle-no-highlight.jpg" 13.33 + 13.34 + request.write( "<td style='background: url(images/%s)'><p align='center'><a href='%s'>%s</a></p></td>" % ( image, self.urlWriter( "&tab=%s" % i ), self.tabs[ i ] ) ) 13.35 + 13.36 + if i < count-1: 13.37 + if i == self.tab: 13.38 + image = "seperator-left-highlight.jpg" 13.39 + elif self.tab == i+1: 13.40 + image = "seperator-right-highlight.jpg" 13.41 + else: 13.42 + image = "seperator.jpg" 13.43 + 13.44 + request.write( "<td height='22' width='23'><image src='images/%s' width='23' height='22'></td>" % image ) 13.45 + 13.46 + if self.tab == count - 1: 13.47 + image = "right-end-highlight.jpg" 13.48 + else: 13.49 + image = "right-end-no-highlight.jpg" 13.50 + 13.51 + request.write( "<td height='22' width='14'><image src='images/%s' width='14' height='22'></td>" % image ) 13.52 + request.write( "</tr></table>" )
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/tools/python/xen/sv/__init__.py Fri Jul 23 10:25:12 2004 +0000 14.3 @@ -0,0 +1,1 @@ 14.4 +
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/tools/python/xen/sv/util.py Fri Jul 23 10:25:12 2004 +0000 15.3 @@ -0,0 +1,74 @@ 15.4 +from xen.xend.XendClient import server 15.5 +from xen.xend import sxp 15.6 +from xen.xend import PrettyPrint 15.7 + 15.8 +def getDomInfoHash( domain ): 15.9 + domInfo = server.xend_domain( int( domain ) ) 15.10 + d = {} 15.11 + d['dom'] = int( domain ) 15.12 + d['name'] = sxp.child_value( domInfo, 'name' ) 15.13 + d['mem'] = int( sxp.child_value( domInfo, 'memory' ) ) 15.14 + d['cpu'] = int( sxp.child_value( domInfo, 'cpu' ) ) 15.15 + d['state'] = sxp.child_value( domInfo, 'state' ) 15.16 + d['cpu_time'] = float( sxp.child_value( domInfo, 'cpu_time' ) ) 15.17 + if( sxp.child_value( domInfo, 'up_time' ) ): 15.18 + d['up_time'] = float( sxp.child_value( domInfo, 'up_time' ) ) 15.19 + if( sxp.child_value( domInfo, 'start_time' ) ): 15.20 + d['start_time'] = float( sxp.child_value( domInfo, 'start_time' ) ) 15.21 + return d 15.22 + 15.23 +def sxp2hash( sxp ): 15.24 + pass 15.25 + 15.26 +def sxp2string( sxp ): 15.27 + class tmp: 15.28 + def __init__( self ): 15.29 + self.str = "" 15.30 + def write( self, str ): 15.31 + self.str = self.str + str 15.32 + temp = tmp() 15.33 + PrettyPrint.prettyprint( sxp, out=temp ) 15.34 + return temp.str 15.35 + 15.36 +def bigTimeFormatter( time ): 15.37 + weeks = time // 604800 15.38 + remainder = time % 604800 15.39 + days = remainder // 86400 15.40 + 15.41 + remainder = remainder % 86400 15.42 + 15.43 + hms = smallTimeFormatter( remainder ) 15.44 + 15.45 + return "%d weeks, %d days, %s" % ( weeks, days, hms ) 15.46 + 15.47 +def smallTimeFormatter( time ): 15.48 + hours = time // 3600 15.49 + remainder = time % 3600 15.50 + mins = remainder // 60 15.51 + secs = time % 60 15.52 + return "%02d:%02d:%04.1f (hh:mm:ss.s)" % ( hours, mins, secs ) 15.53 + 15.54 +def stateFormatter( state ): 15.55 + states = [ 'Running', 'Blocked', 'Paused', 'Shutdown', 'Crashed' ] 15.56 + 15.57 + for i in range( len( state ) ): 15.58 + if state[i] != "-": 15.59 + return states[ i ] + " (%s)" % state 15.60 + 15.61 + return state 15.62 + 15.63 +def memoryFormatter( mem ): 15.64 + return "%7dMb" % mem 15.65 + 15.66 +def cpuFormatter( mhz ): 15.67 + if mhz > 1000: 15.68 + ghz = float( mhz ) / 1000.0 15.69 + return "%4.2fGHz" % ghz 15.70 + else: 15.71 + return "%4dMHz" % mhz 15.72 + 15.73 +def hyperthreadFormatter( threads ): 15.74 + if int( threads ) > 1: 15.75 + return "Yes (%d)" % threads 15.76 + else: 15.77 + return "No"
16.1 --- a/tools/python/xen/xend/XendClient.py Thu Jul 22 16:41:11 2004 +0000 16.2 +++ b/tools/python/xen/xend/XendClient.py Fri Jul 23 10:25:12 2004 +0000 16.3 @@ -121,12 +121,12 @@ class XendRequest: 16.4 data = None 16.5 if method == "POST" and url.path.endswith('/'): 16.6 url.path = url.path[:-1] 16.7 - 16.8 + 16.9 self.headers = hdr 16.10 self.data = data 16.11 self.url = url 16.12 self.method = method 16.13 - 16.14 + 16.15 class XendClientProtocol: 16.16 """Abstract class for xend clients. 16.17 """ 16.18 @@ -134,18 +134,18 @@ class XendClientProtocol: 16.19 def xendRequest(self, url, method, args=None): 16.20 """Make a request to xend. 16.21 Implement in a subclass. 16.22 - 16.23 + 16.24 @param url: xend request url 16.25 @param method: http method: POST or GET 16.26 @param args: request arguments (dict) 16.27 """ 16.28 raise NotImplementedError() 16.29 - 16.30 + 16.31 def xendGet(self, url, args=None): 16.32 """Make a xend request using HTTP GET. 16.33 Requests using GET are usually 'safe' and may be repeated without 16.34 nasty side-effects. 16.35 - 16.36 + 16.37 @param url: xend request url 16.38 @param data: request arguments (dict) 16.39 """ 16.40 @@ -156,7 +156,7 @@ class XendClientProtocol: 16.41 Requests using POST potentially cause side-effects, and should 16.42 not be repeated unless you really want to repeat the side 16.43 effect. 16.44 - 16.45 + 16.46 @param url: xend request url 16.47 @param args: request arguments (dict) 16.48 """ 16.49 @@ -198,7 +198,7 @@ class SynchXendClientProtocol(XendClient 16.50 """A synchronous xend client. This will make a request, wait for 16.51 the reply and return the result. 16.52 """ 16.53 - 16.54 + 16.55 def xendRequest(self, url, method, args=None): 16.56 """Make a request to xend. 16.57 16.58 @@ -244,10 +244,10 @@ class AsynchXendClient(http.HTTPClient): 16.59 16.60 def handleStatus(self, version, status, message): 16.61 return self.protocol.handleStatus(version, status, message) 16.62 - 16.63 + 16.64 def handleResponse(self, data): 16.65 return self.protocol.handleResponse(data) 16.66 - 16.67 + 16.68 class AsynchXendClientProtocol(XendClientProtocol): 16.69 """An asynchronous xend client. Uses twisted to connect to xend 16.70 and make the request. It does not block waiting for the result, 16.71 @@ -255,6 +255,46 @@ class AsynchXendClientProtocol(XendClien 16.72 16.73 Uses AsynchXendClient to manage the connection. 16.74 """ 16.75 + def __init__(self): 16.76 + self.err = None 16.77 + 16.78 + def xendRequest(self, url, method, args=None): 16.79 + """Make a request to xend. The returned deferred is called when 16.80 + the result is available. 16.81 + 16.82 + @param url: xend request url 16.83 + @param method: http method: POST or GET 16.84 + @param args: request arguments (dict) 16.85 + @return: deferred 16.86 + """ 16.87 + request = XendRequest(url, method, args) 16.88 + self.deferred = Deferred() 16.89 + clientCreator = ClientCreator(reactor, AsynchXendClient, self, request) 16.90 + clientCreator.connectTCP(url.host, url.port) 16.91 + return self.deferred 16.92 + 16.93 + def callErrback(self, err): 16.94 + if not self.deferred.called: 16.95 + self.err = err 16.96 + self.deferred.errback(err) 16.97 + return err 16.98 + 16.99 + def callCallback(self, val): 16.100 + if not self.deferred.called: 16.101 + self.deferred.callback(val) 16.102 + return val 16.103 + 16.104 + def handleException(self, err): 16.105 + return self.callErrback(err) 16.106 + 16.107 + def handleResponse(self, data): 16.108 + if self.err: return self.err 16.109 + val = XendClientProtocol.handleResponse(self, data) 16.110 + if isinstance(val, Exception): 16.111 + self.callErrback(val) 16.112 + else: 16.113 + self.callCallback(val) 16.114 + return val 16.115 16.116 def __init__(self): 16.117 self.err = None 16.118 @@ -365,17 +405,20 @@ class Xend: 16.119 16.120 def xend_node(self): 16.121 return self.xendGet(self.nodeurl()) 16.122 + 16.123 + def xend_node_dmesg(self): 16.124 + return self.xendGet(self.dmesgurl()) 16.125 16.126 def xend_node_cpu_rrobin_slice_set(self, slice): 16.127 return self.xendPost(self.nodeurl(), 16.128 {'op' : 'cpu_rrobin_slice_set', 16.129 'slice' : slice }) 16.130 - 16.131 + 16.132 def xend_node_cpu_bvt_slice_set(self, ctx_allow): 16.133 return self.xendPost(self.nodeurl(), 16.134 {'op' : 'cpu_bvt_slice_set', 16.135 'ctx_allow' : ctx_allow }) 16.136 - 16.137 + 16.138 def xend_node_cpu_fbvt_slice_set(self, ctx_allow): 16.139 return self.xendPost(self.nodeurl(), 16.140 {'op' : 'cpu_fbvt_slice_set', 16.141 @@ -442,7 +485,7 @@ class Xend: 16.142 'warp' : warp, 16.143 'warpl' : warpl, 16.144 'warpu' : warpu }) 16.145 - 16.146 + 16.147 def xend_domain_cpu_fbvt_set(self, id, mcuadv, warp, warpl, warpu): 16.148 return self.xendPost(self.domainurl(id), 16.149 {'op' : 'cpu_fbvt_set', 16.150 @@ -450,7 +493,6 @@ class Xend: 16.151 'warp' : warp, 16.152 'warpl' : warpl, 16.153 'warpu' : warpu }) 16.154 - 16.155 16.156 def xend_domain_cpu_atropos_set(self, id, period, slice, latency, xtratime): 16.157 return self.xendPost(self.domainurl(id), 16.158 @@ -459,20 +501,20 @@ class Xend: 16.159 'slice' : slice, 16.160 'latency' : latency, 16.161 'xtratime': xtratime }) 16.162 - 16.163 + 16.164 def xend_domain_vifs(self, id): 16.165 return self.xendGet(self.domainurl(id), 16.166 { 'op' : 'vifs' }) 16.167 - 16.168 + 16.169 def xend_domain_vif(self, id, vif): 16.170 return self.xendGet(self.domainurl(id), 16.171 { 'op' : 'vif', 16.172 'vif' : vif }) 16.173 - 16.174 + 16.175 def xend_domain_vbds(self, id): 16.176 return self.xendGet(self.domainurl(id), 16.177 {'op' : 'vbds'}) 16.178 - 16.179 + 16.180 def xend_domain_vbd(self, id, vbd): 16.181 return self.xendGet(self.domainurl(id), 16.182 {'op' : 'vbd', 16.183 @@ -488,7 +530,7 @@ class Xend: 16.184 {'op' : 'device_destroy', 16.185 'type' : type, 16.186 'index' : idx }) 16.187 - 16.188 + 16.189 def xend_consoles(self): 16.190 return self.xendGet(self.consoleurl()) 16.191 16.192 @@ -517,7 +559,6 @@ class Xend: 16.193 16.194 def xend_dmesg(self): 16.195 return self.xendGet(self.dmesgurl()) 16.196 - 16.197 16.198 def xendmain(srv, asynch, fn, args): 16.199 if asynch: 16.200 @@ -549,15 +590,15 @@ def xendmain(srv, asynch, fn, args): 16.201 16.202 def main(argv): 16.203 """Call an API function: 16.204 - 16.205 + 16.206 python XendClient.py fn args... 16.207 16.208 The leading 'xend_' on the function can be omitted. 16.209 Example: 16.210 16.211 - > python XendClient.py domains 16.212 +python XendClient.py domains 16.213 (0 8) 16.214 - > python XendClient.py domain 0 16.215 +python XendClient.py domain 0 16.216 (domain (id 0) (name Domain-0) (memory 128)) 16.217 """ 16.218 global DEBUG 16.219 @@ -588,3 +629,4 @@ if __name__ == "__main__": 16.220 main(sys.argv) 16.221 else: 16.222 server = Xend() 16.223 + aserver = Xend( AsynchXendClientProtocol() )
17.1 --- a/tools/python/xen/xend/server/SrvServer.py Thu Jul 22 16:41:11 2004 +0000 17.2 +++ b/tools/python/xen/xend/server/SrvServer.py Fri Jul 23 10:25:12 2004 +0000 17.3 @@ -44,12 +44,8 @@ def create(port=None, interface=None, br 17.4 if bridge or xroot.rebooted: 17.5 Vifctl.network('start') 17.6 root = resource.Resource() 17.7 - sv = static.File( "/usr/lib/python2.2/site-packages/xen/xend/sv/" ) 17.8 - sv.indexNames=['Main.rpy'] 17.9 - sv.processors={'.rpy':script.ResourceScript} 17.10 xend = SrvRoot() 17.11 root.putChild('xend', xend) 17.12 - root.putChild('sv', sv) 17.13 site = server.Site(root) 17.14 reactor.listenTCP(port, site, interface=interface) 17.15
18.1 --- a/tools/python/xen/xend/sv/DomInfo.py Thu Jul 22 16:41:11 2004 +0000 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,99 +0,0 @@ 18.4 -from HTMLBase import HTMLBase 18.5 -from XendClientDeferred import server 18.6 -from xen.xend import PrettyPrint 18.7 - 18.8 -from xen.xend.sv.util import * 18.9 -from xen.xend.sv.GenTabbed import * 18.10 - 18.11 -class DomInfo( GenTabbed ): 18.12 - 18.13 - def __init__( self, urlWriter, callback ): 18.14 - 18.15 - self.dom = 0; 18.16 - 18.17 - def tabUrlWriter( tab ): 18.18 - return urlWriter( "mod=info&dom=%s%s" % ( self.dom, tab ) ) 18.19 - 18.20 - GenTabbed.__init__( self, tabUrlWriter, [ 'General', 'SXP', 'Devices' ], [ DomGenTab, DomSXPTab, NullTab ], callback ) 18.21 - 18.22 - def write_BODY( self, request ): 18.23 - dom = request.args.get('dom') 18.24 - 18.25 - if dom is None or len(dom) != 1: 18.26 - request.write( "<p>Please Select a Domain</p>" ) 18.27 - return None 18.28 - else: 18.29 - self.dom = dom[0] 18.30 - 18.31 - GenTabbed.write_BODY( self, request ) 18.32 - 18.33 -class DomGenTab( GeneralTab ): 18.34 - 18.35 - def __init__( self ): 18.36 - 18.37 - titles = {} 18.38 - 18.39 - titles[ 'ID' ] = 'dom' 18.40 - titles[ 'Name' ] = 'name' 18.41 - titles[ 'CPU' ] = 'cpu' 18.42 - titles[ 'Memory' ] = ( 'mem', memoryFormatter ) 18.43 - titles[ 'State' ] = ( 'state', stateFormatter ) 18.44 - titles[ 'Total CPU' ] = ( 'cpu_time', smallTimeFormatter ) 18.45 - titles[ 'Up Time' ] = ( 'up_time', bigTimeFormatter ) 18.46 - 18.47 - GeneralTab.__init__( self, "General Domain Info", {}, titles ) 18.48 - 18.49 - def write_BODY( self, request, callback ): 18.50 - dom = request.args.get('dom') 18.51 - 18.52 - if dom is None or len(dom) != 1: 18.53 - request.write( "<p>Please Select a Domain</p>" ) 18.54 - return None 18.55 - else: 18.56 - self.dom = dom[0] 18.57 - 18.58 - deferred = getDomInfoHash( self.dom ) 18.59 - deferred.addCallback( self.continue_BODY, request, callback ) 18.60 - 18.61 - def continue_BODY( self, dict, request, callback ): 18.62 - 18.63 - self.dict = dict 18.64 - 18.65 - GeneralTab.write_BODY( self, request, callback ) 18.66 - 18.67 -class DomSXPTab( PreTab ): 18.68 - 18.69 - def __init__( self ): 18.70 - self.dom = 0 18.71 - PreTab.__init__( self, "" ) 18.72 - 18.73 - def fn( self, x, request ): 18.74 - class tmp: 18.75 - def __init__( self ): 18.76 - self.str = "" 18.77 - def write( self, str ): 18.78 - self.str = self.str + str 18.79 - temp = tmp() 18.80 - PrettyPrint.prettyprint( x, out=temp ) 18.81 - self.source = temp.str 18.82 - return request 18.83 - 18.84 - def fn2( self, request, callback ): 18.85 - PreTab.write_BODY( self, request, callback ) 18.86 - 18.87 - def write_BODY( self, request, callback ): 18.88 - dom = request.args.get('dom') 18.89 - 18.90 - if dom is None or len(dom) != 1: 18.91 - request.write( "<p>Please Select a Domain</p>" ) 18.92 - return None 18.93 - else: 18.94 - self.dom = dom[0] 18.95 - 18.96 - deferred = server.xend_domain( self.dom ) 18.97 - 18.98 - deferred.addCallback( self.fn, request ) 18.99 - deferred.addCallback( self.fn2, callback ) 18.100 - def errback( x ): 18.101 - print ">err ", x 18.102 - deferred.addErrback( errback ) 18.103 \ No newline at end of file
19.1 --- a/tools/python/xen/xend/sv/DomList.py Thu Jul 22 16:41:11 2004 +0000 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,101 +0,0 @@ 19.4 -from twisted.web import resource 19.5 -from twisted.web.server import NOT_DONE_YET 19.6 - 19.7 -from XendClientDeferred import server as XendServer 19.8 -from xen.xend import sxp 19.9 - 19.10 -from xen.xend.sv.HTMLBase import HTMLBase 19.11 -from xen.xend.sv.util import * 19.12 - 19.13 -from twisted.internet import reactor 19.14 - 19.15 -class DomList( HTMLBase ): 19.16 - 19.17 - isLeaf = True 19.18 - 19.19 - def __init__( self, urlWriter, callback ): 19.20 - HTMLBase.__init__(self) 19.21 - self.urlWriter = urlWriter 19.22 - self.head = None 19.23 - self.long = None 19.24 - self.rendered_domains = {} 19.25 - self.domCount = 0 19.26 - self.callback = callback 19.27 - 19.28 - def write_BODY( self, request, head=True, long=True ): 19.29 - deferred = XendServer.xend_domains() 19.30 - deferred.addCallback( self.get_domain_info, request ) 19.31 - deferred.addErrback( self.errback ) 19.32 - 19.33 - self.head = head 19.34 - self.long = long 19.35 - 19.36 - def errback( self, err ): 19.37 - print 'errback>', err 19.38 - 19.39 - def get_domain_info( self, domains, request ): 19.40 - 19.41 - self.domCount = len( domains ) 19.42 - 19.43 - for domain in domains: 19.44 - deferred = getDomInfoHash( domain ) 19.45 - deferred.addCallback( self.render_domain, request ) 19.46 - deferred.addErrback( self.errback ) 19.47 - 19.48 - def render_domain( self, domInfoHash, request ): 19.49 - 19.50 - domStr = "<td class='domainInfo' align='center'>%(dom)-4d</td>\n" % domInfoHash 19.51 - 19.52 - url = self.urlWriter( "mod=info&dom=%(dom)-4d" % domInfoHash ) 19.53 - 19.54 - domStr += "<td class='domainInfo' align='center'><a href='%s'>%s</a></td>\n" % ( url, domInfoHash['name'] ) 19.55 - 19.56 - if self.long: 19.57 - domStr += "<td class='domainInfo' align='center'>%(mem)7d</td>\n" % domInfoHash 19.58 - domStr += "<td class='domainInfo' align='center'>%(cpu)3d</td>\n" % domInfoHash 19.59 - 19.60 - domStr += "<td class='domainInfo' align='center'>%(state)5s</td>\n" % domInfoHash 19.61 - 19.62 - if self.long: 19.63 - domStr += "<td class='domainInfo' align='center'>%(cpu_time)7.1f</td>\n" % domInfoHash 19.64 - 19.65 - self.rendered_domains[ domInfoHash[ 'dom' ] ] = domStr 19.66 - self.domCount -= 1 19.67 - 19.68 - if self.domCount == 0: 19.69 - self.finish_write_BODY( request ) 19.70 - 19.71 - def finish_write_BODY( self, request ): 19.72 - 19.73 - request.write( "\n<table style='border:0px solid white' cellspacing='0' cellpadding='0' border='0' width='100%'>\n" ) 19.74 - 19.75 - if self.head: 19.76 - request.write( "<tr class='domainInfoHead'>" ) 19.77 - self.write_DOMAIN_HEAD( request, self.long ) 19.78 - request.write( "</tr>" ) 19.79 - 19.80 - odd = True 19.81 - for domain in self.rendered_domains.values(): 19.82 - if odd: 19.83 - request.write( "<tr class='domainInfoOdd'>\n" ) 19.84 - odd = False 19.85 - else: 19.86 - request.write( "<tr class='domainInfoEven'>\n" ) 19.87 - odd = True 19.88 - request.write( domain ) 19.89 - request.write( "</tr>\n" ) 19.90 - 19.91 - request.write( "</table>\n" ) 19.92 - 19.93 - self.callback( request ) 19.94 - 19.95 - def write_DOMAIN_HEAD( self, request, long=True ): 19.96 - request.write( "<td class='domainInfoHead' align='center'>Domain</td>\n" ) 19.97 - request.write( "<td class='domainInfoHead' align='center'>Name</td>\n" ) 19.98 - if long: 19.99 - request.write( "<td class='domainInfoHead' align='center'>Memory / Mb</td>\n" ) 19.100 - request.write( "<td class='domainInfoHead' align='center'>CPU</td>\n" ) 19.101 - request.write( "<td class='domainInfoHead' align='center'>State</td>\n" ) 19.102 - if long: 19.103 - request.write( "<td class='domainInfoHead' align='center'>CPU time / s</td>\n" ) 19.104 -
20.1 --- a/tools/python/xen/xend/sv/GenTabbed.py Thu Jul 22 16:41:11 2004 +0000 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,103 +0,0 @@ 20.4 -import types 20.5 - 20.6 -from HTMLBase import HTMLBase 20.7 -from TabView import TabView 20.8 - 20.9 -class GenTabbed( HTMLBase ): 20.10 - 20.11 - def __init__( self, urlWriter, tabStrings, tabObjects, callback ): 20.12 - HTMLBase.__init__(self) 20.13 - self.tab = 0; 20.14 - self.tabStrings = tabStrings 20.15 - self.tabObjects = tabObjects 20.16 - self.urlWriter = urlWriter 20.17 - self.callback = callback 20.18 - 20.19 - def write_BODY( self, request, urlWriter = None ): 20.20 - tab = request.args.get('tab') 20.21 - 20.22 - if tab is None or len( tab) != 1: 20.23 - self.tab = 0 20.24 - else: 20.25 - self.tab = int( tab[0] ) 20.26 - 20.27 - request.write( "<table style='' width='100%' border='0' cellspacing='0' cellpadding='0'>" ) 20.28 - request.write( "<tr><td>" ) 20.29 - 20.30 - TabView( self.tab, self.tabStrings, self.urlWriter ).write_BODY( request ) 20.31 - 20.32 - request.write( "</td></tr><tr><td>" ) 20.33 - 20.34 - render_tab = self.tabObjects[ self.tab ]() 20.35 - 20.36 - if render_tab is None: 20.37 - request.write( "<p>Bad Tab</p>" ) 20.38 - self.finish_BODY( request ) 20.39 - else: 20.40 - render_tab.write_BODY( request, self.finish_BODY ) 20.41 - 20.42 - def finish_BODY( self, request ): 20.43 - 20.44 - request.write( "</td></tr></table>" ) 20.45 - 20.46 - self.callback( request ) 20.47 - 20.48 -class PreTab( HTMLBase ): 20.49 - 20.50 - def __init__( self, source ): 20.51 - HTMLBase.__init__( self ) 20.52 - self.source = source 20.53 - 20.54 - def write_BODY( self, request, callback ): 20.55 - 20.56 - request.write( "<div style='display: block; overflow: auto; border: 0px solid black; height: 400px; width: 540px; padding: 5px; z-index:0; align: center'><pre>" ) 20.57 - 20.58 - request.write( self.source ) 20.59 - 20.60 - request.write( "</pre></div>" ) 20.61 - 20.62 - callback( request ) 20.63 - 20.64 -class GeneralTab( HTMLBase ): 20.65 - 20.66 - def __init__( self, title, dict, titles ): 20.67 - HTMLBase.__init__( self ) 20.68 - self.title = title 20.69 - self.dict = dict 20.70 - self.titles = titles 20.71 - 20.72 - def write_BODY( self, request, callback ): 20.73 - 20.74 - request.write( "<p><u>%s</u></p>" % self.title ) 20.75 - 20.76 - request.write( "<table width='100%' cellspacing='0' cellpadding='0' border='0'>" ) 20.77 - 20.78 - def writeAttr( niceName, attr, formatter=None ): 20.79 - if type( attr ) is types.TupleType: 20.80 - ( attr, formatter ) = attr 20.81 - 20.82 - if attr in self.dict: 20.83 - if formatter: 20.84 - temp = formatter( self.dict[ attr ] ) 20.85 - else: 20.86 - temp = str( self.dict[ attr ] ) 20.87 - request.write( "<tr><td width='50%%'><p>%s:</p></td><td width='50%%'><p>%s</p></td></tr>" % ( niceName, temp ) ) 20.88 - 20.89 - for niceName, attr in self.titles.items(): 20.90 - writeAttr( niceName, attr ) 20.91 - 20.92 - request.write( "</table>" ) 20.93 - 20.94 - callback( request ) 20.95 - 20.96 -class NullTab( HTMLBase ): 20.97 - 20.98 - def __init__( self ): 20.99 - HTMLBase.__init__( self ) 20.100 - self.title = "Null Tab" 20.101 - 20.102 - def write_BODY( self, request, callback ): 20.103 - request.write( "<p>%s</p>" % self.title ) 20.104 - callback( request ) 20.105 - 20.106 - 20.107 \ No newline at end of file
21.1 --- a/tools/python/xen/xend/sv/HTMLBase.py Thu Jul 22 16:41:11 2004 +0000 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,27 +0,0 @@ 21.4 -from twisted.web import server, resource 21.5 -from twisted.internet import reactor 21.6 - 21.7 -class HTMLBase( resource.Resource ): 21.8 - 21.9 - isLeaf = True 21.10 - 21.11 - def __init__( self ): 21.12 - resource.Resource.__init__(self) 21.13 - 21.14 - def render_GET( self, request ): 21.15 - self.write_TOP( request ) 21.16 - return self.write_BODY( request, self.finish_render_GET ) 21.17 - 21.18 - def finish_render_GET( self, request ): 21.19 - self.write_BOTTOM( request ) 21.20 - request.finish() 21.21 - 21.22 - def write_BODY( self, request ): 21.23 - request.write( "BODY" ) 21.24 - 21.25 - def write_TOP( self, request ): 21.26 - request.write( '<html><head><title>Xen</title><link rel="stylesheet" type="text/css" href="inc/style.css" />' ) 21.27 - request.write( '</head><body>' ) 21.28 - 21.29 - def write_BOTTOM( self, request ): 21.30 - request.write( "</body></html>" ) 21.31 \ No newline at end of file
22.1 --- a/tools/python/xen/xend/sv/Main.py Thu Jul 22 16:41:11 2004 +0000 22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 22.3 @@ -1,81 +0,0 @@ 22.4 -from twisted.web import resource 22.5 -from twisted.web.server import NOT_DONE_YET 22.6 - 22.7 -from xen.xend.XendClient import server as XendServer 22.8 -from xen.xend import sxp 22.9 - 22.10 -from HTMLBase import HTMLBase 22.11 - 22.12 -from xen.xend.sv import DomList, NodeInfo, DomInfo 22.13 - 22.14 -class Main( HTMLBase ): 22.15 - 22.16 - isLeaf = True 22.17 - 22.18 - def __init__( self ): 22.19 - HTMLBase.__init__(self) 22.20 - 22.21 - def render_POST( self, request ): 22.22 - return self.render_GET( request ) 22.23 - 22.24 - def mainUrlWriter( self, s ): 22.25 - return "Main.rpy?%s" % s 22.26 - 22.27 - def write_BODY( self, request, callback ): 22.28 - 22.29 - self.callback = callback 22.30 - 22.31 - request.write( "\n<table style='border:0px solid black; background: url(images/orb_01.jpg) no-repeat' cellspacing='0' cellpadding='0' border='0' width='780px' height='536px'>\n" ) 22.32 - request.write( "<tr>\n" ) 22.33 - request.write( " <td width='15px'> </td>" ) 22.34 - request.write( " <td width='175px' align='center' valign'center'>" ) 22.35 - request.write( " <table cellspacing='0' cellpadding='0' border='0' width='100%' height='100%'>" ) 22.36 - request.write( " <tr><td height='200px' align='center' valign='center'><a href='http://www.cl.cam.ac.uk/Research/SRG/netos/xen/'>" ) 22.37 - request.write( " <img src='images/xen.png' width='150' height='75' border='0'/></a></td></tr>" ) 22.38 - request.write( " <tr><td align='center' valign='top'>" ) 22.39 - 22.40 - request.write( " <p class='small'><a href='Main.rpy?mod=node'>Node details</a></p>" ) 22.41 - request.write( " <p class='small'><a href='Main.rpy?mod=list'>Domains summary</a></p>" ) 22.42 - 22.43 - DomList.DomList( self.mainUrlWriter, self.continue_BODY ).write_BODY( request, True, False ) 22.44 - 22.45 - return NOT_DONE_YET 22.46 - 22.47 - def continue_BODY( self, request ): 22.48 - request.write( " </td></tr>" ) 22.49 - request.write( " </table>" ) 22.50 - request.write( " " ) 22.51 - request.write( " </td>\n" ) 22.52 - request.write( " <td width='15px'> </td>" ) 22.53 - request.write( " <td width='558px' align='left' valign='top'>" ) 22.54 - request.write( " <table cellspacing='0' cellpadding='0' border='0' width='100%' height='100%'>" ) 22.55 - request.write( " <tr><td height='20px'></td></tr>" ) 22.56 - request.write( " <tr><td align='center' valign='top'>" ) 22.57 - 22.58 - mod = request.args.get('mod') 22.59 - 22.60 - if mod is None or len(mod) != 1: 22.61 - request.write( '<p>Please select a module</p>' ) 22.62 - self.finish_BODY( request ) 22.63 - elif mod[0] == 'info': 22.64 - DomInfo.DomInfo( self.mainUrlWriter, self.finish_BODY ).write_BODY( request ) 22.65 - elif mod[0] == 'list': 22.66 - DomList.DomList( self.mainUrlWriter, self.finish_BODY ).write_BODY( request ) 22.67 - elif mod[0] == 'node': 22.68 - NodeInfo.NodeInfo( self.mainUrlWriter, self.finish_BODY ).write_BODY( request ) 22.69 - else: 22.70 - request.write( '<p>Invalid module. Please select another</p>' ) 22.71 - self.finish_BODY( request ) 22.72 - 22.73 - def finish_BODY( self, request ): 22.74 - 22.75 - request.write( " </td></tr>" ) 22.76 - request.write( " </table>" ) 22.77 - request.write( " </td>\n" ) 22.78 - request.write( " <td width='17px'> </td>" ) 22.79 - request.write( "</tr>\n" ) 22.80 - 22.81 - request.write( "</table>\n" ) 22.82 - 22.83 - self.callback( request ) 22.84 - 22.85 \ No newline at end of file
23.1 --- a/tools/python/xen/xend/sv/Main.rpy Thu Jul 22 16:41:11 2004 +0000 23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 23.3 @@ -1,3 +0,0 @@ 23.4 -from xen.xend.sv.Main import * 23.5 - 23.6 -resource = Main() 23.7 \ No newline at end of file
24.1 --- a/tools/python/xen/xend/sv/NodeInfo.py Thu Jul 22 16:41:11 2004 +0000 24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 24.3 @@ -1,47 +0,0 @@ 24.4 -from xen.xend import XendDmesg 24.5 -from xen.xend import XendNode 24.6 - 24.7 -from xen.xend.sv.util import * 24.8 -from xen.xend.sv.GenTabbed import * 24.9 -from xen.xend.sv.HTMLBase import HTMLBase 24.10 - 24.11 -class NodeInfo( GenTabbed ): 24.12 - 24.13 - def __init__( self, urlWriter, callback ): 24.14 - 24.15 - def newUrlWriter( url ): 24.16 - return urlWriter( "mod=node%s" % url ) 24.17 - 24.18 - GenTabbed.__init__( self, newUrlWriter, [ 'General', 'Dmesg' ], [ NodeGeneralTab, NodeDmesgTab ], callback ) 24.19 - 24.20 -class NodeGeneralTab( GeneralTab ): 24.21 - 24.22 - def __init__( self ): 24.23 - 24.24 - nodeInfo = XendNode.instance().info() 24.25 - 24.26 - dictNodeInfo = {} 24.27 - 24.28 - for l in nodeInfo: 24.29 - dictNodeInfo[ l[0] ] = l[1] 24.30 - 24.31 - dictTitles = {} 24.32 - dictTitles[ 'System' ] = 'system' 24.33 - dictTitles[ 'Hostname' ] = 'host' 24.34 - dictTitles[ 'Release' ] = 'release' 24.35 - dictTitles[ 'Version' ] ='version' 24.36 - dictTitles[ 'Machine' ] = 'machine' 24.37 - dictTitles[ 'Cores' ] = 'cores' 24.38 - dictTitles[ 'Hyperthreading' ] = ( 'hyperthreads_per_core', hyperthreadFormatter ) 24.39 - dictTitles[ 'CPU Speed' ] = ( 'cpu_mhz', cpuFormatter ) 24.40 - dictTitles[ 'Memory' ] = ( 'memory', memoryFormatter ) 24.41 - dictTitles[ 'Free Memory' ] = ( 'free_memory', memoryFormatter ) 24.42 - 24.43 - GeneralTab.__init__( self, title="General Node Info", dict=dictNodeInfo, titles=dictTitles ) 24.44 - 24.45 -class NodeDmesgTab( PreTab ): 24.46 - 24.47 - def __init__( self ): 24.48 - self.xd = XendDmesg.instance() 24.49 - PreTab.__init__( self, self.xd.info()[0] ) 24.50 - 24.51 \ No newline at end of file
25.1 --- a/tools/python/xen/xend/sv/TabView.py Thu Jul 22 16:41:11 2004 +0000 25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 25.3 @@ -1,49 +0,0 @@ 25.4 -from xen.xend.sv.HTMLBase import HTMLBase 25.5 - 25.6 -class TabView( HTMLBase ): 25.7 - 25.8 - def __init__( self, tab, tabs, urlWriter ): 25.9 - HTMLBase.__init__(self) 25.10 - self.tab = tab # interger - tab id 25.11 - self.tabs = tabs 25.12 - self.urlWriter = urlWriter 25.13 - 25.14 - def write_BODY( self, request ): 25.15 - request.write( "<table style='' border='0' cellspacing='0' cellpadding='0' align='center'>" ) 25.16 - request.write( "<tr height='22'>" ) 25.17 - 25.18 - if self.tab == 0: 25.19 - image = "left-end-highlight.jpg" 25.20 - else: 25.21 - image = "left-end-no-highlight.jpg" 25.22 - 25.23 - request.write( "<td height='22' width='14'><image src='images/%s' width='14' height='22'></td>" % image ) 25.24 - 25.25 - count = len( self.tabs ) 25.26 - 25.27 - for i in range( count ): 25.28 - 25.29 - if i == self.tab: 25.30 - image = "middle-highlight.jpg" 25.31 - else: 25.32 - image = "middle-no-highlight.jpg" 25.33 - 25.34 - request.write( "<td style='background: url(images/%s)'><p align='center'><a href='%s'>%s</a></p></td>" % ( image, self.urlWriter( "&tab=%s" % i ), self.tabs[ i ] ) ) 25.35 - 25.36 - if i < count-1: 25.37 - if i == self.tab: 25.38 - image = "seperator-left-highlight.jpg" 25.39 - elif self.tab == i+1: 25.40 - image = "seperator-right-highlight.jpg" 25.41 - else: 25.42 - image = "seperator.jpg" 25.43 - 25.44 - request.write( "<td height='22' width='23'><image src='images/%s' width='23' height='22'></td>" % image ) 25.45 - 25.46 - if self.tab == count - 1: 25.47 - image = "right-end-highlight.jpg" 25.48 - else: 25.49 - image = "right-end-no-highlight.jpg" 25.50 - 25.51 - request.write( "<td height='22' width='14'><image src='images/%s' width='14' height='22'></td>" % image ) 25.52 - request.write( "</tr></table>" )
26.1 --- a/tools/python/xen/xend/sv/XendClientDeferred.py Thu Jul 22 16:41:11 2004 +0000 26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 26.3 @@ -1,363 +0,0 @@ 26.4 -# Copyright (C) 2004 Tom Wilkie <tw275@cam.ac.uk> 26.5 -# Copyright (C) 2004 Mike Wray 26.6 -"""Client API for the HTTP interface on xend. 26.7 -Callable as a script - see main(). 26.8 - 26.9 -This API is the 'control-plane' for xend. 26.10 -The 'data-plane' is done separately. For example, consoles 26.11 -are accessed via sockets on xend, but the list of consoles 26.12 -is accessible via this API. 26.13 - 26.14 -This one is similar to mikes, but works in an async fashion 26.15 -""" 26.16 -import sys 26.17 -import httplib 26.18 -import types 26.19 -from StringIO import StringIO 26.20 -import urlparse 26.21 - 26.22 -from xen.xend.encode import * 26.23 -from xen.xend.sxp import * 26.24 -from xen.xend.PrettyPrint import prettyprint 26.25 - 26.26 -from twisted.protocols.http import HTTPClient 26.27 -from twisted.internet.protocol import ClientCreator 26.28 -from twisted.internet.defer import Deferred 26.29 -from twisted.internet import reactor 26.30 - 26.31 -DEBUG = 0 26.32 - 26.33 -class XendRequest( HTTPClient ): 26.34 - def __init__(self, deferred, urls): 26.35 - self.urls = urls 26.36 - self.deferred = deferred 26.37 - 26.38 - def connectionMade(self): 26.39 - self.sendCommand('GET', self.urls[2]) 26.40 - self.sendHeader('Host', '%s:%d' % (self.urls[0], self.urls[1]) ) 26.41 - self.endHeaders() 26.42 - 26.43 - def handleResponse(self, data): 26.44 - self.deferred.callback( data ) 26.45 - 26.46 -def process_SXP( sexp ): 26.47 - pin = Parser() 26.48 - pin.input(sexp) 26.49 - pin.input_eof() 26.50 - return pin.get_val() 26.51 - 26.52 -def xend_request(url, method, data=None): 26.53 - """Make a request to xend. 26.54 - 26.55 - url xend request url 26.56 - method http method: POST or GET 26.57 - data request argument data (dict) 26.58 - """ 26.59 - urlinfo = urlparse.urlparse(url) 26.60 - (uproto, ulocation, upath, uparam, uquery, ufrag) = urlinfo 26.61 - (hdr, args) = encode_data(data) 26.62 - if data and method == 'GET': 26.63 - upath += '?' + args 26.64 - args = None 26.65 - if method == "POST" and upath.endswith('/'): 26.66 - upath = upath[:-1] 26.67 - 26.68 - deferred = Deferred() 26.69 - 26.70 - clientCreator = ClientCreator( reactor, XendRequest, deferred, (ulocation, 8000, upath) ) 26.71 - clientCreator.connectTCP( ulocation, 8000 ) 26.72 - 26.73 - deferred.addCallback( process_SXP ) 26.74 - 26.75 - return deferred 26.76 - 26.77 -class XendError(RuntimeError): 26.78 - pass 26.79 - 26.80 -class Foo(httplib.HTTPResponse): 26.81 - 26.82 - def begin(self): 26.83 - fin = self.fp 26.84 - while(1): 26.85 - buf = fin.readline() 26.86 - print "***", buf 26.87 - if buf == '': 26.88 - print 26.89 - sys.exit() 26.90 - 26.91 - 26.92 -def sxprio(sxpr): 26.93 - """Convert an sxpr to a string. 26.94 - """ 26.95 - io = StringIO() 26.96 - sxp.show(sxpr, out=io) 26.97 - print >> io 26.98 - io.seek(0) 26.99 - return io 26.100 - 26.101 -def fileof(val): 26.102 - """Converter for passing configs. 26.103 - Handles lists, files directly. 26.104 - Assumes a string is a file name and passes its contents. 26.105 - """ 26.106 - if isinstance(val, types.ListType): 26.107 - return sxprio(val) 26.108 - if isinstance(val, types.StringType): 26.109 - return file(val) 26.110 - if hasattr(val, 'readlines'): 26.111 - return val 26.112 - 26.113 -# todo: need to sort of what urls/paths are using for objects. 26.114 -# e.g. for domains at the moment return '0'. 26.115 -# should probably return abs path w.r.t. server, e.g. /xend/domain/0. 26.116 -# As an arg, assume abs path is obj uri, otherwise just id. 26.117 - 26.118 -# Function to convert to full url: Xend.uri(path), e.g. 26.119 -# maps /xend/domain/0 to http://wray-m-3.hpl.hp.com:8000/xend/domain/0 26.120 -# And should accept urls for ids? 26.121 - 26.122 -def urljoin(location, root, prefix='', rest=''): 26.123 - prefix = str(prefix) 26.124 - rest = str(rest) 26.125 - base = 'http://' + location + root + prefix 26.126 - url = urlparse.urljoin(base, rest) 26.127 - return url 26.128 - 26.129 -def nodeurl(location, root, id=''): 26.130 - return urljoin(location, root, 'node/', id) 26.131 - 26.132 -def domainurl(location, root, id=''): 26.133 - return urljoin(location, root, 'domain/', id) 26.134 - 26.135 -def consoleurl(location, root, id=''): 26.136 - return urljoin(location, root, 'console/', id) 26.137 - 26.138 -def deviceurl(location, root, id=''): 26.139 - return urljoin(location, root, 'device/', id) 26.140 - 26.141 -def vneturl(location, root, id=''): 26.142 - return urljoin(location, root, 'vnet/', id) 26.143 - 26.144 -def eventurl(location, root, id=''): 26.145 - return urljoin(location, root, 'event/', id) 26.146 - 26.147 -def xend_get(url, args=None): 26.148 - """Make a xend request using GET. 26.149 - Requests using GET are 'safe' and may be repeated without 26.150 - nasty side-effects. 26.151 - """ 26.152 - return xend_request(url, "GET", args) 26.153 - 26.154 -def xend_call(url, data): 26.155 - """Make xend request using POST. 26.156 - Requests using POST potentially cause side-effects and should 26.157 - not be repeated unless it really is wanted to do the side 26.158 - effect again. 26.159 - """ 26.160 - return xend_request(url, "POST", data) 26.161 - 26.162 -class Xend: 26.163 - 26.164 - """Default location of the xend server.""" 26.165 - SRV_DEFAULT = "localhost" 26.166 - 26.167 - """Default path to the xend root on the server.""" 26.168 - ROOT_DEFAULT = "/xend/" 26.169 - 26.170 - def __init__(self, srv=None, root=None): 26.171 - self.bind(srv, root) 26.172 - 26.173 - def bind(self, srv=None, root=None): 26.174 - """Bind to a given server. 26.175 - 26.176 - srv server location (host:port) 26.177 - root server xend root path 26.178 - """ 26.179 - if srv is None: srv = self.SRV_DEFAULT 26.180 - if root is None: root = self.ROOT_DEFAULT 26.181 - if not root.endswith('/'): root += '/' 26.182 - self.location = srv 26.183 - self.root = root 26.184 - 26.185 - def nodeurl(self, id=''): 26.186 - return nodeurl(self.location, self.root, id) 26.187 - 26.188 - def domainurl(self, id=''): 26.189 - return domainurl(self.location, self.root, id) 26.190 - 26.191 - def consoleurl(self, id=''): 26.192 - return consoleurl(self.location, self.root, id) 26.193 - 26.194 - def deviceurl(self, id=''): 26.195 - return deviceurl(self.location, self.root, id) 26.196 - 26.197 - def vneturl(self, id=''): 26.198 - return vneturl(self.location, self.root, id) 26.199 - 26.200 - def eventurl(self, id=''): 26.201 - return eventurl(self.location, self.root, id) 26.202 - 26.203 - def xend(self): 26.204 - return xend_get(urljoin(self.location, self.root)) 26.205 - 26.206 - def xend_node(self): 26.207 - return xend_get(self.nodeurl()) 26.208 - 26.209 - def xend_node_cpu_rrobin_slice_set(self, slice): 26.210 - return xend_call(self.nodeurl(), 26.211 - {'op' : 'cpu_rrobin_slice_set', 26.212 - 'slice' : slice }) 26.213 - 26.214 - def xend_node_cpu_bvt_slice_set(self, ctx_allow): 26.215 - return xend_call(self.nodeurl(), 26.216 - {'op' : 'cpu_bvt_slice_set', 26.217 - 'ctx_allow' : ctx_allow }) 26.218 - 26.219 - def xend_node_cpu_fbvt_slice_set(self, ctx_allow): 26.220 - return xend_call(self.nodeurl(), 26.221 - {'op' : 'cpu_fbvt_slice_set', 26.222 - 'ctx_allow' : ctx_allow }) 26.223 - 26.224 - def xend_domains(self): 26.225 - return xend_get(self.domainurl()) 26.226 - 26.227 - def xend_domain_create(self, conf): 26.228 - return xend_call(self.domainurl(), 26.229 - {'op' : 'create', 26.230 - 'config' : fileof(conf) }) 26.231 - 26.232 - def xend_domain(self, id): 26.233 - return xend_get(self.domainurl(id)) 26.234 - 26.235 - def xend_domain_unpause(self, id): 26.236 - return xend_call(self.domainurl(id), 26.237 - {'op' : 'unpause'}) 26.238 - 26.239 - def xend_domain_pause(self, id): 26.240 - return xend_call(self.domainurl(id), 26.241 - {'op' : 'pause'}) 26.242 - 26.243 - def xend_domain_shutdown(self, id, reason): 26.244 - return xend_call(self.domainurl(id), 26.245 - {'op' : 'shutdown', 26.246 - 'reason' : reason }) 26.247 - 26.248 - def xend_domain_destroy(self, id): 26.249 - return xend_call(self.domainurl(id), 26.250 - {'op' : 'destroy'}) 26.251 - 26.252 - def xend_domain_save(self, id, filename): 26.253 - return xend_call(self.domainurl(id), 26.254 - {'op' : 'save', 26.255 - 'file' : filename}) 26.256 - 26.257 - def xend_domain_restore(self, id, filename): 26.258 - return xend_call(self.domainurl(id), 26.259 - {'op' : 'restore', 26.260 - 'file' : filename }) 26.261 - 26.262 - def xend_domain_migrate(self, id, dst): 26.263 - return xend_call(self.domainurl(id), 26.264 - {'op' : 'migrate', 26.265 - 'destination': dst}) 26.266 - 26.267 - def xend_domain_pincpu(self, id, cpu): 26.268 - return xend_call(self.domainurl(id), 26.269 - {'op' : 'pincpu', 26.270 - 'cpu' : cpu}) 26.271 - 26.272 - def xend_domain_cpu_bvt_set(self, id, mcuadv, warp, warpl, warpu): 26.273 - return xend_call(self.domainurl(id), 26.274 - {'op' : 'cpu_bvt_set', 26.275 - 'mcuadv' : mcuadv, 26.276 - 'warp' : warp, 26.277 - 'warpl' : warpl, 26.278 - 'warpu' : warpu }) 26.279 - 26.280 - def xend_domain_cpu_fbvt_set(self, id, mcuadv, warp, warpl, warpu): 26.281 - return xend_call(self.domainurl(id), 26.282 - {'op' : 'cpu_fbvt_set', 26.283 - 'mcuadv' : mcuadv, 26.284 - 'warp' : warp, 26.285 - 'warpl' : warpl, 26.286 - 'warpu' : warpu }) 26.287 - 26.288 - 26.289 - def xend_domain_cpu_atropos_set(self, id, period, slice, latency, xtratime): 26.290 - return xend_call(self.domainurl(id), 26.291 - {'op' : 'cpu_atropos_set', 26.292 - 'period' : period, 26.293 - 'slice' : slice, 26.294 - 'latency' : latency, 26.295 - 'xtratime': xtratime }) 26.296 - 26.297 - def xend_domain_vifs(self, id): 26.298 - return xend_get(self.domainurl(id), 26.299 - { 'op' : 'vifs' }) 26.300 - 26.301 - def xend_domain_vif_ip_add(self, id, vif, ipaddr): 26.302 - return xend_call(self.domainurl(id), 26.303 - {'op' : 'vif_ip_add', 26.304 - 'vif' : vif, 26.305 - 'ip' : ipaddr }) 26.306 - 26.307 - def xend_domain_vbds(self, id): 26.308 - return xend_get(self.domainurl(id), 26.309 - {'op' : 'vbds'}) 26.310 - 26.311 - def xend_domain_vbd(self, id, vbd): 26.312 - return xend_get(self.domainurl(id), 26.313 - {'op' : 'vbd', 26.314 - 'vbd' : vbd}) 26.315 - 26.316 - def xend_consoles(self): 26.317 - return xend_get(self.consoleurl()) 26.318 - 26.319 - def xend_console(self, id): 26.320 - return xend_get(self.consoleurl(id)) 26.321 - 26.322 - def xend_vnets(self): 26.323 - return xend_get(self.vneturl()) 26.324 - 26.325 - def xend_vnet_create(self, conf): 26.326 - return xend_call(self.vneturl(), 26.327 - {'op': 'create', 'config': fileof(conf) }) 26.328 - 26.329 - def xend_vnet(self, id): 26.330 - return xend_get(self.vneturl(id)) 26.331 - 26.332 - def xend_vnet_delete(self, id): 26.333 - return xend_call(self.vneturl(id), 26.334 - {'op': 'delete'}) 26.335 - 26.336 - def xend_event_inject(self, sxpr): 26.337 - val = xend_call(self.eventurl(), 26.338 - {'op': 'inject', 'event': fileof(sxpr) }) 26.339 - 26.340 -def main(argv): 26.341 - """Call an API function: 26.342 - 26.343 - python XendClient.py fn args... 26.344 - 26.345 - The leading 'xend_' on the function can be omitted. 26.346 - Example: 26.347 - 26.348 - > python XendClient.py domains 26.349 - (domain 0 8) 26.350 - > python XendClient.py domain 0 26.351 - (domain (id 0) (name Domain-0) (memory 128)) 26.352 - """ 26.353 - server = Xend() 26.354 - fn = argv[1] 26.355 - if not fn.startswith('xend'): 26.356 - fn = 'xend_' + fn 26.357 - args = argv[2:] 26.358 - deferred = getattr(server, fn)(*args) 26.359 - deferred.addCallback( prettyprint ) 26.360 - reactor.run() 26.361 - print 26.362 - 26.363 -if __name__ == "__main__": 26.364 - main(sys.argv) 26.365 -else: 26.366 - server = Xend()
27.1 --- a/tools/python/xen/xend/sv/__init__.py Thu Jul 22 16:41:11 2004 +0000 27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 27.3 @@ -1,1 +0,0 @@ 27.4 -
28.1 Binary file tools/python/xen/xend/sv/images/internet copy.jpg has changed
29.1 Binary file tools/python/xen/xend/sv/images/internet.jpg has changed
30.1 Binary file tools/python/xen/xend/sv/images/internet.psd has changed
31.1 Binary file tools/python/xen/xend/sv/images/left-end-highlight.jpg has changed
32.1 Binary file tools/python/xen/xend/sv/images/left-end-no-highlight.jpg has changed
33.1 Binary file tools/python/xen/xend/sv/images/middle-highlight.jpg has changed
34.1 Binary file tools/python/xen/xend/sv/images/middle-no-highlight.jpg has changed
35.1 Binary file tools/python/xen/xend/sv/images/orb_01.jpg has changed
36.1 Binary file tools/python/xen/xend/sv/images/orb_02.jpg has changed
37.1 Binary file tools/python/xen/xend/sv/images/right-end-highlight.jpg has changed
38.1 Binary file tools/python/xen/xend/sv/images/right-end-no-highlight.jpg has changed
39.1 Binary file tools/python/xen/xend/sv/images/seperator-left-highlight.jpg has changed
40.1 Binary file tools/python/xen/xend/sv/images/seperator-right-highlight.jpg has changed
41.1 Binary file tools/python/xen/xend/sv/images/seperator.jpg has changed
42.1 Binary file tools/python/xen/xend/sv/images/xen.png has changed
43.1 --- a/tools/python/xen/xend/sv/inc/style.css Thu Jul 22 16:41:11 2004 +0000 43.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 43.3 @@ -1,30 +0,0 @@ 43.4 - 43.5 -P {font-family: verdana, arial; font-size: 12px; color: black} 43.6 -.small {font-size: 10px} 43.7 - 43.8 -TD.domainInfo {font-family: verdana, arial; font-size: 10px; color: black} 43.9 -TD.domainInfoHead {font-family: verdana, arial; font-size: 10px; color: white; font-face: bold} 43.10 - 43.11 -TD.domainInfoHead {background-color: black} 43.12 -TR.domainInfoOdd {background-color: white} 43.13 -TR.domainInfoEven {background-color: lightgrey} 43.14 - 43.15 -body { 43.16 - width: 670px; 43.17 - margin: 0px; 43.18 - padding: 0px; 43.19 - background-color: #fff; 43.20 - background-image: url(../images/orb_02.jpg); 43.21 - background-repeat: repeat-y; 43.22 - background-position: left top; 43.23 - font-family: Arial, Helvetica, sans-serif; 43.24 - font-weight: bold; 43.25 - color: #333333; 43.26 - letter-spacing: 0px; 43.27 - scrollbar-base-color: #333333; 43.28 - scrollbar-track-color: #666666; 43.29 - scrollbar-face-color: #fff; 43.30 - 43.31 - 43.32 - } 43.33 - 43.34 \ No newline at end of file
44.1 --- a/tools/python/xen/xend/sv/util.py Thu Jul 22 16:41:11 2004 +0000 44.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 44.3 @@ -1,64 +0,0 @@ 44.4 -from xen.xend.sv.XendClientDeferred import server 44.5 -from xen.xend import sxp 44.6 - 44.7 -def getDomInfoHash( domain ): 44.8 - deferred = server.xend_domain( int( domain ) ) 44.9 - deferred.addCallback( procDomInfo, domain ) 44.10 - return deferred 44.11 - 44.12 -def procDomInfo( domInfo, domain ): 44.13 - d = {} 44.14 - d['dom'] = int( domain ) 44.15 - d['name'] = sxp.child_value( domInfo, 'name' ) 44.16 - d['mem'] = int( sxp.child_value( domInfo, 'memory' ) ) 44.17 - d['cpu'] = int( sxp.child_value( domInfo, 'cpu' ) ) 44.18 - d['state'] = sxp.child_value( domInfo, 'state' ) 44.19 - d['cpu_time'] = float( sxp.child_value( domInfo, 'cpu_time' ) ) 44.20 - if( sxp.child_value( domInfo, 'up_time' ) ): 44.21 - d['up_time'] = float( sxp.child_value( domInfo, 'up_time' ) ) 44.22 - if( sxp.child_value( domInfo, 'start_time' ) ): 44.23 - d['start_time'] = float( sxp.child_value( domInfo, 'start_time' ) ) 44.24 - return d 44.25 - 44.26 -def bigTimeFormatter( time ): 44.27 - weeks = time // 604800 44.28 - remainder = time % 604800 44.29 - days = remainder // 86400 44.30 - 44.31 - remainder = remainder % 86400 44.32 - 44.33 - hms = smallTimeFormatter( remainder ) 44.34 - 44.35 - return "%d weeks, %d days, %s" % ( weeks, days, hms ) 44.36 - 44.37 -def smallTimeFormatter( time ): 44.38 - hours = time // 3600 44.39 - remainder = time % 3600 44.40 - mins = remainder // 60 44.41 - secs = time % 60 44.42 - return "%02d:%02d:%04.1f (hh:mm:ss.s)" % ( hours, mins, secs ) 44.43 - 44.44 -def stateFormatter( state ): 44.45 - states = [ 'Running', 'Blocked', 'Paused', 'Shutdown', 'Crashed' ] 44.46 - 44.47 - for i in range( len( state ) ): 44.48 - if state[i] != "-": 44.49 - return states[ i ] + " (%s)" % state 44.50 - 44.51 - return state 44.52 - 44.53 -def memoryFormatter( mem ): 44.54 - return "%7dMb" % mem 44.55 - 44.56 -def cpuFormatter( mhz ): 44.57 - if mhz > 1000: 44.58 - ghz = float( mhz ) / 1000.0 44.59 - return "%4.2fGHz" % ghz 44.60 - else: 44.61 - return "%4dMHz" % mhz 44.62 - 44.63 -def hyperthreadFormatter( threads ): 44.64 - if int( threads ) > 1: 44.65 - return "Yes (%d)" % threads 44.66 - else: 44.67 - return "No" 44.68 \ No newline at end of file
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 45.2 +++ b/tools/sv/Main.rpy Fri Jul 23 10:25:12 2004 +0000 45.3 @@ -0,0 +1,3 @@ 45.4 +from xen.sv.Main import Main 45.5 + 45.6 +resource = Main()
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 46.2 +++ b/tools/sv/Makefile Fri Jul 23 10:25:12 2004 +0000 46.3 @@ -0,0 +1,39 @@ 46.4 +sv_insdir := $(prefix)/var/xen/sv 46.5 + 46.6 +all: 46.7 + 46.8 +install: 46.9 + # make parent directory 46.10 + mkdir -p $(sv_insdir) 46.11 + 46.12 + # copy Main.rpy file - references xen.sv.Main class 46.13 + install -m0644 Main.rpy $(sv_insdir) 46.14 + 46.15 + # make images folder 46.16 + mkdir -p $(sv_insdir)/images 46.17 + 46.18 + # copy images 46.19 + install -m0644 images/xen.png $(sv_insdir)/images 46.20 + install -m0644 images/orb_01.jpg $(sv_insdir)/images 46.21 + install -m0644 images/orb_02.jpg $(sv_insdir)/images 46.22 + 46.23 + install -m0644 images/left-end-highlight.jpg $(sv_insdir)/images 46.24 + install -m0644 images/left-end-no-highlight.jpg $(sv_insdir)/images 46.25 + install -m0644 images/right-end-highlight.jpg $(sv_insdir)/images 46.26 + install -m0644 images/right-end-no-highlight.jpg $(sv_insdir)/images 46.27 + 46.28 + install -m0644 images/middle-highlight.jpg $(sv_insdir)/images 46.29 + install -m0644 images/middle-no-highlight.jpg $(sv_insdir)/images 46.30 + 46.31 + install -m0644 images/seperator.jpg $(sv_insdir)/images 46.32 + install -m0644 images/seperator-left-highlight.jpg $(sv_insdir)/images 46.33 + install -m0644 images/seperator-right-highlight.jpg $(sv_insdir)/images 46.34 + 46.35 + # make include folder 46.36 + mkdir -p $(sv_insdir)/inc 46.37 + 46.38 + # copy stylesheet 46.39 + install -m0644 inc/style.css $(sv_insdir)/inc 46.40 + 46.41 +clean: 46.42 +
47.1 Binary file tools/sv/images/left-end-highlight.jpg has changed
48.1 Binary file tools/sv/images/left-end-no-highlight.jpg has changed
49.1 Binary file tools/sv/images/middle-highlight.jpg has changed
50.1 Binary file tools/sv/images/middle-no-highlight.jpg has changed
51.1 Binary file tools/sv/images/orb_01.jpg has changed
52.1 Binary file tools/sv/images/orb_02.jpg has changed
53.1 Binary file tools/sv/images/right-end-highlight.jpg has changed
54.1 Binary file tools/sv/images/right-end-no-highlight.jpg has changed
55.1 Binary file tools/sv/images/seperator-left-highlight.jpg has changed
56.1 Binary file tools/sv/images/seperator-right-highlight.jpg has changed
57.1 Binary file tools/sv/images/seperator.jpg has changed
58.1 Binary file tools/sv/images/xen.png has changed
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 59.2 +++ b/tools/sv/inc/style.css Fri Jul 23 10:25:12 2004 +0000 59.3 @@ -0,0 +1,30 @@ 59.4 + 59.5 +P {font-family: verdana, arial; font-size: 12px; color: black} 59.6 +.small {font-size: 10px} 59.7 + 59.8 +TD.domainInfo {font-family: verdana, arial; font-size: 10px; color: black} 59.9 +TD.domainInfoHead {font-family: verdana, arial; font-size: 10px; color: white; font-face: bold} 59.10 + 59.11 +TD.domainInfoHead {background-color: black} 59.12 +TR.domainInfoOdd {background-color: white} 59.13 +TR.domainInfoEven {background-color: lightgrey} 59.14 + 59.15 +body { 59.16 + width: 670px; 59.17 + margin: 0px; 59.18 + padding: 0px; 59.19 + background-color: #fff; 59.20 + background-image: url(../images/orb_02.jpg); 59.21 + background-repeat: repeat-y; 59.22 + background-position: left top; 59.23 + font-family: Arial, Helvetica, sans-serif; 59.24 + font-weight: bold; 59.25 + color: #333333; 59.26 + letter-spacing: 0px; 59.27 + scrollbar-base-color: #333333; 59.28 + scrollbar-track-color: #666666; 59.29 + scrollbar-face-color: #fff; 59.30 + 59.31 + 59.32 + } 59.33 + 59.34 \ No newline at end of file
60.1 --- a/tools/xfrd/Makefile Thu Jul 22 16:41:11 2004 +0000 60.2 +++ b/tools/xfrd/Makefile Fri Jul 23 10:25:12 2004 +0000 60.3 @@ -35,6 +35,8 @@ XFRD_PROG_OBJ += $(UTIL_LIB) 60.4 # Define to use stubs, undefine to use the real Xen functions. 60.5 #CPPFLAGS += -D _XEN_XFR_STUB_ 60.6 60.7 +CC := gcc 60.8 + 60.9 CFLAGS += -g 60.10 CFLAGS += -Wall 60.11 CFALGS += -Werror 60.12 @@ -67,7 +69,7 @@ XFRD_LIBS += $(CURL_LIBS) 60.13 all: xfrd 60.14 60.15 xfrd: $(XFRD_PROG_OBJ) 60.16 - $(CC) -o $@ $^ $(XFRD_LIBS) 60.17 + $(CC) -shared -o $@ $^ $(XFRD_LIBS) 60.18 60.19 .PHONY: install 60.20 install: xfrd
61.1 --- a/xen/arch/x86/memory.c Thu Jul 22 16:41:11 2004 +0000 61.2 +++ b/xen/arch/x86/memory.c Fri Jul 23 10:25:12 2004 +0000 61.3 @@ -164,9 +164,8 @@ static void __invalidate_shadow_ldt(stru 61.4 } 61.5 61.6 61.7 -static inline void invalidate_shadow_ldt(void) 61.8 +static inline void invalidate_shadow_ldt(struct domain *d) 61.9 { 61.10 - struct domain *d = current; 61.11 if ( d->mm.shadow_ldt_mapcnt != 0 ) 61.12 __invalidate_shadow_ldt(d); 61.13 } 61.14 @@ -387,7 +386,7 @@ static void put_page_from_l1e(l1_pgentry 61.15 if ( unlikely(((page->type_and_flags & PGT_type_mask) == 61.16 PGT_ldt_page)) && 61.17 unlikely(((page->type_and_flags & PGT_count_mask) != 0)) ) 61.18 - invalidate_shadow_ldt(); 61.19 + invalidate_shadow_ldt(page->u.domain); 61.20 put_page(page); 61.21 } 61.22 } 61.23 @@ -748,7 +747,7 @@ static int do_extended_command(unsigned 61.24 okay = get_page_and_type_from_pagenr(pfn, PGT_l2_page_table, d); 61.25 if ( likely(okay) ) 61.26 { 61.27 - invalidate_shadow_ldt(); 61.28 + invalidate_shadow_ldt(d); 61.29 61.30 percpu_info[cpu].deferred_ops &= ~DOP_FLUSH_TLB; 61.31 old_base_pfn = pagetable_val(d->mm.pagetable) >> PAGE_SHIFT; 61.32 @@ -795,7 +794,7 @@ static int do_extended_command(unsigned 61.33 else if ( (d->mm.ldt_ents != ents) || 61.34 (d->mm.ldt_base != ptr) ) 61.35 { 61.36 - invalidate_shadow_ldt(); 61.37 + invalidate_shadow_ldt(d); 61.38 d->mm.ldt_base = ptr; 61.39 d->mm.ldt_ents = ents; 61.40 load_LDT(d);
62.1 --- a/xen/common/memory.c Thu Jul 22 16:41:11 2004 +0000 62.2 +++ b/xen/common/memory.c Fri Jul 23 10:25:12 2004 +0000 62.3 @@ -80,15 +80,13 @@ void __init init_frametable(void *framet 62.4 62.5 void add_to_domain_alloc_list(unsigned long ps, unsigned long pe) 62.6 { 62.7 - struct pfn_info *pf; 62.8 unsigned long i; 62.9 unsigned long flags; 62.10 62.11 spin_lock_irqsave(&free_list_lock, flags); 62.12 for ( i = ps >> PAGE_SHIFT; i < (pe >> PAGE_SHIFT); i++ ) 62.13 { 62.14 - pf = list_entry(&frame_table[i].list, struct pfn_info, list); 62.15 - list_add_tail(&pf->list, &free_list); 62.16 + list_add_tail(&frame_table[i].list, &free_list); 62.17 free_pfns++; 62.18 } 62.19 spin_unlock_irqrestore(&free_list_lock, flags);
63.1 --- a/xen/common/sched_bvt.c Thu Jul 22 16:41:11 2004 +0000 63.2 +++ b/xen/common/sched_bvt.c Fri Jul 23 10:25:12 2004 +0000 63.3 @@ -25,6 +25,7 @@ 63.4 #include <xen/perfc.h> 63.5 #include <xen/sched-if.h> 63.6 #include <xen/slab.h> 63.7 +#include <xen/softirq.h> 63.8 63.9 /* all per-domain BVT-specific scheduling info is stored here */ 63.10 struct bvt_dom_info 63.11 @@ -145,24 +146,6 @@ void bvt_free_task(struct domain *p) 63.12 } 63.13 63.14 63.15 -void bvt_wake_up(struct domain *p) 63.16 -{ 63.17 - struct bvt_dom_info *inf = BVT_INFO(p); 63.18 - 63.19 - ASSERT(inf != NULL); 63.20 - 63.21 - 63.22 - /* set the BVT parameters */ 63.23 - if (inf->avt < CPU_SVT(p->processor)) 63.24 - inf->avt = CPU_SVT(p->processor); 63.25 - 63.26 - /* deal with warping here */ 63.27 - inf->warpback = 1; 63.28 - inf->warped = NOW(); 63.29 - __calc_evt(inf); 63.30 - __add_to_runqueue_head(p); 63.31 -} 63.32 - 63.33 /* 63.34 * Block the currently-executing domain until a pertinent event occurs. 63.35 */ 63.36 @@ -433,10 +416,47 @@ int bvt_init_scheduler() 63.37 return 0; 63.38 } 63.39 63.40 -static void bvt_pause(struct domain *p) 63.41 +static void bvt_sleep(struct domain *d) 63.42 +{ 63.43 + if ( test_bit(DF_RUNNING, &d->flags) ) 63.44 + cpu_raise_softirq(d->processor, SCHEDULE_SOFTIRQ); 63.45 + else if ( __task_on_runqueue(d) ) 63.46 + __del_from_runqueue(d); 63.47 +} 63.48 + 63.49 +void bvt_wake(struct domain *d) 63.50 { 63.51 - if( __task_on_runqueue(p) ) 63.52 - __del_from_runqueue(p); 63.53 + struct bvt_dom_info *inf = BVT_INFO(d); 63.54 + struct domain *curr; 63.55 + s_time_t now, min_time; 63.56 + int cpu = d->processor; 63.57 + 63.58 + /* If on the runqueue already then someone has done the wakeup work. */ 63.59 + if ( unlikely(__task_on_runqueue(d)) ) 63.60 + return; 63.61 + 63.62 + __add_to_runqueue_head(d); 63.63 + 63.64 + now = NOW(); 63.65 + 63.66 + /* Set the BVT parameters. */ 63.67 + if ( inf->avt < CPU_SVT(cpu) ) 63.68 + inf->avt = CPU_SVT(cpu); 63.69 + 63.70 + /* Deal with warping here. */ 63.71 + inf->warpback = 1; 63.72 + inf->warped = now; 63.73 + __calc_evt(inf); 63.74 + 63.75 + curr = schedule_data[cpu].curr; 63.76 + 63.77 + /* Currently-running domain should run at least for ctx_allow. */ 63.78 + min_time = curr->lastschd + curr->min_slice; 63.79 + 63.80 + if ( is_idle_task(curr) || (min_time <= now) ) 63.81 + cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ); 63.82 + else if ( schedule_data[cpu].s_timer.expires > (min_time + TIME_SLOP) ) 63.83 + mod_ac_timer(&schedule_data[cpu].s_timer, min_time); 63.84 } 63.85 63.86 struct scheduler sched_bvt_def = { 63.87 @@ -448,7 +468,6 @@ struct scheduler sched_bvt_def = { 63.88 .alloc_task = bvt_alloc_task, 63.89 .add_task = bvt_add_task, 63.90 .free_task = bvt_free_task, 63.91 - .wake_up = bvt_wake_up, 63.92 .do_block = bvt_do_block, 63.93 .do_schedule = bvt_do_schedule, 63.94 .control = bvt_ctl, 63.95 @@ -456,6 +475,7 @@ struct scheduler sched_bvt_def = { 63.96 .dump_settings = bvt_dump_settings, 63.97 .dump_cpu_state = bvt_dump_cpu_state, 63.98 .dump_runq_el = bvt_dump_runq_el, 63.99 - .pause = bvt_pause, 63.100 + .sleep = bvt_sleep, 63.101 + .wake = bvt_wake, 63.102 }; 63.103
64.1 --- a/xen/common/sched_fair_bvt.c Thu Jul 22 16:41:11 2004 +0000 64.2 +++ b/xen/common/sched_fair_bvt.c Fri Jul 23 10:25:12 2004 +0000 64.3 @@ -26,11 +26,12 @@ 64.4 #include <xen/perfc.h> 64.5 #include <xen/sched-if.h> 64.6 #include <xen/slab.h> 64.7 +#include <xen/softirq.h> 64.8 #include <xen/trace.h> 64.9 64.10 /* For tracing - TODO - put all the defines in some common hearder file */ 64.11 #define TRC_SCHED_FBVT_DO_SCHED 0x00020000 64.12 - 64.13 +#define TRC_SCHED_FBVT_DO_SCHED_UPDATE 0x00020001 64.14 64.15 /* all per-domain BVT-specific scheduling info is stored here */ 64.16 struct fbvt_dom_info 64.17 @@ -38,8 +39,7 @@ struct fbvt_dom_info 64.18 unsigned long mcu_advance; /* inverse of weight */ 64.19 u32 avt; /* actual virtual time */ 64.20 u32 evt; /* effective virtual time */ 64.21 - u32 time_slept; /* records amount of time slept, used for scheduling */ 64.22 - u32 vtb; /* virtual time bonus */ 64.23 + u32 time_slept; /* amount of time slept */ 64.24 int warpback; /* warp? */ 64.25 long warp; /* virtual time warp */ 64.26 long warpl; /* warp limit */ 64.27 @@ -50,18 +50,23 @@ struct fbvt_dom_info 64.28 64.29 struct fbvt_cpu_info 64.30 { 64.31 - unsigned long svt; /* XXX check this is unsigned long! */ 64.32 + unsigned long svt; /* XXX check this is unsigned long! */ 64.33 + u32 vtb; /* virtual time bonus */ 64.34 + u32 r_time; /* last time to run */ 64.35 }; 64.36 64.37 64.38 -#define FBVT_INFO(p) ((struct fbvt_dom_info *)(p)->sched_priv) 64.39 +#define FBVT_INFO(p) ((struct fbvt_dom_info *)(p)->sched_priv) 64.40 #define CPU_INFO(cpu) ((struct fbvt_cpu_info *)(schedule_data[cpu]).sched_priv) 64.41 #define CPU_SVT(cpu) (CPU_INFO(cpu)->svt) 64.42 +#define LAST_VTB(cpu) (CPU_INFO(cpu)->vtb) 64.43 +#define R_TIME(cpu) (CPU_INFO(cpu)->r_time) 64.44 64.45 #define MCU (s32)MICROSECS(100) /* Minimum unit */ 64.46 #define MCU_ADVANCE 10 /* default weight */ 64.47 #define TIME_SLOP (s32)MICROSECS(50) /* allow time to slip a bit */ 64.48 static s32 ctx_allow = (s32)MILLISECS(5); /* context switch allowance */ 64.49 +static s32 max_vtb = (s32)MILLISECS(5); 64.50 64.51 /* SLAB cache for struct fbvt_dom_info objects */ 64.52 static kmem_cache_t *dom_info_cache; 64.53 @@ -132,8 +137,7 @@ void fbvt_add_task(struct domain *p) 64.54 inf->avt = CPU_SVT(p->processor); 64.55 inf->evt = CPU_SVT(p->processor); 64.56 /* Set some default values here. */ 64.57 - inf->vtb = 0; 64.58 - inf->time_slept = 0; 64.59 + inf->time_slept = 0; 64.60 inf->warpback = 0; 64.61 inf->warp = 0; 64.62 inf->warpl = 0; 64.63 @@ -153,43 +157,6 @@ void fbvt_free_task(struct domain *p) 64.64 kmem_cache_free( dom_info_cache, p->sched_priv ); 64.65 } 64.66 64.67 - 64.68 -void fbvt_wake_up(struct domain *p) 64.69 -{ 64.70 - struct fbvt_dom_info *inf = FBVT_INFO(p); 64.71 - s32 io_warp; 64.72 - 64.73 - ASSERT(inf != NULL); 64.74 - 64.75 - 64.76 - /* set the BVT parameters */ 64.77 - if (inf->avt < CPU_SVT(p->processor)) 64.78 - { 64.79 - /* 64.80 - *We want IO bound processes to gain 64.81 - *dispatch precedence. It is especially for 64.82 - *device driver domains. Therefore AVT should not be updated 64.83 - *to SVT but to a value marginally smaller. 64.84 - *Since frequently sleeping domains have high time_slept 64.85 - *values, the virtual time can be determined as: 64.86 - *SVT - const * TIME_SLEPT 64.87 - */ 64.88 - 64.89 - io_warp = (int)(0.5 * inf->time_slept); 64.90 - if(io_warp > 1000) io_warp = 1000; 64.91 - 64.92 - ASSERT(inf->time_slept + CPU_SVT(p->processor) > inf->avt + io_warp); 64.93 - inf->time_slept += CPU_SVT(p->processor) - inf->avt - io_warp; 64.94 - inf->avt = CPU_SVT(p->processor) - io_warp; 64.95 - } 64.96 - 64.97 - /* deal with warping here */ 64.98 - inf->warpback = 1; 64.99 - inf->warped = NOW(); 64.100 - __calc_evt(inf); 64.101 - __add_to_runqueue_head(p); 64.102 -} 64.103 - 64.104 /* 64.105 * Block the currently-executing domain until a pertinent event occurs. 64.106 */ 64.107 @@ -206,6 +173,8 @@ int fbvt_ctl(struct sched_ctl_cmd *cmd) 64.108 if ( cmd->direction == SCHED_INFO_PUT ) 64.109 { 64.110 ctx_allow = params->ctx_allow; 64.111 + /* The max_vtb should be of the order o the ctx_allow */ 64.112 + max_vtb = ctx_allow; 64.113 } 64.114 else 64.115 { 64.116 @@ -217,7 +186,7 @@ int fbvt_ctl(struct sched_ctl_cmd *cmd) 64.117 64.118 /* Adjust scheduling parameter for a given domain. */ 64.119 int fbvt_adjdom(struct domain *p, 64.120 - struct sched_adjdom_cmd *cmd) 64.121 + struct sched_adjdom_cmd *cmd) 64.122 { 64.123 struct fbvt_adjdom *params = &cmd->u.fbvt; 64.124 unsigned long flags; 64.125 @@ -285,10 +254,11 @@ static task_slice_t fbvt_do_schedule(s_t 64.126 s32 ranfor; /* assume we never run longer than 2.1s! */ 64.127 s32 mcus; 64.128 u32 next_evt, next_prime_evt, min_avt; 64.129 - struct fbvt_dom_info *prev_inf = FBVT_INFO(prev), 64.130 - *p_inf = NULL, 64.131 - *next_inf = NULL, 64.132 - *next_prime_inf = NULL; 64.133 + u32 sl_decrement; 64.134 + struct fbvt_dom_info *prev_inf = FBVT_INFO(prev); 64.135 + struct fbvt_dom_info *p_inf = NULL; 64.136 + struct fbvt_dom_info *next_inf = NULL; 64.137 + struct fbvt_dom_info *next_prime_inf = NULL; 64.138 task_slice_t ret; 64.139 64.140 ASSERT(prev->sched_priv != NULL); 64.141 @@ -299,18 +269,26 @@ static task_slice_t fbvt_do_schedule(s_t 64.142 ranfor = (s32)(now - prev->lastschd); 64.143 /* Calculate mcu and update avt. */ 64.144 mcus = (ranfor + MCU - 1) / MCU; 64.145 - if(mcus * prev_inf->mcu_advance < prev_inf->vtb) 64.146 - { 64.147 - ASSERT(prev_inf->time_slept >= mcus * prev_inf->mcu_advance); 64.148 - prev_inf->time_slept -= mcus * prev_inf->mcu_advance; 64.149 - } 64.150 - else 64.151 - { 64.152 - prev_inf->avt += mcus * prev_inf->mcu_advance - prev_inf->vtb; 64.153 - 64.154 - ASSERT(prev_inf->time_slept >= prev_inf->vtb); 64.155 - prev_inf->time_slept -= prev_inf->vtb; 64.156 - } 64.157 + 64.158 + TRACE_3D(TRC_SCHED_FBVT_DO_SCHED_UPDATE, prev->domain, 64.159 + mcus, LAST_VTB(cpu)); 64.160 + 64.161 + sl_decrement = mcus * LAST_VTB(cpu) / R_TIME(cpu); 64.162 + prev_inf->time_slept -= sl_decrement; 64.163 + prev_inf->avt += mcus * prev_inf->mcu_advance - sl_decrement; 64.164 + 64.165 + /*if(mcus * prev_inf->mcu_advance < LAST_VTB(cpu)) 64.166 + { 64.167 + ASSERT(prev_inf->time_slept >= mcus * prev_inf->mcu_advance); 64.168 + prev_inf->time_slept -= mcus * prev_inf->mcu_advance; 64.169 + } 64.170 + else 64.171 + { 64.172 + prev_inf->avt += mcus * prev_inf->mcu_advance - LAST_VTB(cpu); 64.173 + 64.174 + ASSERT(prev_inf->time_slept >= LAST_VTB(cpu)); 64.175 + prev_inf->time_slept -= LAST_VTB(cpu); 64.176 + }*/ 64.177 64.178 __calc_evt(prev_inf); 64.179 64.180 @@ -399,7 +377,7 @@ static task_slice_t fbvt_do_schedule(s_t 64.181 } 64.182 64.183 64.184 - /* 64.185 + /* 64.186 * In here we decide on Virtual Time Bonus. The idea is, for the 64.187 * domains that have large time_slept values to be allowed to run 64.188 * for longer. Thus regaining the share of CPU originally allocated. 64.189 @@ -407,8 +385,9 @@ static task_slice_t fbvt_do_schedule(s_t 64.190 * domains earlier in virtual time). Together this should give quite 64.191 * good control both for CPU and IO-bound domains. 64.192 */ 64.193 - next_inf->vtb = (int)(0.2 * next_inf->time_slept); 64.194 - if(next_inf->vtb > 1000) next_inf->vtb = 1000; 64.195 + LAST_VTB(cpu) = (int)(0.2 * next_inf->time_slept); 64.196 + if(LAST_VTB(cpu) / next_inf->mcu_advance > max_vtb / MCU) 64.197 + LAST_VTB(cpu) = max_vtb * next_inf->mcu_advance / MCU; 64.198 64.199 64.200 /* work out time for next run through scheduler */ 64.201 @@ -431,15 +410,17 @@ static task_slice_t fbvt_do_schedule(s_t 64.202 * 'next_prime's evt. Take context switch allowance into account. 64.203 */ 64.204 ASSERT(next_prime_inf->evt >= next_inf->evt); 64.205 - 64.206 - r_time = ((next_prime_inf->evt + next_inf->vtb - next_inf->evt)/next_inf->mcu_advance) 64.207 + 64.208 + ASSERT(LAST_VTB(cpu) >= 0); 64.209 + 64.210 + r_time = MCU * ((next_prime_inf->evt + LAST_VTB(cpu) - next_inf->evt)/next_inf->mcu_advance) 64.211 + ctx_allow; 64.212 - 64.213 + 64.214 ASSERT(r_time >= ctx_allow); 64.215 64.216 sched_done: 64.217 - 64.218 - TRACE_2D(TRC_SCHED_FBVT_DO_SCHED, next->domain, r_time); 64.219 + R_TIME(cpu) = r_time / MCU; 64.220 + TRACE_3D(TRC_SCHED_FBVT_DO_SCHED, next->domain, r_time, LAST_VTB(cpu)); 64.221 next->min_slice = ctx_allow; 64.222 ret.task = next; 64.223 ret.time = r_time; 64.224 @@ -452,8 +433,8 @@ static void fbvt_dump_runq_el(struct dom 64.225 { 64.226 struct fbvt_dom_info *inf = FBVT_INFO(p); 64.227 64.228 - printk("mcua=0x%04lX ev=0x%08X av=0x%08X sl=0x%08X vtb=0x%08X ", 64.229 - inf->mcu_advance, inf->evt, inf->avt, inf->time_slept, inf->vtb); 64.230 + printk("mcua=%04lu ev=%08u av=%08u sl=%08u", 64.231 + inf->mcu_advance, inf->evt, inf->avt, inf->time_slept); 64.232 } 64.233 64.234 static void fbvt_dump_settings(void) 64.235 @@ -497,30 +478,85 @@ int fbvt_init_scheduler() 64.236 return 0; 64.237 } 64.238 64.239 -static void fbvt_pause(struct domain *p) 64.240 +static void fbvt_sleep(struct domain *d) 64.241 { 64.242 - if( __task_on_runqueue(p) ) 64.243 - { 64.244 - __del_from_runqueue(p); 64.245 - } 64.246 + if ( test_bit(DF_RUNNING, &d->flags) ) 64.247 + cpu_raise_softirq(d->processor, SCHEDULE_SOFTIRQ); 64.248 + else if ( __task_on_runqueue(d) ) 64.249 + __del_from_runqueue(d); 64.250 } 64.251 64.252 -static void fbvt_unpause(struct domain *p) 64.253 +static void fbvt_wake(struct domain *d) 64.254 { 64.255 - struct fbvt_dom_info *inf = FBVT_INFO(p); 64.256 + struct fbvt_dom_info *inf = FBVT_INFO(d); 64.257 + struct domain *curr; 64.258 + s_time_t now, min_time; 64.259 + int cpu = d->processor; 64.260 + s32 io_warp; 64.261 + 64.262 + /* If on the runqueue already then someone has done the wakeup work. */ 64.263 + if ( unlikely(__task_on_runqueue(d)) ) 64.264 + return; 64.265 64.266 - if ( p->domain == IDLE_DOMAIN_ID ) 64.267 + __add_to_runqueue_head(d); 64.268 + 64.269 + now = NOW(); 64.270 + 64.271 +#if 0 64.272 + /* 64.273 + * XXX KAF: This was fbvt_unpause(). Not sure if it's the right thing 64.274 + * to do, in light of the stuff that fbvt_wake_up() does. 64.275 + * e.g., setting 'inf->avt = CPU_SVT(cpu);' would make the later test 64.276 + * 'inf->avt < CPU_SVT(cpu)' redundant! 64.277 + */ 64.278 + if ( d->domain == IDLE_DOMAIN_ID ) 64.279 { 64.280 inf->avt = inf->evt = ~0U; 64.281 } 64.282 else 64.283 { 64.284 /* Set avt to system virtual time. */ 64.285 - inf->avt = CPU_SVT(p->processor); 64.286 + inf->avt = CPU_SVT(cpu); 64.287 /* Set some default values here. */ 64.288 - inf->vtb = 0; 64.289 - __calc_evt(inf); 64.290 + LAST_VTB(cpu) = 0; 64.291 + __calc_evt(inf); 64.292 } 64.293 +#endif 64.294 + 64.295 + /* Set the BVT parameters. */ 64.296 + if ( inf->avt < CPU_SVT(cpu) ) 64.297 + { 64.298 + /* 64.299 + * We want IO bound processes to gain dispatch precedence. It is 64.300 + * especially for device driver domains. Therefore AVT 64.301 + * not be updated to SVT but to a value marginally smaller. 64.302 + * Since frequently sleeping domains have high time_slept 64.303 + * values, the virtual time can be determined as: 64.304 + * SVT - const * TIME_SLEPT 64.305 + */ 64.306 + io_warp = (int)(0.5 * inf->time_slept); 64.307 + if ( io_warp > 1000 ) 64.308 + io_warp = 1000; 64.309 + 64.310 + ASSERT(inf->time_slept + CPU_SVT(cpu) > inf->avt + io_warp); 64.311 + inf->time_slept += CPU_SVT(cpu) - inf->avt - io_warp; 64.312 + inf->avt = CPU_SVT(cpu) - io_warp; 64.313 + } 64.314 + 64.315 + /* Deal with warping here. */ 64.316 + inf->warpback = 1; 64.317 + inf->warped = now; 64.318 + __calc_evt(inf); 64.319 + 64.320 + curr = schedule_data[cpu].curr; 64.321 + 64.322 + /* Currently-running domain should run at least for ctx_allow. */ 64.323 + min_time = curr->lastschd + curr->min_slice; 64.324 + 64.325 + if ( is_idle_task(curr) || (min_time <= now) ) 64.326 + cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ); 64.327 + else if ( schedule_data[cpu].s_timer.expires > (min_time + TIME_SLOP) ) 64.328 + mod_ac_timer(&schedule_data[cpu].s_timer, min_time); 64.329 } 64.330 64.331 struct scheduler sched_fbvt_def = { 64.332 @@ -532,7 +568,6 @@ struct scheduler sched_fbvt_def = { 64.333 .alloc_task = fbvt_alloc_task, 64.334 .add_task = fbvt_add_task, 64.335 .free_task = fbvt_free_task, 64.336 - .wake_up = fbvt_wake_up, 64.337 .do_block = fbvt_do_block, 64.338 .do_schedule = fbvt_do_schedule, 64.339 .control = fbvt_ctl, 64.340 @@ -540,7 +575,7 @@ struct scheduler sched_fbvt_def = { 64.341 .dump_settings = fbvt_dump_settings, 64.342 .dump_cpu_state = fbvt_dump_cpu_state, 64.343 .dump_runq_el = fbvt_dump_runq_el, 64.344 - .pause = fbvt_pause, 64.345 - .unpause = fbvt_unpause, 64.346 + .sleep = fbvt_sleep, 64.347 + .wake = fbvt_wake, 64.348 }; 64.349
65.1 --- a/xen/common/sched_rrobin.c Thu Jul 22 16:41:11 2004 +0000 65.2 +++ b/xen/common/sched_rrobin.c Fri Jul 23 10:25:12 2004 +0000 65.3 @@ -8,8 +8,11 @@ 65.4 #include <xen/sched-if.h> 65.5 #include <hypervisor-ifs/sched_ctl.h> 65.6 #include <xen/ac_timer.h> 65.7 +#include <xen/softirq.h> 65.8 #include <xen/time.h> 65.9 65.10 +#define TIME_SLOP (s32)MICROSECS(50) /* allow time to slip a bit */ 65.11 + 65.12 static s_time_t rr_slice = MILLISECS(10); 65.13 65.14 static task_slice_t rr_do_schedule(s_time_t now) 65.15 @@ -33,7 +36,7 @@ static task_slice_t rr_do_schedule(s_tim 65.16 65.17 static int rr_ctl(struct sched_ctl_cmd *cmd) 65.18 { 65.19 - if(cmd->direction == SCHED_INFO_PUT) 65.20 + if ( cmd->direction == SCHED_INFO_PUT ) 65.21 { 65.22 rr_slice = cmd->u.rrobin.slice; 65.23 } 65.24 @@ -50,10 +53,37 @@ static void rr_dump_settings() 65.25 printk("rr_slice = %llu ", rr_slice); 65.26 } 65.27 65.28 -static void rr_pause(struct domain *p) 65.29 +static void rr_sleep(struct domain *d) 65.30 +{ 65.31 + if ( test_bit(DF_RUNNING, &d->flags) ) 65.32 + cpu_raise_softirq(d->processor, SCHEDULE_SOFTIRQ); 65.33 + else if ( __task_on_runqueue(d) ) 65.34 + __del_from_runqueue(d); 65.35 +} 65.36 + 65.37 +void rr_wake(struct domain *d) 65.38 { 65.39 - if ( __task_on_runqueue(p) ) 65.40 - __del_from_runqueue(p); 65.41 + struct domain *curr; 65.42 + s_time_t now, min_time; 65.43 + int cpu = d->processor; 65.44 + 65.45 + /* If on the runqueue already then someone has done the wakeup work. */ 65.46 + if ( unlikely(__task_on_runqueue(d)) ) 65.47 + return; 65.48 + 65.49 + __add_to_runqueue_head(d); 65.50 + 65.51 + now = NOW(); 65.52 + 65.53 + curr = schedule_data[cpu].curr; 65.54 + 65.55 + /* Currently-running domain should run at least for ctx_allow. */ 65.56 + min_time = curr->lastschd + curr->min_slice; 65.57 + 65.58 + if ( is_idle_task(curr) || (min_time <= now) ) 65.59 + cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ); 65.60 + else if ( schedule_data[cpu].s_timer.expires > (min_time + TIME_SLOP) ) 65.61 + mod_ac_timer(&schedule_data[cpu].s_timer, min_time); 65.62 } 65.63 65.64 struct scheduler sched_rrobin_def = { 65.65 @@ -61,11 +91,11 @@ struct scheduler sched_rrobin_def = { 65.66 .opt_name = "rrobin", 65.67 .sched_id = SCHED_RROBIN, 65.68 65.69 - .wake_up = __add_to_runqueue_head, 65.70 .do_schedule = rr_do_schedule, 65.71 .control = rr_ctl, 65.72 .dump_settings = rr_dump_settings, 65.73 - .pause = rr_pause, 65.74 + .sleep = rr_sleep, 65.75 + .wake = rr_wake, 65.76 }; 65.77 65.78
66.1 --- a/xen/common/schedule.c Thu Jul 22 16:41:11 2004 +0000 66.2 +++ b/xen/common/schedule.c Fri Jul 23 10:25:12 2004 +0000 66.3 @@ -73,7 +73,7 @@ schedule_data_t schedule_data[NR_CPUS]; 66.4 */ 66.5 extern struct scheduler sched_bvt_def, sched_fbvt_def, sched_rrobin_def, sched_atropos_def; 66.6 static struct scheduler *schedulers[] = { &sched_bvt_def, 66.7 - &sched_fbvt_def, 66.8 + &sched_fbvt_def, 66.9 &sched_rrobin_def, 66.10 &sched_atropos_def, 66.11 NULL}; 66.12 @@ -178,12 +178,7 @@ void domain_sleep(struct domain *d) 66.13 66.14 spin_lock_irqsave(&schedule_lock[cpu], flags); 66.15 if ( likely(!domain_runnable(d)) ) 66.16 - { 66.17 - if ( test_bit(DF_RUNNING, &d->flags) ) 66.18 - cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ); 66.19 - else if ( __task_on_runqueue(d) ) 66.20 - __del_from_runqueue(d); 66.21 - } 66.22 + SCHED_OP(sleep, d); 66.23 spin_unlock_irqrestore(&schedule_lock[cpu], flags); 66.24 66.25 /* Synchronous. */ 66.26 @@ -198,53 +193,19 @@ void domain_wake(struct domain *d) 66.27 { 66.28 unsigned long flags; 66.29 int cpu = d->processor; 66.30 - struct domain *curr; 66.31 - s_time_t now, min_time; 66.32 66.33 spin_lock_irqsave(&schedule_lock[cpu], flags); 66.34 - 66.35 - if ( likely(domain_runnable(d)) && likely(!__task_on_runqueue(d)) ) 66.36 + if ( likely(domain_runnable(d)) ) 66.37 { 66.38 - TRACE_2D(TRC_SCHED_WAKE,d->domain, d); 66.39 - SCHED_OP(wake_up, d); 66.40 + TRACE_2D(TRC_SCHED_WAKE, d->domain, d); 66.41 + SCHED_OP(wake, d); 66.42 #ifdef WAKE_HISTO 66.43 - p->wokenup = NOW(); 66.44 + d->wokenup = NOW(); 66.45 #endif 66.46 - 66.47 - now = NOW(); 66.48 - curr = schedule_data[cpu].curr; 66.49 - 66.50 - /* Currently-running domain should run at least for ctx_allow. */ 66.51 - min_time = curr->lastschd + curr->min_slice; 66.52 - 66.53 - if ( is_idle_task(curr) || (min_time <= now) ) 66.54 - cpu_raise_softirq(cpu, SCHEDULE_SOFTIRQ); 66.55 - else if ( schedule_data[cpu].s_timer.expires > (min_time + TIME_SLOP) ) 66.56 - mod_ac_timer(&schedule_data[cpu].s_timer, min_time); 66.57 } 66.58 - 66.59 spin_unlock_irqrestore(&schedule_lock[cpu], flags); 66.60 } 66.61 66.62 -/* 66.63 - * Pausing a domain. 66.64 - */ 66.65 -void pause_domain(struct domain *domain) 66.66 -{ 66.67 - domain_sleep(domain); 66.68 - SCHED_OP(pause, domain); 66.69 -} 66.70 - 66.71 - 66.72 -/* 66.73 - * Unpauseing a domain 66.74 - */ 66.75 -void unpause_domain(struct domain *domain) 66.76 -{ 66.77 - SCHED_OP(unpause, domain); 66.78 - domain_wake(domain); 66.79 -} 66.80 - 66.81 /* Block the currently-executing domain until a pertinent event occurs. */ 66.82 long do_block(void) 66.83 {
67.1 --- a/xen/include/xen/sched-if.h Thu Jul 22 16:41:11 2004 +0000 67.2 +++ b/xen/include/xen/sched-if.h Fri Jul 23 10:25:12 2004 +0000 67.3 @@ -39,7 +39,8 @@ struct scheduler 67.4 void (*add_task) (struct domain *); 67.5 void (*free_task) (struct domain *); 67.6 void (*rem_task) (struct domain *); 67.7 - void (*wake_up) (struct domain *); 67.8 + void (*sleep) (struct domain *); 67.9 + void (*wake) (struct domain *); 67.10 void (*do_block) (struct domain *); 67.11 task_slice_t (*do_schedule) (s_time_t); 67.12 int (*control) (struct sched_ctl_cmd *); 67.13 @@ -49,8 +50,6 @@ struct scheduler 67.14 void (*dump_cpu_state) (int); 67.15 void (*dump_runq_el) (struct domain *); 67.16 int (*prn_state) (int); 67.17 - void (*pause) (struct domain *); 67.18 - void (*unpause) (struct domain *); 67.19 }; 67.20 67.21 /* per CPU scheduler information */
68.1 --- a/xen/include/xen/sched.h Thu Jul 22 16:41:11 2004 +0000 68.2 +++ b/xen/include/xen/sched.h Fri Jul 23 10:25:12 2004 +0000 68.3 @@ -210,8 +210,6 @@ int sched_id(); 68.4 void init_idle_task(void); 68.5 void domain_wake(struct domain *d); 68.6 void domain_sleep(struct domain *d); 68.7 -void pause_domain(struct domain *d); 68.8 -void unpause_domain(struct domain *d); 68.9 68.10 void __enter_scheduler(void); 68.11 68.12 @@ -262,14 +260,14 @@ static inline void domain_pause(struct d 68.13 { 68.14 ASSERT(d != current); 68.15 atomic_inc(&d->pausecnt); 68.16 - pause_domain(d); 68.17 + domain_sleep(d); 68.18 } 68.19 68.20 static inline void domain_unpause(struct domain *d) 68.21 { 68.22 ASSERT(d != current); 68.23 if ( atomic_dec_and_test(&d->pausecnt) ) 68.24 - unpause_domain(d); 68.25 + domain_wake(d); 68.26 } 68.27 68.28 static inline void domain_unblock(struct domain *d) 68.29 @@ -282,13 +280,13 @@ static inline void domain_pause_by_syste 68.30 { 68.31 ASSERT(d != current); 68.32 if ( !test_and_set_bit(DF_CTRLPAUSE, &d->flags) ) 68.33 - pause_domain(d); 68.34 + domain_sleep(d); 68.35 } 68.36 68.37 static inline void domain_unpause_by_systemcontroller(struct domain *d) 68.38 { 68.39 if ( test_and_clear_bit(DF_CTRLPAUSE, &d->flags) ) 68.40 - unpause_domain(d); 68.41 + domain_wake(d); 68.42 } 68.43 68.44