Commit cd8ddf1a authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

x86: clflush_page_range needs mfence

clflush is an unordered operation with respect to other memory
traffic, including other CLFLUSH instructions. This needs proper
fencing with mfence.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent af1e6844
...@@ -25,12 +25,24 @@ within(unsigned long addr, unsigned long start, unsigned long end) ...@@ -25,12 +25,24 @@ within(unsigned long addr, unsigned long start, unsigned long end)
/* /*
* Flushing functions * 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) void clflush_cache_range(void *addr, int size)
{ {
int i; int i;
mb();
for (i = 0; i < size; i += boot_cpu_data.x86_clflush_size) for (i = 0; i < size; i += boot_cpu_data.x86_clflush_size)
clflush(addr+i); clflush(addr+i);
mb();
} }
static void __cpa_flush_all(void *arg) static void __cpa_flush_all(void *arg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment