[Intel-gfx] [PATCH] drm/i915/selftests: Provide full mb() around clflush

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 6 20:27:47 UTC 2018


Quoting Rodrigo Vivi (2018-07-06 21:23:00)
> On Fri, Jul 06, 2018 at 06:49:26PM +0100, Chris Wilson wrote:
> > clflush is an unserialised instruction and the IA manual strongly advises
> > you to serialise it with a mb. To be cautious, apply one before and one
> > after,
> 
> my understanding is that we need one before and one after anyways,
> not just a matter of being cautious for being cautious..
> 
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

If you are really careful, you can reduce it to a mb between writes and
the clflush; and vice verse, the mb between clflush and subsequent
reads. It's all about prevent the clflush from overtaking or being
overtaken by the operations it is meant to flush or invalidate
respectively.

But since we're being paranoid here, do both.
-Chris


More information about the Intel-gfx mailing list