[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] merge?
# HG changeset patch # User cl349@xxxxxxxxxxxxxxxxxxxx # Node ID 6721abf6b16d6df6549f2f5b0a76468c10a71bee # Parent 2d4daffd8a4a0fa3e3b47552b387f6a3755b960a # Parent 0f69e0adddb040fabea6fa13efa126cea49de35c merge? diff -r 2d4daffd8a4a -r 6721abf6b16d Makefile --- a/Makefile Sun Aug 21 11:40:39 2005 +++ b/Makefile Sun Aug 21 11:41:45 2005 @@ -172,6 +172,12 @@ rm -rf $(D)/usr/bin/xen* $(D)/usr/bin/miniterm rm -rf $(D)/boot/*xen* rm -rf $(D)/lib/modules/*xen* + rm -rf $(D)/usr/bin/cpuperf-perfcntr $(D)/usr/bin/cpuperf-xen + rm -rf $(D)/usr/bin/xc_shadow + rm -rf $(D)/usr/share/xen $(D)/usr/libexec/xen + rm -rf $(D)/usr/share/man/man1/xen* + rm -rf $(D)/usr/share/man/man8/xen* + rm -rf $(D)/usr/lib/xen # Legacy targets for compatibility linux24: diff -r 2d4daffd8a4a -r 6721abf6b16d extras/mini-os/include/time.h --- a/extras/mini-os/include/time.h Sun Aug 21 11:40:39 2005 +++ b/extras/mini-os/include/time.h Sun Aug 21 11:41:45 2005 @@ -28,7 +28,7 @@ * of real time into system time */ typedef s64 s_time_t; -#define NOW() ((s_time_t)get_s_time()) +#define NOW() ((s_time_t)monotonic_clock()) #define SECONDS(_s) (((s_time_t)(_s)) * 1000000000UL ) #define TENTHS(_ts) (((s_time_t)(_ts)) * 100000000UL ) #define HUNDREDTHS(_hs) (((s_time_t)(_hs)) * 10000000UL ) @@ -36,7 +36,8 @@ #define MICROSECS(_us) (((s_time_t)(_us)) * 1000UL ) #define Time_Max ((s_time_t) 0x7fffffffffffffffLL) #define FOREVER Time_Max - +#define NSEC_TO_USEC(_nsec) (_nsec / 1000UL) +#define NSEC_TO_SEC(_nsec) (_nsec / 1000000000ULL) /* wall clock time */ typedef long time_t; @@ -44,6 +45,11 @@ struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* microseconds */ +}; + +struct timespec { + time_t ts_sec; + long ts_nsec; }; diff -r 2d4daffd8a4a -r 6721abf6b16d extras/mini-os/kernel.c --- a/extras/mini-os/kernel.c Sun Aug 21 11:40:39 2005 +++ b/extras/mini-os/kernel.c Sun Aug 21 11:41:45 2005 @@ -132,20 +132,6 @@ i = 0; for ( ; ; ) { - if(i >= 1000) - { - { - unsigned long saved; - __asm__ ("movl %%esp, %0" - :"=r"(saved) /* y is output operand */ - /* x is input operand */); -// :"a"); /* %eax is clobbered register */ - printk("ESP=0x%lx\n", saved); - } - - printk("1000 bloks\n"); - i=0; - } // HYPERVISOR_yield(); block(1); i++; diff -r 2d4daffd8a4a -r 6721abf6b16d extras/mini-os/time.c --- a/extras/mini-os/time.c Sun Aug 21 11:40:39 2005 +++ b/extras/mini-os/time.c Sun Aug 21 11:41:45 2005 @@ -43,19 +43,20 @@ * Time functions *************************************************************************/ -/* Cached *multiplier* to convert TSC counts to microseconds. - * (see the equation below). - * Equal to 2^32 * (1 / (clocks per usec) ). - * Initialized in time_init. - */ -static unsigned long fast_gettimeoffset_quotient; - - /* These are peridically updated in shared_info, and then copied here. */ -static u32 shadow_tsc_stamp; -static s64 shadow_system_time; -static u32 shadow_time_version; -static struct timeval shadow_tv; +struct shadow_time_info { + u64 tsc_timestamp; /* TSC at last update of time vals. */ + u64 system_timestamp; /* Time, in nanosecs, since boot. */ + u32 tsc_to_nsec_mul; + u32 tsc_to_usec_mul; + int tsc_shift; + u32 version; +}; +static struct timespec shadow_ts; +static u32 shadow_ts_version; + +static struct shadow_time_info shadow; + #ifndef rmb #define rmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") @@ -63,116 +64,150 @@ #define HANDLE_USEC_OVERFLOW(_tv) \ do { \ - while ( (_tv).tv_usec >= 1000000 ) \ + while ( (_tv)->tv_usec >= 1000000 ) \ { \ - (_tv).tv_usec -= 1000000; \ - (_tv).tv_sec++; \ + (_tv)->tv_usec -= 1000000; \ + (_tv)->tv_sec++; \ } \ } while ( 0 ) +static inline int time_values_up_to_date(void) +{ + struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_time[0]; + + return (shadow.version == src->version); +} + + +/* + * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, + * yielding a 64-bit result. + */ +static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift) +{ + u64 product; +#ifdef __i386__ + u32 tmp1, tmp2; +#endif + + if ( shift < 0 ) + delta >>= -shift; + else + delta <<= shift; + +#ifdef __i386__ + __asm__ ( + "mul %5 ; " + "mov %4,%%eax ; " + "mov %%edx,%4 ; " + "mul %5 ; " + "add %4,%%eax ; " + "xor %5,%5 ; " + "adc %5,%%edx ; " + : "=A" (product), "=r" (tmp1), "=r" (tmp2) + : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) ); +#else + __asm__ ( + "mul %%rdx ; shrd $32,%%rdx,%%rax" + : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) ); +#endif + + return product; +} + + +static unsigned long get_nsec_offset(void) +{ + u64 now, delta; + rdtscll(now); + delta = now - shadow.tsc_timestamp; + return scale_delta(delta, shadow.tsc_to_nsec_mul, shadow.tsc_shift); +} + + static void get_time_values_from_xen(void) { - do { - shadow_time_version = HYPERVISOR_shared_info->time_version2; - rmb(); - shadow_tv.tv_sec = HYPERVISOR_shared_info->wc_sec; - shadow_tv.tv_usec = HYPERVISOR_shared_info->wc_usec; - shadow_tsc_stamp = (u32)HYPERVISOR_shared_info->tsc_timestamp; - shadow_system_time = HYPERVISOR_shared_info->system_time; - rmb(); - } - while ( shadow_time_version != HYPERVISOR_shared_info->time_version1 ); -} - - -#define TIME_VALUES_UP_TO_DATE \ - (shadow_time_version == HYPERVISOR_shared_info->time_version2) - -static u32 get_time_delta_usecs(void) -{ - register unsigned long eax, edx; - - /* Read the Time Stamp Counter */ - - rdtsc(eax,edx); - - /* .. relative to previous jiffy (32 bits is enough) */ - eax -= shadow_tsc_stamp; - - /* - * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient - * = (tsc_low delta) * (usecs_per_clock) - * = (tsc_low delta) * (usecs_per_jiffy / clocks_per_jiffy) - * - * Using a mull instead of a divl saves up to 31 clock cycles - * in the critical path. - */ - - __asm__("mull %2" - :"=a" (eax), "=d" (edx) - :"rm" (fast_gettimeoffset_quotient), - "0" (eax)); - - /* our adjusted time offset in microseconds */ - return edx; -} - -s64 get_s_time (void) -{ - u64 u_delta; - s64 ret; - - again: - - u_delta = get_time_delta_usecs(); - ret = shadow_system_time + (1000 * u_delta); - - if ( unlikely(!TIME_VALUES_UP_TO_DATE) ) - { - /* - * We may have blocked for a long time, rendering our calculations - * invalid (e.g. the time delta may have overflowed). Detect that - * and recalculate with fresh values. - */ - get_time_values_from_xen(); - goto again; - } - - return ret; -} + struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_time[0]; + + do { + shadow.version = src->version; + rmb(); + shadow.tsc_timestamp = src->tsc_timestamp; + shadow.system_timestamp = src->system_time; + shadow.tsc_to_nsec_mul = src->tsc_to_system_mul; + shadow.tsc_shift = src->tsc_shift; + rmb(); + } + while ((src->version & 1) | (shadow.version ^ src->version)); + + shadow.tsc_to_usec_mul = shadow.tsc_to_nsec_mul / 1000; +} + + + + +/* monotonic_clock(): returns # of nanoseconds passed since time_init() + * Note: This function is required to return accurate + * time even in the absence of multiple timer ticks. + */ +u64 monotonic_clock(void) +{ + u64 time; + u32 local_time_version; + + do { + local_time_version = shadow.version; + rmb(); + time = shadow.system_timestamp + get_nsec_offset(); + if (!time_values_up_to_date()) + get_time_values_from_xen(); + rmb(); + } while (local_time_version != shadow.version); + + return time; +} + +static void update_wallclock(void) +{ + shared_info_t *s = HYPERVISOR_shared_info; + + do { + shadow_ts_version = s->wc_version; + rmb(); + shadow_ts.ts_sec = s->wc_sec; + shadow_ts.ts_nsec = s->wc_nsec; + rmb(); + } + while ((s->wc_version & 1) | (shadow_ts_version ^ s->wc_version)); +} + void gettimeofday(struct timeval *tv) { - struct timeval _tv; - - do { - get_time_values_from_xen(); - _tv.tv_usec = get_time_delta_usecs(); - _tv.tv_sec = shadow_tv.tv_sec; - _tv.tv_usec += shadow_tv.tv_usec; - } - while ( unlikely(!TIME_VALUES_UP_TO_DATE) ); - - HANDLE_USEC_OVERFLOW(_tv); - *tv = _tv; -} + u64 nsec = monotonic_clock(); + nsec += shadow_ts.ts_nsec; + + + tv->tv_sec = shadow_ts.ts_sec; + tv->tv_sec += NSEC_TO_SEC(nsec); + tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL); +} + static void print_current_time(void) { - struct timeval tv; - - get_time_values_from_xen(); + struct timeval tv; gettimeofday(&tv); printk("T(s=%ld us=%ld)\n", tv.tv_sec, tv.tv_usec); } + void block(u32 millisecs) { struct timeval tv; gettimeofday(&tv); - //printk("tv.tv_sec=%ld, tv.tv_usec=%ld, shadow_system_time=%lld\n", tv.tv_sec, tv.tv_usec, shadow_system_time ); - HYPERVISOR_set_timer_op(get_s_time() + 1000000LL * (s64) millisecs); + HYPERVISOR_set_timer_op(monotonic_clock() + 1000000LL * (s64) millisecs); HYPERVISOR_block(); } @@ -185,7 +220,7 @@ static int i; get_time_values_from_xen(); - + update_wallclock(); i++; if (i >= 1000) { print_current_time(); @@ -197,24 +232,5 @@ void init_time(void) { - u64 __cpu_khz; - unsigned long cpu_khz; - - __cpu_khz = HYPERVISOR_shared_info->cpu_freq; - - cpu_khz = (u32) (__cpu_khz/1000); - - printk("Xen reported: %lu.%03lu MHz processor.\n", - cpu_khz / 1000, cpu_khz % 1000); - /* (10^6 * 2^32) / cpu_hz = (10^3 * 2^32) / cpu_khz = - (2^32 * 1 / (clocks/us)) */ - { - unsigned long eax=0, edx=1000; - __asm__("divl %2" - :"=a" (fast_gettimeoffset_quotient), "=d" (edx) - :"r" (cpu_khz), - "0" (eax), "1" (edx)); - } - bind_virq(VIRQ_TIMER, &timer_handler); } diff -r 2d4daffd8a4a -r 6721abf6b16d linux-2.6-xen-sparse/arch/xen/i386/mm/init.c --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c Sun Aug 21 11:40:39 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c Sun Aug 21 11:41:45 2005 @@ -352,13 +352,6 @@ swapper_pg_dir = pgd_base; init_mm.pgd = pgd_base; -#ifdef CONFIG_X86_PAE - int i; - /* Init entries of the first-level page table to the zero page */ - for (i = 0; i < PTRS_PER_PGD; i++) - set_pgd(pgd_base + i, __pgd(__pa(empty_zero_page) | _PAGE_PRESENT)); -#endif - /* Enable PSE if available */ if (cpu_has_pse) { set_in_cr4(X86_CR4_PSE); @@ -383,17 +376,6 @@ page_table_range_init(vaddr, 0, pgd_base); permanent_kmaps_init(pgd_base); - -#if 0 /* def CONFIG_X86_PAE */ - /* - * Add low memory identity-mappings - SMP needs it when - * starting up on an AP from real-mode. In the non-PAE - * case we already have these mappings through head.S. - * All user-space mappings are explicitly cleared after - * SMP startup. - */ - set_pgd(&pgd_base[0], pgd_base[USER_PTRS_PER_PGD]); -#endif } #if defined(CONFIG_PM_DISK) || defined(CONFIG_SOFTWARE_SUSPEND) diff -r 2d4daffd8a4a -r 6721abf6b16d linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h Sun Aug 21 11:40:39 2005 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h Sun Aug 21 11:41:45 2005 @@ -507,14 +507,14 @@ int vcpu, vcpu_guest_context_t *ctxt) { int ret; - unsigned long ign1, ign2; - __asm__ __volatile__ ( - TRAP_INSTR - : "=a" (ret), "=b" (ign1), "=c" (ign2) - : "0" (__HYPERVISOR_sched_op), - "1" (SCHEDOP_vcpu_pickle | (vcpu << SCHEDOP_vcpushift)), - "2" (ctxt) - : __syscall_clobber ); + + __asm__ __volatile__ ( + TRAP_INSTR + : "=a" (ret) + : "0" ((unsigned long)__HYPERVISOR_sched_op), + "D" ((unsigned long)SCHEDOP_vcpu_pickle | (vcpu << SCHEDOP_vcpushift)), + "S" ((unsigned long)ctxt) + : __syscall_clobber ); return ret; } diff -r 2d4daffd8a4a -r 6721abf6b16d tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Sun Aug 21 11:40:39 2005 +++ b/tools/python/xen/xend/XendDomainInfo.py Sun Aug 21 11:41:45 2005 @@ -23,7 +23,7 @@ """ -import string +import string, re import os import time import threading @@ -383,7 +383,9 @@ def createDevice(self, type, devconfig, change=False): if type == 'vbd': - + typedev = sxp.child_value(devconfig, 'dev') + if re.match('^ioemu:', typedev): + return; backdom = domain_exists(sxp.child_value(devconfig, 'backend', '0')) devnum = blkdev_name_to_number(sxp.child_value(devconfig, 'dev')) diff -r 2d4daffd8a4a -r 6721abf6b16d tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Sun Aug 21 11:40:39 2005 +++ b/tools/python/xen/xend/server/blkif.py Sun Aug 21 11:41:45 2005 @@ -18,7 +18,6 @@ """Support for virtual block devices. """ import string -import re from xen.util import blkif from xen.xend.XendError import XendError, VmError @@ -200,7 +199,6 @@ self.vdev = None self.mode = None self.type = None - self.emtype = None self.params = None self.node = None self.device = None @@ -239,12 +237,7 @@ # Split into type and type-specific params (which are passed to the # type-specific control script). (self.type, self.params) = string.split(self.uname, ':', 1) - typedev = sxp.child_value(config, 'dev') - if re.match( '^ioemu:', typedev): - (self.emtype, self.dev) = string.split(typedev, ':', 1) - else: - self.emtype = 'vbd' - self.dev = typedev + self.dev = sxp.child_value(config, 'dev') if not self.dev: raise VmError('vbd: Missing dev') self.mode = sxp.child_value(config, 'mode', 'r') @@ -265,8 +258,6 @@ if recreate: pass else: - if self.emtype == 'ioemu': - return node = Blkctl.block('bind', self.type, self.params) self.setNode(node) self.attachBackend() diff -r 2d4daffd8a4a -r 6721abf6b16d tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Sun Aug 21 11:40:39 2005 +++ b/tools/python/xen/xm/main.py Sun Aug 21 11:41:45 2005 @@ -434,7 +434,7 @@ arg_check(args, 6, "sedf") dom = args[0] - v = map(int, args[1:5]) + v = map(int, args[1:6]) from xen.xend.XendClient import server server.xend_domain_cpu_sedf_set(dom, *v) diff -r 2d4daffd8a4a -r 6721abf6b16d xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Sun Aug 21 11:40:39 2005 +++ b/xen/arch/x86/domain_build.c Sun Aug 21 11:41:45 2005 @@ -69,11 +69,21 @@ #define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK) #define round_pgdown(_p) ((_p)&PAGE_MASK) -static struct pfn_info *alloc_largest(struct domain *d, unsigned long max) +static struct pfn_info *alloc_chunk(struct domain *d, unsigned long max_pages) { struct pfn_info *page; - unsigned int order = get_order(max * PAGE_SIZE); - if ( (max & (max-1)) != 0 ) + unsigned int order; + /* + * Allocate up to 2MB at a time: + * 1. This prevents overflow of get_order() when allocating more than + * 4GB to domain 0 on a PAE machine. + * 2. It prevents allocating very large chunks from DMA pools before + * the >4GB pool is fully depleted. + */ + if ( max_pages > (2UL << (20 - PAGE_SHIFT)) ) + max_pages = 2UL << (20 - PAGE_SHIFT); + order = get_order(max_pages << PAGE_SHIFT); + if ( (max_pages & (max_pages-1)) != 0 ) order--; while ( (page = alloc_domheap_pages(d, order, 0)) == NULL ) if ( order-- == 0 ) @@ -608,7 +618,7 @@ } while ( pfn < nr_pages ) { - if ( (page = alloc_largest(d, nr_pages - d->tot_pages)) == NULL ) + if ( (page = alloc_chunk(d, nr_pages - d->tot_pages)) == NULL ) panic("Not enough RAM for DOM0 reservation.\n"); while ( pfn < d->tot_pages ) { diff -r 2d4daffd8a4a -r 6721abf6b16d xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Sun Aug 21 11:40:39 2005 +++ b/xen/arch/x86/mm.c Sun Aug 21 11:41:45 2005 @@ -2176,7 +2176,7 @@ } } - *(unsigned long *)va = req.val; + *(intpte_t *)va = req.val; okay = 1; if ( shadow_mode_enabled(d) ) @@ -2386,7 +2386,7 @@ } /* Delete pagetable entry. */ - if ( unlikely(__put_user(0, (unsigned long *)va))) + if ( unlikely(__put_user(0, (intpte_t *)va))) { DPRINTK("Cannot delete PTE entry at %p.\n", va); put_page_type(page); @@ -2446,12 +2446,11 @@ int clear_grant_va_mapping(unsigned long addr, unsigned long frame) { - l1_pgentry_t *pl1e; - unsigned long _ol1e; + l1_pgentry_t *pl1e, ol1e; pl1e = &linear_pg_table[l1_linear_offset(addr)]; - if ( unlikely(__get_user(_ol1e, (unsigned long *)pl1e) != 0) ) + if ( unlikely(__get_user(ol1e.l1, &pl1e->l1) != 0) ) { DPRINTK("Could not find PTE entry for address %lx\n", addr); return GNTST_general_error; @@ -2461,15 +2460,15 @@ * Check that the virtual address supplied is actually mapped to * frame. */ - if ( unlikely((_ol1e >> PAGE_SHIFT) != frame )) + if ( unlikely(l1e_get_pfn(ol1e) != frame) ) { DPRINTK("PTE entry %lx for address %lx doesn't match frame %lx\n", - _ol1e, addr, frame); + l1e_get_pfn(ol1e), addr, frame); return GNTST_general_error; } /* Delete pagetable entry. */ - if ( unlikely(__put_user(0, (unsigned long *)pl1e))) + if ( unlikely(__put_user(0, &pl1e->l1)) ) { DPRINTK("Cannot delete PTE entry at %p.\n", (unsigned long *)pl1e); return GNTST_general_error; diff -r 2d4daffd8a4a -r 6721abf6b16d xen/include/asm-x86/x86_32/page-3level.h --- a/xen/include/asm-x86/x86_32/page-3level.h Sun Aug 21 11:40:39 2005 +++ b/xen/include/asm-x86/x86_32/page-3level.h Sun Aug 21 11:41:45 2005 @@ -63,7 +63,7 @@ /* Extract flags into 32-bit integer, or turn 32-bit flags into a pte mask. */ #define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF)) -#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 40) | ((x) & 0xFFF)) +#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 32) | ((x) & 0xFFF)) #define L1_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* PAT/GLOBAL */ #define L2_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* PSE/GLOBAL */ diff -r 2d4daffd8a4a -r 6721abf6b16d xen/include/public/physdev.h --- a/xen/include/public/physdev.h Sun Aug 21 11:40:39 2005 +++ b/xen/include/public/physdev.h Sun Aug 21 11:41:45 2005 @@ -27,8 +27,8 @@ typedef struct physdevop_set_iobitmap { /* IN */ - char *bitmap; - u32 nr_ports; + u8 *bitmap; + u32 nr_ports; } physdevop_set_iobitmap_t; typedef struct physdevop_apic { _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |