From: Daniel Vetter Subject: Re: [PATCH] drm/i915: correctly restore fences with objects attached Date: Thu, 18 Jul 2013 12:07:06 +0200 Message-ID: <20130718100706.GO4550@phenom.ffwll.local> References: <1374065488-4485-1-git-send-email-daniel.vetter@ffwll.ch> <20130717144416.GD5249@cantiga.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: <20130717144416.GD5249@cantiga.alporthouse.com> Sender: stable-owner@vger.kernel.org To: Chris Wilson , Daniel Vetter , Intel Graphics Development , =?iso-8859-1?Q?St=E9phane?= Marchesin , "for 3.10 only" List-Id: intel-gfx@lists.freedesktop.org On Wed, Jul 17, 2013 at 03:44:16PM +0100, Chris Wilson wrote: > On Wed, Jul 17, 2013 at 02:51:28PM +0200, Daniel Vetter wrote: > > To avoid stalls we delay tiling changes and especially hold of > > committing the new fence state for as long as possible. > > Synchronization points are in the execbuf code and in our gtt fault > > handler. > >=20 > > Unfortunately we've missed that tricky detail when adding proper fe= nce > > restore code in > >=20 > > commit 19b2dbde5732170a03bd82cc8bd442cf88d856f7 > > Author: Chris Wilson > > Date: Wed Jun 12 10:15:12 2013 +0100 > >=20 > > drm/i915: Restore fences after resume and GPU resets > >=20 > > The result was that we've restored fences for objects with no tilin= g, > > since the object<->fence link still existed after resume. Now that > > wouldn't have been too bad since any subsequent access would have > > fixed things up, but if we've changed from tiled to untiled real ha= voc > > happened: > >=20 > > The tiling stride is stored -1 in the fence register, so a stride o= f 0 > > resulted in all 1s in the top 32bits, and so a completely bogus fen= ce > > spanning everything from the start of the object to the top of the > > GTT. The tell-tale in the register dumps looks like: > >=20 > > FENCE START 2: 0x0214d001 > > FENCE END 2: 0xfffff3ff > >=20 > > Bit 11 isn't set since the hw doesn't store it, even when writing a= ll > > 1s (at least on my snb here). > >=20 > > To prevent such a gaffle in the future add a sanity check for fence= s > > with an untiled object attached in i915_gem_write_fence. > >=20 > > v2: Fix the WARN, spotted by Chris. > >=20 > > v3: Trying to reuse get_fences looked ugly and obfuscated the code. > > Instead reuse update_fence and to make it really dtrt also move the > > fence dirty state clearing into update_fence. > >=20 > > Cc: Chris Wilson > > Cc: St=E9phane Marchesin > > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D60530 > > Cc: stable@vger.kernel.org (for 3.10 only) > > Signed-off-by: Daniel Vetter >=20 > Sigh. I thought we were covered because before anything accessed this > dirty object, the fence would have been rewritten. However, Daniel > correctly points out that the stride=3D=3D0 fence clobbers the entire= GTT > and so may be used by the hardware in preference to any other fence. > Reviewed-by: Chris Wilson Picked up for -fixes, thanks for the review. -Daniel --=20 Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch