[Intel-gfx] [PATCH 3/3] drm/i915: Prevent leaking of -EIO from i915_wait_request()

Chris Wilson chris at chris-wilson.co.uk
Fri Dec 11 01:02:18 PST 2015


On Thu, Dec 03, 2015 at 10:14:54AM +0100, Daniel Vetter wrote:
> On Tue, Dec 01, 2015 at 11:05:35AM +0000, Chris Wilson wrote:
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 4447e73b54db..73c61b94f7fd 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -13315,23 +13309,15 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,
> >  
> >  			ret = __i915_wait_request(intel_plane_state->wait_req,
> >  						  true, NULL, NULL);
> > -
> > -			/* Swallow -EIO errors to allow updates during hw lockup. */
> > -			if (ret == -EIO)
> > -				ret = 0;
> > -
> > -			if (ret)
> > +			if (ret) {
> > +				mutex_lock(&dev->struct_mutex);
> > +				drm_atomic_helper_cleanup_planes(dev, state);
> > +				mutex_unlock(&dev->struct_mutex);
> >  				break;
> > +			}
> >  		}
> > -
> > -		if (!ret)
> > -			return 0;
> > -
> > -		mutex_lock(&dev->struct_mutex);
> > -		drm_atomic_helper_cleanup_planes(dev, state);
> >  	}
> >  
> > -	mutex_unlock(&dev->struct_mutex);
> 
> Sneaking in lockless waits! Separate patch please.

No, it is just badly written code. The wait is already lockless but the
lock is dropped and retaken around the error paths in such a manner that
you cannot see this from a glimpse.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list