[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix cpu_relax/rep_nop to include a compiler barrier. This is needed



ChangeSet 1.1807, 2005/03/28 22:15:47+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        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@xxxxxxxxxxxxx>



 arch/x86/memory.c           |    5 +----
 arch/x86/setup.c            |    3 ---
 arch/x86/smp.c              |   10 ++--------
 arch/x86/smpboot.c          |    2 +-
 common/schedule.c           |    3 ---
 include/asm-x86/processor.h |    4 ++--
 6 files changed, 6 insertions(+), 21 deletions(-)


diff -Nru a/xen/arch/x86/memory.c b/xen/arch/x86/memory.c
--- a/xen/arch/x86/memory.c     2005-03-29 03:05:52 -05:00
+++ b/xen/arch/x86/memory.c     2005-03-29 03:05:52 -05:00
@@ -904,10 +904,7 @@
         {
             /* Someone else is updating validation of this page. Wait... */
             while ( (y = page->u.inuse.type_info) == x )
-            {
-                rep_nop();
-                barrier();
-            }
+                cpu_relax();
             goto again;
         }
     }
diff -Nru a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      2005-03-29 03:05:52 -05:00
+++ b/xen/arch/x86/setup.c      2005-03-29 03:05:52 -05:00
@@ -452,10 +452,7 @@
     smp_threads_ready = 1;
     smp_commence(); /* Tell other CPUs that state of the world is stable. */
     while ( wait_init_idle != 0 )
-    {
         cpu_relax();
-        barrier();
-    }
 #endif
 
     watchdog_on = 1;
diff -Nru a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c        2005-03-29 03:05:52 -05:00
+++ b/xen/arch/x86/smp.c        2005-03-29 03:05:52 -05:00
@@ -239,10 +239,7 @@
         flush_cpumask = mask;
         send_IPI_mask(mask, INVALIDATE_TLB_VECTOR);
         while ( flush_cpumask != 0 )
-        {
-            rep_nop();
-            barrier();
-        }
+            cpu_relax();
 
         spin_unlock(&flush_lock);
     }
@@ -260,10 +257,7 @@
         flush_cpumask = ((1 << smp_num_cpus) - 1) & ~(1 << smp_processor_id());
         send_IPI_allbutself(INVALIDATE_TLB_VECTOR);
         while ( flush_cpumask != 0 )
-        {
-            rep_nop();
-            barrier();
-        }
+            cpu_relax();
         spin_unlock(&flush_lock);
     }
 
diff -Nru a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    2005-03-29 03:05:52 -05:00
+++ b/xen/arch/x86/smpboot.c    2005-03-29 03:05:52 -05:00
@@ -396,7 +396,7 @@
     smp_callin();
 
     while (!atomic_read(&smp_commenced))
-        rep_nop();
+        cpu_relax();
 
     /*
      * At this point, boot CPU has fully initialised the IDT. It is
diff -Nru a/xen/common/schedule.c b/xen/common/schedule.c
--- a/xen/common/schedule.c     2005-03-29 03:05:52 -05:00
+++ b/xen/common/schedule.c     2005-03-29 03:05:52 -05:00
@@ -166,10 +166,7 @@
  
     /* Synchronous. */
     while ( test_bit(DF_RUNNING, &d->flags) && !domain_runnable(d) )
-    {
-        smp_mb();
         cpu_relax();
-    }
 }
 
 void domain_wake(struct domain *d)
diff -Nru a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h   2005-03-29 03:05:52 -05:00
+++ b/xen/include/asm-x86/processor.h   2005-03-29 03:05:52 -05:00
@@ -571,10 +571,10 @@
 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
 static inline void rep_nop(void)
 {
-    __asm__ __volatile__("rep;nop");
+    __asm__ __volatile__ ( "rep;nop" : : : "memory" );
 }
 
-#define cpu_relax()    rep_nop()
+#define cpu_relax() rep_nop()
 
 /* Prefetch instructions for Pentium III and AMD Athlon */
 #ifdef         CONFIG_MPENTIUMIII

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.