Skip to content

Commit

Permalink
x86: clflush_page_range needs mfence
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Jan 30, 2008
1 parent af1e684 commit cd8ddf1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions arch/x86/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cd8ddf1

Please sign in to comment.