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

Daniel Vetter daniel at ffwll.ch
Fri Dec 11 08:46:31 PST 2015


On Fri, Dec 11, 2015 at 09:02:18AM +0000, Chris Wilson wrote:
> 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.

Indeed lack of diff context made me all confused, I stand corrected. Looks
good.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list