ia64/xen-unstable

changeset 4357:f620c41a1fef

bitkeeper revision 1.1159.258.73 (424874035MwIUi8jFNCdaLfnJCrWig)

Fix cpu_relax/rep_nop to include a compiler barrier. This is needed
for SMP booting with gcc 4.0, for example.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Mar 28 21:15:47 2005 +0000 (2005-03-28)
parents 41b4061f42cb
children 6966b0183ab8 a5114e03a054
files xen/arch/x86/memory.c xen/arch/x86/setup.c xen/arch/x86/smp.c xen/arch/x86/smpboot.c xen/common/schedule.c xen/include/asm-x86/processor.h
line diff
     1.1 --- a/xen/arch/x86/memory.c	Mon Mar 28 17:51:38 2005 +0000
     1.2 +++ b/xen/arch/x86/memory.c	Mon Mar 28 21:15:47 2005 +0000
     1.3 @@ -904,10 +904,7 @@ int get_page_type(struct pfn_info *page,
     1.4          {
     1.5              /* Someone else is updating validation of this page. Wait... */
     1.6              while ( (y = page->u.inuse.type_info) == x )
     1.7 -            {
     1.8 -                rep_nop();
     1.9 -                barrier();
    1.10 -            }
    1.11 +                cpu_relax();
    1.12              goto again;
    1.13          }
    1.14      }
     2.1 --- a/xen/arch/x86/setup.c	Mon Mar 28 17:51:38 2005 +0000
     2.2 +++ b/xen/arch/x86/setup.c	Mon Mar 28 21:15:47 2005 +0000
     2.3 @@ -452,10 +452,7 @@ static void __init start_of_day(void)
     2.4      smp_threads_ready = 1;
     2.5      smp_commence(); /* Tell other CPUs that state of the world is stable. */
     2.6      while ( wait_init_idle != 0 )
     2.7 -    {
     2.8          cpu_relax();
     2.9 -        barrier();
    2.10 -    }
    2.11  #endif
    2.12  
    2.13      watchdog_on = 1;
     3.1 --- a/xen/arch/x86/smp.c	Mon Mar 28 17:51:38 2005 +0000
     3.2 +++ b/xen/arch/x86/smp.c	Mon Mar 28 21:15:47 2005 +0000
     3.3 @@ -239,10 +239,7 @@ void flush_tlb_mask(unsigned long mask)
     3.4          flush_cpumask = mask;
     3.5          send_IPI_mask(mask, INVALIDATE_TLB_VECTOR);
     3.6          while ( flush_cpumask != 0 )
     3.7 -        {
     3.8 -            rep_nop();
     3.9 -            barrier();
    3.10 -        }
    3.11 +            cpu_relax();
    3.12  
    3.13          spin_unlock(&flush_lock);
    3.14      }
    3.15 @@ -260,10 +257,7 @@ void new_tlbflush_clock_period(void)
    3.16          flush_cpumask = ((1 << smp_num_cpus) - 1) & ~(1 << smp_processor_id());
    3.17          send_IPI_allbutself(INVALIDATE_TLB_VECTOR);
    3.18          while ( flush_cpumask != 0 )
    3.19 -        {
    3.20 -            rep_nop();
    3.21 -            barrier();
    3.22 -        }
    3.23 +            cpu_relax();
    3.24          spin_unlock(&flush_lock);
    3.25      }
    3.26  
     4.1 --- a/xen/arch/x86/smpboot.c	Mon Mar 28 17:51:38 2005 +0000
     4.2 +++ b/xen/arch/x86/smpboot.c	Mon Mar 28 21:15:47 2005 +0000
     4.3 @@ -396,7 +396,7 @@ void __init start_secondary(void)
     4.4      smp_callin();
     4.5  
     4.6      while (!atomic_read(&smp_commenced))
     4.7 -        rep_nop();
     4.8 +        cpu_relax();
     4.9  
    4.10      /*
    4.11       * At this point, boot CPU has fully initialised the IDT. It is
     5.1 --- a/xen/common/schedule.c	Mon Mar 28 17:51:38 2005 +0000
     5.2 +++ b/xen/common/schedule.c	Mon Mar 28 21:15:47 2005 +0000
     5.3 @@ -166,10 +166,7 @@ void domain_sleep(struct domain *d)
     5.4   
     5.5      /* Synchronous. */
     5.6      while ( test_bit(DF_RUNNING, &d->flags) && !domain_runnable(d) )
     5.7 -    {
     5.8 -        smp_mb();
     5.9          cpu_relax();
    5.10 -    }
    5.11  }
    5.12  
    5.13  void domain_wake(struct domain *d)
     6.1 --- a/xen/include/asm-x86/processor.h	Mon Mar 28 17:51:38 2005 +0000
     6.2 +++ b/xen/include/asm-x86/processor.h	Mon Mar 28 21:15:47 2005 +0000
     6.3 @@ -571,10 +571,10 @@ struct extended_sigtable {
     6.4  /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
     6.5  static inline void rep_nop(void)
     6.6  {
     6.7 -    __asm__ __volatile__("rep;nop");
     6.8 +    __asm__ __volatile__ ( "rep;nop" : : : "memory" );
     6.9  }
    6.10  
    6.11 -#define cpu_relax()	rep_nop()
    6.12 +#define cpu_relax() rep_nop()
    6.13  
    6.14  /* Prefetch instructions for Pentium III and AMD Athlon */
    6.15  #ifdef 	CONFIG_MPENTIUMIII