Re: [PATCH] x86: Add an explicit barrier() to clflushopt()
From: Linus Torvalds
Date: Mon Jan 11 2016 - 15:11:13 EST
On Mon, Jan 11, 2016 at 3:28 AM, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote:
> diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
> index 6000ad7..cf074400 100644
> --- a/arch/x86/mm/pageattr.c
> +++ b/arch/x86/mm/pageattr.c
> @@ -141,6 +141,7 @@ void clflush_cache_range(void *vaddr, unsigned int size)
> for (; p < vend; p += clflush_size)
> + clflushopt(vend-1);
> works like a charm.
Have you checked all your callers? If the above makes a difference, it
really sounds like the caller has passed in a size of zero, resulting
in no cache flush, because the caller had incorrect ranges. The
additional clflushopt now flushes the previous cacheline that wasn't
flushed correctly before.
That "size was zero" thing would explain why changing the loop to "p
<= vend" also fixes things for you.
IOW, just how sure are you that all the ranges are correct?