WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Fix cpu_relax/rep_nop to include a compiler barrier. Thi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix cpu_relax/rep_nop to include a compiler barrier. This is needed
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Mon, 28 Mar 2005 21:15:47 +0000
Delivery-date: Tue, 29 Mar 2005 08:05:55 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>