aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_ringbuffer.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-09-04 02:38:02 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2018-09-04 09:28:51 -0400
commit06348d3086a3b34f2db6c7692b4327fb7fc0b6c7 (patch)
treef15737e60f0a24bffc56a92e0e67f4bd589ff578 /drivers/gpu/drm/i915/intel_ringbuffer.c
parent7ef4ac6ed9eddd12c48020998d98647d2d85bdb1 (diff)
drm/i915/ringbuffer: Move double invalidate to after pd flush
Continuing the fun of trying to find exactly the delay that is sufficient to ensure that the page directory is fully loaded between context switches, move the extra flush added in commit 70b73f9ac113 ("drm/i915/ringbuffer: Delay after invalidating gen6+ xcs") to just after we flush the pd. Entirely based on the empirical data of running failing tests in a loop until we survive a day (before the mtbf is 10-30 minutes). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107769 References: 70b73f9ac113 ("drm/i915/ringbuffer: Delay after invalidating gen6+ xcs") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180904063802.13880-1-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 86604dd1c5a5..472939f5c18f 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1707,9 +1707,29 @@ static int switch_context(struct i915_request *rq)
1707 } 1707 }
1708 1708
1709 if (ppgtt) { 1709 if (ppgtt) {
1710 ret = engine->emit_flush(rq, EMIT_INVALIDATE);
1711 if (ret)
1712 goto err_mm;
1713
1710 ret = flush_pd_dir(rq); 1714 ret = flush_pd_dir(rq);
1711 if (ret) 1715 if (ret)
1712 goto err_mm; 1716 goto err_mm;
1717
1718 /*
1719 * Not only do we need a full barrier (post-sync write) after
1720 * invalidating the TLBs, but we need to wait a little bit
1721 * longer. Whether this is merely delaying us, or the
1722 * subsequent flush is a key part of serialising with the
1723 * post-sync op, this extra pass appears vital before a
1724 * mm switch!
1725 */
1726 ret = engine->emit_flush(rq, EMIT_INVALIDATE);
1727 if (ret)
1728 goto err_mm;
1729
1730 ret = engine->emit_flush(rq, EMIT_FLUSH);
1731 if (ret)
1732 goto err_mm;
1713 } 1733 }
1714 1734
1715 if (ctx->remap_slice) { 1735 if (ctx->remap_slice) {
@@ -1947,7 +1967,7 @@ static void gen6_bsd_submit_request(struct i915_request *request)
1947 intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); 1967 intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
1948} 1968}
1949 1969
1950static int emit_mi_flush_dw(struct i915_request *rq, u32 flags) 1970static int mi_flush_dw(struct i915_request *rq, u32 flags)
1951{ 1971{
1952 u32 cmd, *cs; 1972 u32 cmd, *cs;
1953 1973
@@ -1985,23 +2005,7 @@ static int emit_mi_flush_dw(struct i915_request *rq, u32 flags)
1985 2005
1986static int gen6_flush_dw(struct i915_request *rq, u32 mode, u32 invflags) 2006static int gen6_flush_dw(struct i915_request *rq, u32 mode, u32 invflags)
1987{ 2007{
1988 int err; 2008 return mi_flush_dw(rq, mode & EMIT_INVALIDATE ? invflags : 0);
1989
1990 /*
1991 * Not only do we need a full barrier (post-sync write) after
1992 * invalidating the TLBs, but we need to wait a little bit
1993 * longer. Whether this is merely delaying us, or the
1994 * subsequent flush is a key part of serialising with the
1995 * post-sync op, this extra pass appears vital before a
1996 * mm switch!
1997 */
1998 if (mode & EMIT_INVALIDATE) {
1999 err = emit_mi_flush_dw(rq, invflags);
2000 if (err)
2001 return err;
2002 }
2003
2004 return emit_mi_flush_dw(rq, 0);
2005} 2009}
2006 2010
2007static int gen6_bsd_ring_flush(struct i915_request *rq, u32 mode) 2011static int gen6_bsd_ring_flush(struct i915_request *rq, u32 mode)