[Intel-gfx] [PATCH] drm/i915: Don't clflush purged objects on unbind
chris at chris-wilson.co.uk
Wed Dec 9 01:01:18 PST 2009
On Tue, 08 Dec 2009 23:50:26 -0800, Eric Anholt <eric at anholt.net> wrote:
> On Tue, 8 Dec 2009 22:17:20 +0000, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > If the object is marked as purgeable and we are about to simply truncate
> > those pages, don't waste time by clearing the cache lines for the
> > object. In typical usage this saves around 10% of the clflushes.
> What I'm concerned about here is a dirtied object: you've now flushed
> the GPU cachelines to main memory, but the CPU might be sitting on some
> read cachelines (see the madness in the pread path for partial cpu read
> domain stuff, though speculation might also cause this).
> Could that get us into trouble somehow? I'm not exactly sure.
The difference is for an purgeable object we truncate the backing shmem
object on unbind, so any access to its pages is verboten. Any attempt to
rebind the object should generate an error.
During unbind, we simply take advantage of the knowledge that we are about
to destroy those pages a few lines further down to avoid some expensive
cache-line flushing. Before those (physical) pages can be used again the
kernel will zero them, so I think this passes at all paranoia levels.
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx