From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH] drm/i915: Gracefully handle obj not bound to GGTT in is_pin_display Date: Mon, 12 May 2014 18:11:18 +0200 Message-ID: <20140512161118.GH25056@phenom.ffwll.local> References: <1396462861-16396-1-git-send-email-oscar.mateo@intel.com> <20140403093450.GC7225@phenom.ffwll.local> <92648605EABDA246B775AAB04C95A7A3012ED004@IRSMSX103.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 232516E53D for ; Mon, 12 May 2014 09:11:22 -0700 (PDT) Received: by mail-wg0-f41.google.com with SMTP id z12so7219381wgg.24 for ; Mon, 12 May 2014 09:11:22 -0700 (PDT) Content-Disposition: inline In-Reply-To: <92648605EABDA246B775AAB04C95A7A3012ED004@IRSMSX103.ger.corp.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: "Mateo Lozano, Oscar" Cc: "intel-gfx@lists.freedesktop.org" List-Id: intel-gfx@lists.freedesktop.org On Mon, May 12, 2014 at 09:05:45AM +0000, Mateo Lozano, Oscar wrote: > Hi Daniel, > > Sorry, this fell through the cracks: > > > Subject: Re: [Intel-gfx] [PATCH] drm/i915: Gracefully handle obj not bound to > > GGTT in is_pin_display > > > > On Wed, Apr 02, 2014 at 07:21:01PM +0100, oscar.mateo@intel.com wrote: > > > From: Oscar Mateo > > > > > > Otherwise, we do a NULL pointer dereference. > > > > > > I've seen this happen while handling an error in > > > i915_gem_object_pin_to_display_plane(): > > > > > > If i915_gem_object_set_cache_level() fails, we call is_pin_display() > > > to handle the error. At this point, the object is still not pinned to > > > GGTT and maybe not even bound, so we have to check before we > > > dereference its GGTT vma. > > > > > > Issue: VIZ-3772 > > > Signed-off-by: Oscar Mateo > > > > Have you looked into provoking this with an igt testcase? On a hunch a busy > > load (to extend the race window) plus the usual interruptor trick to jump out of > > wait_seqno calls should be able to make this go kaboom on command. But I > > haven't analyzed the bug in detail. > > AFAICT, the only sequence where this likely to happen (because we are handling a recently created object) is: > > intelfb_alloc -> intel_pin_and_fence_fb_obj -> i915_gem_object_pin_to_display_plane -> i915_gem_object_set_cache_level -> is_pin_display Pageflipping to a freshly allocated BO without ever touching it beforehand should be able to achive the same. If this is really all that's needed. But looking at the code a better way should be: 1. Create new bo, wrap it in a kms fb. 2. Slap busy load onto that bo, e.g. reapeatedly fill it with the blitter. 3. Enable evil interruptor (igt_fork_signal_helper). 4. Submit pageflip -> Boom since the set_cache_level will block, get interrupted and exit early with -EINTR. Given sufficient overkill in 2. this should be 100% reliable to reproduce. Cheers, Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch