Commit:     4071c718555d955a35e9651f77086096ad87d498
Parent:     df1bdc0667eb3132fe60b3562347ca9133694ee0
Author:     Nick Piggin <[EMAIL PROTECTED]>
AuthorDate: Sat Oct 13 03:06:55 2007 +0200
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Oct 12 18:41:21 2007 -0700

    x86: fix IO write barrier
    wmb() on x86 must always include a barrier, because stores can go out of
    order in many cases when dealing with devices (eg. WC memory).
    Signed-off-by: Nick Piggin <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 include/asm-x86/system_32.h |   15 ++++++---------
 include/asm-x86/system_64.h |    6 +-----
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/include/asm-x86/system_32.h b/include/asm-x86/system_32.h
index d69ba93..8b15bd3 100644
--- a/include/asm-x86/system_32.h
+++ b/include/asm-x86/system_32.h
@@ -216,6 +216,7 @@ static inline unsigned long get_limit(unsigned long segment)
 #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)
 #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)
+#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)
  * read_barrier_depends - Flush all pending reads that subsequents reads
@@ -271,18 +272,14 @@ static inline unsigned long get_limit(unsigned long 
 #define read_barrier_depends() do { } while(0)
-/* Actually there are no OOO store capable CPUs for now that do SSE, 
-   but make it already an possibility. */
-#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)
-#define wmb()  __asm__ __volatile__ ("": : :"memory")
 #ifdef CONFIG_SMP
 #define smp_mb()       mb()
 #define smp_rmb()      rmb()
-#define smp_wmb()      wmb()
+# define smp_wmb()     wmb()
+# define smp_wmb()     barrier()
 #define smp_read_barrier_depends()     read_barrier_depends()
 #define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
diff --git a/include/asm-x86/system_64.h b/include/asm-x86/system_64.h
index 02175aa..eff730b 100644
--- a/include/asm-x86/system_64.h
+++ b/include/asm-x86/system_64.h
@@ -159,12 +159,8 @@ static inline void write_cr8(unsigned long val)
 #define mb()   asm volatile("mfence":::"memory")
 #define rmb()  asm volatile("lfence":::"memory")
 #define wmb()  asm volatile("sfence" ::: "memory")
-#define wmb()  asm volatile("" ::: "memory")
 #define read_barrier_depends() do {} while(0)
 #define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to