]> err.no Git - linux-2.6/commitdiff
x86: clflush_page_range needs mfence
authorThomas Gleixner <tglx@linutronix.de>
Wed, 30 Jan 2008 12:34:08 +0000 (13:34 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:34:08 +0000 (13:34 +0100)
clflush is an unordered operation with respect to other memory
traffic, including other CLFLUSH instructions. This needs proper
fencing with mfence.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/pageattr.c

index cdd2ea2a2239609185131b730d93ff59d64229a2..90b658ac39c258871c70fac966034f658d89ee31 100644 (file)
@@ -25,12 +25,24 @@ within(unsigned long addr, unsigned long start, unsigned long end)
 /*
  * Flushing functions
  */
+
+
+/**
+ * clflush_cache_range - flush a cache range with clflush
+ * @addr:      virtual start address
+ * @size:      number of bytes to flush
+ *
+ * clflush is an unordered instruction which needs fencing with mfence
+ * to avoid ordering issues.
+ */
 void clflush_cache_range(void *addr, int size)
 {
        int i;
 
+       mb();
        for (i = 0; i < size; i += boot_cpu_data.x86_clflush_size)
                clflush(addr+i);
+       mb();
 }
 
 static void __cpa_flush_all(void *arg)