direct-io.hg

changeset 6303:6721abf6b16d

merge?
author cl349@firebug.cl.cam.ac.uk
date Sun Aug 21 11:41:45 2005 +0000 (2005-08-21)
parents 2d4daffd8a4a 0f69e0adddb0
children dc8380497e98
files Config.mk Makefile extras/mini-os/include/time.h extras/mini-os/kernel.c extras/mini-os/time.c linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile linux-2.6-xen-sparse/arch/xen/i386/kernel/head.S linux-2.6-xen-sparse/arch/xen/i386/kernel/init_task.c linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c linux-2.6-xen-sparse/arch/xen/i386/mm/init.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c linux-2.6-xen-sparse/drivers/xen/blkback/common.h linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h linux-2.6-xen-sparse/drivers/xen/console/console.c linux-2.6-xen-sparse/drivers/xen/netback/common.h linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h linux-2.6-xen-sparse/include/asm-xen/xenbus.h tools/debugger/libxendebug/xendebug.c tools/debugger/libxendebug/xendebug.h tools/debugger/pdb/linux-2.6-module/debug.c tools/debugger/pdb/linux-2.6-module/module.c tools/debugger/pdb/linux-2.6-module/pdb_debug.h tools/debugger/pdb/pdb_caml_domain.c tools/debugger/pdb/pdb_caml_process.c tools/debugger/pdb/pdb_caml_xcs.c tools/libxc/xc.h tools/libxc/xc_gnttab.c tools/python/xen/lowlevel/xu/xu.c tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/blkif.py tools/python/xen/xm/main.py tools/xentrace/xentrace.c xen/arch/x86/domain_build.c xen/arch/x86/mm.c xen/arch/x86/physdev.c xen/common/grant_table.c xen/common/trace.c xen/include/asm-x86/page.h xen/include/asm-x86/x86_32/page-3level.h xen/include/public/arch-ia64.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h xen/include/public/dom0_ops.h xen/include/public/grant_table.h xen/include/public/io/domain_controller.h xen/include/public/io/netif.h xen/include/public/physdev.h xen/include/public/xen.h
line diff
     2.1 --- a/Makefile	Sun Aug 21 11:40:39 2005 +0000
     2.2 +++ b/Makefile	Sun Aug 21 11:41:45 2005 +0000
     2.3 @@ -172,6 +172,12 @@ uninstall:
     2.4  	rm -rf $(D)/usr/bin/xen* $(D)/usr/bin/miniterm
     2.5  	rm -rf $(D)/boot/*xen*
     2.6  	rm -rf $(D)/lib/modules/*xen*
     2.7 +	rm -rf $(D)/usr/bin/cpuperf-perfcntr $(D)/usr/bin/cpuperf-xen
     2.8 +	rm -rf $(D)/usr/bin/xc_shadow
     2.9 +	rm -rf $(D)/usr/share/xen $(D)/usr/libexec/xen
    2.10 +	rm -rf $(D)/usr/share/man/man1/xen*
    2.11 +	rm -rf $(D)/usr/share/man/man8/xen*
    2.12 +	rm -rf $(D)/usr/lib/xen
    2.13  
    2.14  # Legacy targets for compatibility
    2.15  linux24:
     3.1 --- a/extras/mini-os/include/time.h	Sun Aug 21 11:40:39 2005 +0000
     3.2 +++ b/extras/mini-os/include/time.h	Sun Aug 21 11:41:45 2005 +0000
     3.3 @@ -28,7 +28,7 @@
     3.4   * of real time into system time 
     3.5   */
     3.6  typedef s64 s_time_t;
     3.7 -#define NOW()                   ((s_time_t)get_s_time())
     3.8 +#define NOW()                   ((s_time_t)monotonic_clock())
     3.9  #define SECONDS(_s)             (((s_time_t)(_s))  * 1000000000UL )
    3.10  #define TENTHS(_ts)             (((s_time_t)(_ts)) * 100000000UL )
    3.11  #define HUNDREDTHS(_hs)         (((s_time_t)(_hs)) * 10000000UL )
    3.12 @@ -36,7 +36,8 @@ typedef s64 s_time_t;
    3.13  #define MICROSECS(_us)          (((s_time_t)(_us)) * 1000UL )
    3.14  #define Time_Max                ((s_time_t) 0x7fffffffffffffffLL)
    3.15  #define FOREVER                 Time_Max
    3.16 -
    3.17 +#define NSEC_TO_USEC(_nsec)     (_nsec / 1000UL)
    3.18 +#define NSEC_TO_SEC(_nsec)      (_nsec / 1000000000ULL)
    3.19  
    3.20  /* wall clock time  */
    3.21  typedef long time_t;
    3.22 @@ -46,6 +47,11 @@ struct timeval {
    3.23  	suseconds_t	tv_usec;	/* microseconds */
    3.24  };
    3.25  
    3.26 +struct timespec {
    3.27 +    time_t      ts_sec;
    3.28 +    long        ts_nsec;
    3.29 +};
    3.30 +
    3.31  
    3.32  /* prototypes */
    3.33  void     init_time(void);
     4.1 --- a/extras/mini-os/kernel.c	Sun Aug 21 11:40:39 2005 +0000
     4.2 +++ b/extras/mini-os/kernel.c	Sun Aug 21 11:41:45 2005 +0000
     4.3 @@ -132,20 +132,6 @@ void start_kernel(start_info_t *si)
     4.4      i = 0;
     4.5      for ( ; ; ) 
     4.6      {      
     4.7 -        if(i >= 1000)         
     4.8 -        {
     4.9 -            {
    4.10 -                unsigned long saved;
    4.11 -                __asm__ ("movl %%esp, %0"
    4.12 -                         :"=r"(saved)  /* y is output operand */
    4.13 -                            /* x is input operand */);
    4.14 -//                        :"a"); /* %eax is clobbered register */
    4.15 -                printk("ESP=0x%lx\n", saved);
    4.16 -            }
    4.17 -            
    4.18 -            printk("1000 bloks\n");
    4.19 -            i=0;            
    4.20 -        }
    4.21  //        HYPERVISOR_yield();
    4.22          block(1);
    4.23          i++;
     5.1 --- a/extras/mini-os/time.c	Sun Aug 21 11:40:39 2005 +0000
     5.2 +++ b/extras/mini-os/time.c	Sun Aug 21 11:41:45 2005 +0000
     5.3 @@ -43,19 +43,20 @@
     5.4   * Time functions
     5.5   *************************************************************************/
     5.6  
     5.7 -/* Cached *multiplier* to convert TSC counts to microseconds.
     5.8 - * (see the equation below).
     5.9 - * Equal to 2^32 * (1 / (clocks per usec) ).
    5.10 - * Initialized in time_init.
    5.11 - */
    5.12 -static unsigned long fast_gettimeoffset_quotient;
    5.13 +/* These are peridically updated in shared_info, and then copied here. */
    5.14 +struct shadow_time_info {
    5.15 +	u64 tsc_timestamp;     /* TSC at last update of time vals.  */
    5.16 +	u64 system_timestamp;  /* Time, in nanosecs, since boot.    */
    5.17 +	u32 tsc_to_nsec_mul;
    5.18 +	u32 tsc_to_usec_mul;
    5.19 +	int tsc_shift;
    5.20 +	u32 version;
    5.21 +};
    5.22 +static struct timespec shadow_ts;
    5.23 +static u32 shadow_ts_version;
    5.24  
    5.25 +static struct shadow_time_info shadow;
    5.26  
    5.27 -/* These are peridically updated in shared_info, and then copied here. */
    5.28 -static u32 shadow_tsc_stamp;
    5.29 -static s64 shadow_system_time;
    5.30 -static u32 shadow_time_version;
    5.31 -static struct timeval shadow_tv;
    5.32  
    5.33  #ifndef rmb
    5.34  #define rmb()  __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
    5.35 @@ -63,116 +64,150 @@ static struct timeval shadow_tv;
    5.36  
    5.37  #define HANDLE_USEC_OVERFLOW(_tv)          \
    5.38      do {                                   \
    5.39 -        while ( (_tv).tv_usec >= 1000000 ) \
    5.40 +        while ( (_tv)->tv_usec >= 1000000 ) \
    5.41          {                                  \
    5.42 -            (_tv).tv_usec -= 1000000;      \
    5.43 -            (_tv).tv_sec++;                \
    5.44 +            (_tv)->tv_usec -= 1000000;      \
    5.45 +            (_tv)->tv_sec++;                \
    5.46          }                                  \
    5.47      } while ( 0 )
    5.48  
    5.49 -static void get_time_values_from_xen(void)
    5.50 +static inline int time_values_up_to_date(void)
    5.51 +{
    5.52 +	struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_time[0]; 
    5.53 +
    5.54 +	return (shadow.version == src->version);
    5.55 +}
    5.56 +
    5.57 +
    5.58 +/*
    5.59 + * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
    5.60 + * yielding a 64-bit result.
    5.61 + */
    5.62 +static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
    5.63  {
    5.64 -    do {
    5.65 -        shadow_time_version = HYPERVISOR_shared_info->time_version2;
    5.66 -        rmb();
    5.67 -        shadow_tv.tv_sec    = HYPERVISOR_shared_info->wc_sec;
    5.68 -        shadow_tv.tv_usec   = HYPERVISOR_shared_info->wc_usec;
    5.69 -        shadow_tsc_stamp    = (u32)HYPERVISOR_shared_info->tsc_timestamp;
    5.70 -        shadow_system_time  = HYPERVISOR_shared_info->system_time;
    5.71 -        rmb();
    5.72 -    }
    5.73 -    while ( shadow_time_version != HYPERVISOR_shared_info->time_version1 );
    5.74 +	u64 product;
    5.75 +#ifdef __i386__
    5.76 +	u32 tmp1, tmp2;
    5.77 +#endif
    5.78 +
    5.79 +	if ( shift < 0 )
    5.80 +		delta >>= -shift;
    5.81 +	else
    5.82 +		delta <<= shift;
    5.83 +
    5.84 +#ifdef __i386__
    5.85 +	__asm__ (
    5.86 +		"mul  %5       ; "
    5.87 +		"mov  %4,%%eax ; "
    5.88 +		"mov  %%edx,%4 ; "
    5.89 +		"mul  %5       ; "
    5.90 +		"add  %4,%%eax ; "
    5.91 +		"xor  %5,%5    ; "
    5.92 +		"adc  %5,%%edx ; "
    5.93 +		: "=A" (product), "=r" (tmp1), "=r" (tmp2)
    5.94 +		: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
    5.95 +#else
    5.96 +	__asm__ (
    5.97 +		"mul %%rdx ; shrd $32,%%rdx,%%rax"
    5.98 +		: "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
    5.99 +#endif
   5.100 +
   5.101 +	return product;
   5.102 +}
   5.103 +
   5.104 +
   5.105 +static unsigned long get_nsec_offset(void)
   5.106 +{
   5.107 +	u64 now, delta;
   5.108 +	rdtscll(now);
   5.109 +	delta = now - shadow.tsc_timestamp;
   5.110 +	return scale_delta(delta, shadow.tsc_to_nsec_mul, shadow.tsc_shift);
   5.111  }
   5.112  
   5.113  
   5.114 -#define TIME_VALUES_UP_TO_DATE \
   5.115 -    (shadow_time_version == HYPERVISOR_shared_info->time_version2)
   5.116 -
   5.117 -static u32  get_time_delta_usecs(void)
   5.118 +static void get_time_values_from_xen(void)
   5.119  {
   5.120 -	register unsigned long eax, edx;
   5.121 -
   5.122 -	/* Read the Time Stamp Counter */
   5.123 -
   5.124 -	rdtsc(eax,edx);
   5.125 -
   5.126 -	/* .. relative to previous jiffy (32 bits is enough) */
   5.127 -	eax -= shadow_tsc_stamp;
   5.128 +	struct vcpu_time_info    *src = &HYPERVISOR_shared_info->vcpu_time[0];
   5.129  
   5.130 -	/*
   5.131 -	 * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient
   5.132 -	 *             = (tsc_low delta) * (usecs_per_clock)
   5.133 -	 *             = (tsc_low delta) * (usecs_per_jiffy / clocks_per_jiffy)
   5.134 -	 *
   5.135 -	 * Using a mull instead of a divl saves up to 31 clock cycles
   5.136 -	 * in the critical path.
   5.137 -	 */
   5.138 + 	do {
   5.139 +		shadow.version = src->version;
   5.140 +		rmb();
   5.141 +		shadow.tsc_timestamp     = src->tsc_timestamp;
   5.142 +		shadow.system_timestamp  = src->system_time;
   5.143 +		shadow.tsc_to_nsec_mul   = src->tsc_to_system_mul;
   5.144 +		shadow.tsc_shift         = src->tsc_shift;
   5.145 +		rmb();
   5.146 +	}
   5.147 +	while ((src->version & 1) | (shadow.version ^ src->version));
   5.148  
   5.149 -	__asm__("mull %2"
   5.150 -		:"=a" (eax), "=d" (edx)
   5.151 -		:"rm" (fast_gettimeoffset_quotient),
   5.152 -		 "0" (eax));
   5.153 -
   5.154 -	/* our adjusted time offset in microseconds */
   5.155 -	return edx;
   5.156 +	shadow.tsc_to_usec_mul = shadow.tsc_to_nsec_mul / 1000;
   5.157  }
   5.158  
   5.159 -s64 get_s_time (void)
   5.160 -{
   5.161 -    u64 u_delta;
   5.162 -    s64 ret;
   5.163 +
   5.164 +
   5.165  
   5.166 - again:
   5.167 -
   5.168 -    u_delta = get_time_delta_usecs();
   5.169 -    ret = shadow_system_time + (1000 * u_delta);
   5.170 +/* monotonic_clock(): returns # of nanoseconds passed since time_init()
   5.171 + *		Note: This function is required to return accurate
   5.172 + *		time even in the absence of multiple timer ticks.
   5.173 + */
   5.174 +u64 monotonic_clock(void)
   5.175 +{
   5.176 +	u64 time;
   5.177 +	u32 local_time_version;
   5.178  
   5.179 -    if ( unlikely(!TIME_VALUES_UP_TO_DATE) )
   5.180 -    {
   5.181 -        /*
   5.182 -         * We may have blocked for a long time, rendering our calculations
   5.183 -         * invalid (e.g. the time delta may have overflowed). Detect that
   5.184 -         * and recalculate with fresh values.
   5.185 -         */
   5.186 -        get_time_values_from_xen();
   5.187 -        goto again;
   5.188 -    }
   5.189 +	do {
   5.190 +		local_time_version = shadow.version;
   5.191 +		rmb();
   5.192 +		time = shadow.system_timestamp + get_nsec_offset();
   5.193 +        if (!time_values_up_to_date())
   5.194 +			get_time_values_from_xen();
   5.195 +		rmb();
   5.196 +	} while (local_time_version != shadow.version);
   5.197 +
   5.198 +	return time;
   5.199 +}
   5.200  
   5.201 -    return ret;
   5.202 +static void update_wallclock(void)
   5.203 +{
   5.204 +	shared_info_t *s = HYPERVISOR_shared_info;
   5.205 +
   5.206 +	do {
   5.207 +		shadow_ts_version = s->wc_version;
   5.208 +		rmb();
   5.209 +		shadow_ts.ts_sec  = s->wc_sec;
   5.210 +		shadow_ts.ts_nsec = s->wc_nsec;
   5.211 +		rmb();
   5.212 +	}
   5.213 +	while ((s->wc_version & 1) | (shadow_ts_version ^ s->wc_version));
   5.214  }
   5.215  
   5.216 +
   5.217  void gettimeofday(struct timeval *tv)
   5.218  {
   5.219 -    struct timeval _tv;
   5.220 +    u64 nsec = monotonic_clock();
   5.221 +    nsec += shadow_ts.ts_nsec;
   5.222 +    
   5.223 +    
   5.224 +    tv->tv_sec = shadow_ts.ts_sec;
   5.225 +    tv->tv_sec += NSEC_TO_SEC(nsec);
   5.226 +    tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL);
   5.227 +}
   5.228  
   5.229 -    do {
   5.230 -        get_time_values_from_xen();
   5.231 -        _tv.tv_usec = get_time_delta_usecs();
   5.232 -        _tv.tv_sec   = shadow_tv.tv_sec;
   5.233 -        _tv.tv_usec += shadow_tv.tv_usec;
   5.234 -    }
   5.235 -    while ( unlikely(!TIME_VALUES_UP_TO_DATE) );
   5.236 -
   5.237 -    HANDLE_USEC_OVERFLOW(_tv);
   5.238 -    *tv = _tv;
   5.239 -}
   5.240  
   5.241  static void print_current_time(void)
   5.242  {
   5.243 -    struct timeval tv;
   5.244 -
   5.245 -    get_time_values_from_xen();
   5.246 +    struct timeval tv;    
   5.247  
   5.248      gettimeofday(&tv);
   5.249      printk("T(s=%ld us=%ld)\n", tv.tv_sec, tv.tv_usec);
   5.250  }
   5.251  
   5.252 +
   5.253  void block(u32 millisecs)
   5.254  {
   5.255      struct timeval tv;
   5.256      gettimeofday(&tv);
   5.257 -    //printk("tv.tv_sec=%ld, tv.tv_usec=%ld, shadow_system_time=%lld\n", tv.tv_sec, tv.tv_usec, shadow_system_time );
   5.258 -    HYPERVISOR_set_timer_op(get_s_time() + 1000000LL * (s64) millisecs);
   5.259 +    HYPERVISOR_set_timer_op(monotonic_clock() + 1000000LL * (s64) millisecs);
   5.260      HYPERVISOR_block();
   5.261  }
   5.262  
   5.263 @@ -185,7 +220,7 @@ static void timer_handler(int ev, struct
   5.264      static int i;
   5.265  
   5.266      get_time_values_from_xen();
   5.267 -
   5.268 +    update_wallclock();
   5.269      i++;
   5.270      if (i >= 1000) {
   5.271          print_current_time();
   5.272 @@ -197,24 +232,5 @@ static void timer_handler(int ev, struct
   5.273  
   5.274  void init_time(void)
   5.275  {
   5.276 -    u64         __cpu_khz;
   5.277 -    unsigned long cpu_khz;
   5.278 -
   5.279 -    __cpu_khz = HYPERVISOR_shared_info->cpu_freq;
   5.280 -
   5.281 -    cpu_khz = (u32) (__cpu_khz/1000);
   5.282 -
   5.283 -    printk("Xen reported: %lu.%03lu MHz processor.\n", 
   5.284 -           cpu_khz / 1000, cpu_khz % 1000);
   5.285 -	/* (10^6 * 2^32) / cpu_hz = (10^3 * 2^32) / cpu_khz =
   5.286 -	   (2^32 * 1 / (clocks/us)) */
   5.287 -	{	
   5.288 -		unsigned long eax=0, edx=1000;
   5.289 -		__asm__("divl %2"
   5.290 -		    :"=a" (fast_gettimeoffset_quotient), "=d" (edx)
   5.291 -		    :"r" (cpu_khz),
   5.292 -		    "0" (eax), "1" (edx));
   5.293 -	}
   5.294 -
   5.295      bind_virq(VIRQ_TIMER, &timer_handler);
   5.296  }
    12.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Sun Aug 21 11:40:39 2005 +0000
    12.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Sun Aug 21 11:41:45 2005 +0000
    12.3 @@ -352,13 +352,6 @@ static void __init pagetable_init (void)
    12.4  	swapper_pg_dir = pgd_base;
    12.5  	init_mm.pgd    = pgd_base;
    12.6  
    12.7 -#ifdef CONFIG_X86_PAE
    12.8 -	int i;
    12.9 -	/* Init entries of the first-level page table to the zero page */
   12.10 -	for (i = 0; i < PTRS_PER_PGD; i++)
   12.11 -		set_pgd(pgd_base + i, __pgd(__pa(empty_zero_page) | _PAGE_PRESENT));
   12.12 -#endif
   12.13 -
   12.14  	/* Enable PSE if available */
   12.15  	if (cpu_has_pse) {
   12.16  		set_in_cr4(X86_CR4_PSE);
   12.17 @@ -383,17 +376,6 @@ static void __init pagetable_init (void)
   12.18  	page_table_range_init(vaddr, 0, pgd_base);
   12.19  
   12.20  	permanent_kmaps_init(pgd_base);
   12.21 -
   12.22 -#if 0 /* def CONFIG_X86_PAE */
   12.23 -	/*
   12.24 -	 * Add low memory identity-mappings - SMP needs it when
   12.25 -	 * starting up on an AP from real-mode. In the non-PAE
   12.26 -	 * case we already have these mappings through head.S.
   12.27 -	 * All user-space mappings are explicitly cleared after
   12.28 -	 * SMP startup.
   12.29 -	 */
   12.30 -	set_pgd(&pgd_base[0], pgd_base[USER_PTRS_PER_PGD]);
   12.31 -#endif
   12.32  }
   12.33  
   12.34  #if defined(CONFIG_PM_DISK) || defined(CONFIG_SOFTWARE_SUSPEND)
    22.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h	Sun Aug 21 11:40:39 2005 +0000
    22.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h	Sun Aug 21 11:41:45 2005 +0000
    22.3 @@ -507,14 +507,14 @@ HYPERVISOR_vcpu_pickle(
    22.4      int vcpu, vcpu_guest_context_t *ctxt)
    22.5  {
    22.6      int ret;
    22.7 -    unsigned long ign1, ign2;
    22.8 +
    22.9      __asm__ __volatile__ (
   22.10          TRAP_INSTR
   22.11 -        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   22.12 -	: "0" (__HYPERVISOR_sched_op),
   22.13 -	  "1" (SCHEDOP_vcpu_pickle | (vcpu << SCHEDOP_vcpushift)),
   22.14 -	  "2" (ctxt)
   22.15 -        : __syscall_clobber );
   22.16 +        : "=a" (ret)
   22.17 +	: "0" ((unsigned long)__HYPERVISOR_sched_op),
   22.18 +	"D" ((unsigned long)SCHEDOP_vcpu_pickle | (vcpu << SCHEDOP_vcpushift)),
   22.19 +	"S" ((unsigned long)ctxt)
   22.20 +	: __syscall_clobber );
   22.21  
   22.22      return ret;
   22.23  }
    35.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Sun Aug 21 11:40:39 2005 +0000
    35.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sun Aug 21 11:41:45 2005 +0000
    35.3 @@ -23,7 +23,7 @@ Author: Mike Wray <mike.wray@hp.com>
    35.4  
    35.5  """
    35.6  
    35.7 -import string
    35.8 +import string, re
    35.9  import os
   35.10  import time
   35.11  import threading
   35.12 @@ -383,7 +383,9 @@ class XendDomainInfo:
   35.13  
   35.14      def createDevice(self, type, devconfig, change=False):
   35.15          if type == 'vbd':
   35.16 -
   35.17 +            typedev = sxp.child_value(devconfig, 'dev')
   35.18 +            if re.match('^ioemu:', typedev):
   35.19 +	        return;
   35.20              backdom = domain_exists(sxp.child_value(devconfig, 'backend', '0'))
   35.21  
   35.22              devnum = blkdev_name_to_number(sxp.child_value(devconfig, 'dev'))
    36.1 --- a/tools/python/xen/xend/server/blkif.py	Sun Aug 21 11:40:39 2005 +0000
    36.2 +++ b/tools/python/xen/xend/server/blkif.py	Sun Aug 21 11:41:45 2005 +0000
    36.3 @@ -18,7 +18,6 @@
    36.4  """Support for virtual block devices.
    36.5  """
    36.6  import string
    36.7 -import re
    36.8  
    36.9  from xen.util import blkif
   36.10  from xen.xend.XendError import XendError, VmError
   36.11 @@ -200,7 +199,6 @@ class BlkDev(Dev):
   36.12          self.vdev = None
   36.13          self.mode = None
   36.14          self.type = None
   36.15 -        self.emtype = None
   36.16          self.params = None
   36.17          self.node = None
   36.18          self.device = None
   36.19 @@ -239,12 +237,7 @@ class BlkDev(Dev):
   36.20          # Split into type and type-specific params (which are passed to the
   36.21          # type-specific control script).
   36.22          (self.type, self.params) = string.split(self.uname, ':', 1)
   36.23 -        typedev = sxp.child_value(config, 'dev')
   36.24 -        if re.match( '^ioemu:', typedev):
   36.25 -            (self.emtype, self.dev) = string.split(typedev, ':', 1)
   36.26 -        else:
   36.27 -            self.emtype = 'vbd'
   36.28 -            self.dev = typedev
   36.29 +        self.dev = sxp.child_value(config, 'dev')
   36.30          if not self.dev:
   36.31              raise VmError('vbd: Missing dev')
   36.32          self.mode = sxp.child_value(config, 'mode', 'r')
   36.33 @@ -265,8 +258,6 @@ class BlkDev(Dev):
   36.34          if recreate:
   36.35              pass
   36.36          else:
   36.37 -            if self.emtype == 'ioemu':
   36.38 -                return
   36.39              node = Blkctl.block('bind', self.type, self.params)
   36.40              self.setNode(node)
   36.41              self.attachBackend()
    37.1 --- a/tools/python/xen/xm/main.py	Sun Aug 21 11:40:39 2005 +0000
    37.2 +++ b/tools/python/xen/xm/main.py	Sun Aug 21 11:41:45 2005 +0000
    37.3 @@ -434,7 +434,7 @@ def xm_sedf(args):
    37.4      arg_check(args, 6, "sedf")
    37.5      
    37.6      dom = args[0]
    37.7 -    v = map(int, args[1:5])
    37.8 +    v = map(int, args[1:6])
    37.9      from xen.xend.XendClient import server
   37.10      server.xend_domain_cpu_sedf_set(dom, *v)
   37.11  
    39.1 --- a/xen/arch/x86/domain_build.c	Sun Aug 21 11:40:39 2005 +0000
    39.2 +++ b/xen/arch/x86/domain_build.c	Sun Aug 21 11:41:45 2005 +0000
    39.3 @@ -69,11 +69,21 @@ boolean_param("dom0_translate", opt_dom0
    39.4  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
    39.5  #define round_pgdown(_p)  ((_p)&PAGE_MASK)
    39.6  
    39.7 -static struct pfn_info *alloc_largest(struct domain *d, unsigned long max)
    39.8 +static struct pfn_info *alloc_chunk(struct domain *d, unsigned long max_pages)
    39.9  {
   39.10      struct pfn_info *page;
   39.11 -    unsigned int order = get_order(max * PAGE_SIZE);
   39.12 -    if ( (max & (max-1)) != 0 )
   39.13 +    unsigned int order;
   39.14 +    /*
   39.15 +     * Allocate up to 2MB at a time:
   39.16 +     *  1. This prevents overflow of get_order() when allocating more than
   39.17 +     *     4GB to domain 0 on a PAE machine.
   39.18 +     *  2. It prevents allocating very large chunks from DMA pools before
   39.19 +     *     the >4GB pool is fully depleted.
   39.20 +     */
   39.21 +    if ( max_pages > (2UL << (20 - PAGE_SHIFT)) )
   39.22 +        max_pages = 2UL << (20 - PAGE_SHIFT);
   39.23 +    order = get_order(max_pages << PAGE_SHIFT);
   39.24 +    if ( (max_pages & (max_pages-1)) != 0 )
   39.25          order--;
   39.26      while ( (page = alloc_domheap_pages(d, order, 0)) == NULL )
   39.27          if ( order-- == 0 )
   39.28 @@ -608,7 +618,7 @@ int construct_dom0(struct domain *d,
   39.29      }
   39.30      while ( pfn < nr_pages )
   39.31      {
   39.32 -        if ( (page = alloc_largest(d, nr_pages - d->tot_pages)) == NULL )
   39.33 +        if ( (page = alloc_chunk(d, nr_pages - d->tot_pages)) == NULL )
   39.34              panic("Not enough RAM for DOM0 reservation.\n");
   39.35          while ( pfn < d->tot_pages )
   39.36          {
    40.1 --- a/xen/arch/x86/mm.c	Sun Aug 21 11:40:39 2005 +0000
    40.2 +++ b/xen/arch/x86/mm.c	Sun Aug 21 11:41:45 2005 +0000
    40.3 @@ -2176,7 +2176,7 @@ int do_mmu_update(
    40.4                          }
    40.5                      }
    40.6  
    40.7 -                    *(unsigned long *)va = req.val;
    40.8 +                    *(intpte_t *)va = req.val;
    40.9                      okay = 1;
   40.10  
   40.11                      if ( shadow_mode_enabled(d) )
   40.12 @@ -2386,7 +2386,7 @@ int clear_grant_pte_mapping(
   40.13      }
   40.14  
   40.15      /* Delete pagetable entry. */
   40.16 -    if ( unlikely(__put_user(0, (unsigned long *)va)))
   40.17 +    if ( unlikely(__put_user(0, (intpte_t *)va)))
   40.18      {
   40.19          DPRINTK("Cannot delete PTE entry at %p.\n", va);
   40.20          put_page_type(page);
   40.21 @@ -2446,12 +2446,11 @@ int update_grant_va_mapping(
   40.22  
   40.23  int clear_grant_va_mapping(unsigned long addr, unsigned long frame)
   40.24  {
   40.25 -    l1_pgentry_t *pl1e;
   40.26 -    unsigned long _ol1e;
   40.27 +    l1_pgentry_t *pl1e, ol1e;
   40.28      
   40.29      pl1e = &linear_pg_table[l1_linear_offset(addr)];
   40.30  
   40.31 -    if ( unlikely(__get_user(_ol1e, (unsigned long *)pl1e) != 0) )
   40.32 +    if ( unlikely(__get_user(ol1e.l1, &pl1e->l1) != 0) )
   40.33      {
   40.34          DPRINTK("Could not find PTE entry for address %lx\n", addr);
   40.35          return GNTST_general_error;
   40.36 @@ -2461,15 +2460,15 @@ int clear_grant_va_mapping(unsigned long
   40.37       * Check that the virtual address supplied is actually mapped to
   40.38       * frame.
   40.39       */
   40.40 -    if ( unlikely((_ol1e >> PAGE_SHIFT) != frame ))
   40.41 +    if ( unlikely(l1e_get_pfn(ol1e) != frame) )
   40.42      {
   40.43          DPRINTK("PTE entry %lx for address %lx doesn't match frame %lx\n",
   40.44 -                _ol1e, addr, frame);
   40.45 +                l1e_get_pfn(ol1e), addr, frame);
   40.46          return GNTST_general_error;
   40.47      }
   40.48  
   40.49      /* Delete pagetable entry. */
   40.50 -    if ( unlikely(__put_user(0, (unsigned long *)pl1e)))
   40.51 +    if ( unlikely(__put_user(0, &pl1e->l1)) )
   40.52      {
   40.53          DPRINTK("Cannot delete PTE entry at %p.\n", (unsigned long *)pl1e);
   40.54          return GNTST_general_error;
    45.1 --- a/xen/include/asm-x86/x86_32/page-3level.h	Sun Aug 21 11:40:39 2005 +0000
    45.2 +++ b/xen/include/asm-x86/x86_32/page-3level.h	Sun Aug 21 11:41:45 2005 +0000
    45.3 @@ -63,7 +63,7 @@ typedef l3_pgentry_t root_pgentry_t;
    45.4  
    45.5  /* Extract flags into 32-bit integer, or turn 32-bit flags into a pte mask. */
    45.6  #define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF))
    45.7 -#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 40) | ((x) & 0xFFF))
    45.8 +#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 32) | ((x) & 0xFFF))
    45.9  
   45.10  #define L1_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* PAT/GLOBAL */
   45.11  #define L2_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* PSE/GLOBAL */
    53.1 --- a/xen/include/public/physdev.h	Sun Aug 21 11:40:39 2005 +0000
    53.2 +++ b/xen/include/public/physdev.h	Sun Aug 21 11:41:45 2005 +0000
    53.3 @@ -27,8 +27,8 @@ typedef struct physdevop_set_iopl {
    53.4  
    53.5  typedef struct physdevop_set_iobitmap {
    53.6      /* IN */
    53.7 -    char *bitmap;
    53.8 -    u32   nr_ports;
    53.9 +    u8 *bitmap;
   53.10 +    u32 nr_ports;
   53.11  } physdevop_set_iobitmap_t;
   53.12  
   53.13  typedef struct physdevop_apic {