ia64/xen-unstable

changeset 7623:ca2e91ab4311

Merged.
author emellor@leeni.uk.xensource.com
date Thu Nov 03 02:45:07 2005 +0100 (2005-11-03)
parents fe487b19c379 76fbcb25d174
children 289b73a5ace7
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/spinlock.h	Thu Nov 03 02:44:41 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/spinlock.h	Thu Nov 03 02:45:07 2005 +0100
     1.3 @@ -6,6 +6,7 @@
     1.4  #include <asm/page.h>
     1.5  #include <linux/config.h>
     1.6  #include <linux/compiler.h>
     1.7 +#include <asm/smp_alt.h>
     1.8  
     1.9  asmlinkage int printk(const char * fmt, ...)
    1.10  	__attribute__ ((format (printf, 1, 2)));
    1.11 @@ -47,8 +48,9 @@ typedef struct {
    1.12  #define spin_unlock_wait(x)	do { barrier(); } while(spin_is_locked(x))
    1.13  
    1.14  #define spin_lock_string \
    1.15 -	"\n1:\t" \
    1.16 -	"lock ; decb %0\n\t" \
    1.17 +        "1:\n" \
    1.18 +	LOCK \
    1.19 +	"decb %0\n\t" \
    1.20  	"jns 3f\n" \
    1.21  	"2:\t" \
    1.22  	"rep;nop\n\t" \
    1.23 @@ -58,8 +60,9 @@ typedef struct {
    1.24  	"3:\n\t"
    1.25  
    1.26  #define spin_lock_string_flags \
    1.27 -	"\n1:\t" \
    1.28 -	"lock ; decb %0\n\t" \
    1.29 +        "1:\n" \
    1.30 +	LOCK \
    1.31 +	"decb %0\n\t" \
    1.32  	"jns 4f\n\t" \
    1.33  	"2:\t" \
    1.34  	"testl $0x200, %1\n\t" \
    1.35 @@ -121,10 +124,34 @@ static inline void _raw_spin_unlock(spin
    1.36  static inline int _raw_spin_trylock(spinlock_t *lock)
    1.37  {
    1.38  	char oldval;
    1.39 +#ifdef CONFIG_SMP_ALTERNATIVES
    1.40  	__asm__ __volatile__(
    1.41 -		"xchgb %b0,%1"
    1.42 +		"1:movb %1,%b0\n"
    1.43 +		"movb $0,%1\n"
    1.44 +		"2:"
    1.45 +		".section __smp_alternatives,\"a\"\n"
    1.46 +		".long 1b\n"
    1.47 +		".long 3f\n"
    1.48 +		".previous\n"
    1.49 +		".section __smp_replacements,\"a\"\n"
    1.50 +		"3: .byte 2b - 1b\n"
    1.51 +		".byte 5f-4f\n"
    1.52 +		".byte 0\n"
    1.53 +		".byte 6f-5f\n"
    1.54 +		".byte -1\n"
    1.55 +		"4: xchgb %b0,%1\n"
    1.56 +		"5: movb %1,%b0\n"
    1.57 +		"movb $0,%1\n"
    1.58 +		"6:\n"
    1.59 +		".previous\n"
    1.60  		:"=q" (oldval), "=m" (lock->slock)
    1.61  		:"0" (0) : "memory");
    1.62 +#else
    1.63 +	__asm__ __volatile__(
    1.64 +		"xchgb %b0,%1\n"
    1.65 +		:"=q" (oldval), "=m" (lock->slock)
    1.66 +		:"0" (0) : "memory");
    1.67 +#endif
    1.68  	return oldval > 0;
    1.69  }
    1.70  
    1.71 @@ -225,8 +252,8 @@ static inline void _raw_write_lock(rwloc
    1.72  	__build_write_lock(rw, "__write_lock_failed");
    1.73  }
    1.74  
    1.75 -#define _raw_read_unlock(rw)		asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory")
    1.76 -#define _raw_write_unlock(rw)	asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory")
    1.77 +#define _raw_read_unlock(rw)	asm volatile(LOCK "incl %0" :"=m" ((rw)->lock) : : "memory")
    1.78 +#define _raw_write_unlock(rw)	asm volatile(LOCK "addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory")
    1.79  
    1.80  static inline int _raw_read_trylock(rwlock_t *lock)
    1.81  {
     2.1 --- a/xen/arch/x86/x86_32/domain_page.c	Thu Nov 03 02:44:41 2005 +0100
     2.2 +++ b/xen/arch/x86/x86_32/domain_page.c	Thu Nov 03 02:45:07 2005 +0100
     2.3 @@ -27,6 +27,19 @@ l1_pgentry_t *mapcache;
     2.4  static unsigned int map_idx, epoch, shadow_epoch[NR_CPUS];
     2.5  static spinlock_t map_lock = SPIN_LOCK_UNLOCKED;
     2.6  
     2.7 +/* Use a spare PTE bit to mark entries ready for recycling. */
     2.8 +#define READY_FOR_TLB_FLUSH (1<<10)
     2.9 +
    2.10 +static void flush_all_ready_maps(void)
    2.11 +{
    2.12 +    l1_pgentry_t *cache = mapcache;
    2.13 +    unsigned int i;
    2.14 +
    2.15 +    for ( i = 0; i < MAPCACHE_ENTRIES; i++ )
    2.16 +        if ( (l1e_get_flags(cache[i]) & READY_FOR_TLB_FLUSH) )
    2.17 +            cache[i] = l1e_empty();
    2.18 +}
    2.19 +
    2.20  void *map_domain_page(unsigned long pfn)
    2.21  {
    2.22      unsigned long va;
    2.23 @@ -54,6 +67,7 @@ void *map_domain_page(unsigned long pfn)
    2.24          if ( unlikely(idx == 0) )
    2.25          {
    2.26              ASSERT(flush_count++ == 0);
    2.27 +            flush_all_ready_maps();
    2.28              perfc_incrc(domain_page_tlb_flush);
    2.29              local_flush_tlb();
    2.30              shadow_epoch[cpu] = ++epoch;
    2.31 @@ -75,5 +89,5 @@ void unmap_domain_page(void *va)
    2.32      ASSERT((void *)MAPCACHE_VIRT_START <= va);
    2.33      ASSERT(va < (void *)MAPCACHE_VIRT_END);
    2.34      idx = ((unsigned long)va - MAPCACHE_VIRT_START) >> PAGE_SHIFT;
    2.35 -    mapcache[idx] = l1e_empty();
    2.36 +    l1e_add_flags(mapcache[idx], READY_FOR_TLB_FLUSH);
    2.37  }