drm/i915: Don't ERROR for an expected intel_rcs_ctx_init() interruption
diff mbox

Message ID 1453571673-29911-1-git-send-email-chris@chris-wilson.co.uk
State New
Headers show

Commit Message

Chris Wilson Jan. 23, 2016, 5:54 p.m. UTC
intel_rcs_ctx_init() can be interrupted by a signal (if it has to wait
upon a full ring to advance). Don't emit an error for this.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Dave Gordon Jan. 25, 2016, 6:25 p.m. UTC | #1
On 23/01/16 17:54, Chris Wilson wrote:
> intel_rcs_ctx_init() can be interrupted by a signal (if it has to wait
> upon a full ring to advance). Don't emit an error for this.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index b09abd754349..fb6bf4e2d3a1 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -730,9 +730,9 @@ static int intel_rcs_ctx_init(struct drm_i915_gem_request *req)
>
>   	ret = i915_gem_render_state_init(req);
>   	if (ret)
> -		DRM_ERROR("init render state: %d\n", ret);
> +		return ret;
>
> -	return ret;
> +	return 0;
>   }
>
>   static int wa_add(struct drm_i915_private *dev_priv,
>

If you're not going to test the error code locally, you can just do:

	return i915_gem_render_state_init(req);

.Dave.
Chris Wilson Jan. 25, 2016, 9:24 p.m. UTC | #2
On Mon, Jan 25, 2016 at 06:25:33PM +0000, Dave Gordon wrote:
> On 23/01/16 17:54, Chris Wilson wrote:
> >intel_rcs_ctx_init() can be interrupted by a signal (if it has to wait
> >upon a full ring to advance). Don't emit an error for this.
> >
> >Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >---
> >  drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> >index b09abd754349..fb6bf4e2d3a1 100644
> >--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> >+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> >@@ -730,9 +730,9 @@ static int intel_rcs_ctx_init(struct drm_i915_gem_request *req)
> >
> >  	ret = i915_gem_render_state_init(req);
> >  	if (ret)
> >-		DRM_ERROR("init render state: %d\n", ret);
> >+		return ret;
> >
> >-	return ret;
> >+	return 0;
> >  }
> >
> >  static int wa_add(struct drm_i915_private *dev_priv,
> >
> 
> If you're not going to test the error code locally, you can just do:
> 
> 	return i915_gem_render_state_init(req);

I can never decide which I prefer. If there is a a sequence, I continue
on using if(ret) return ret, since I prefer the consistent look. If I
just return blah(); and later come back and have to add another check, I
curse.

If it is a frequent path, then letting gcc see the tail call is
definitely worth it (if there is a chance for that tail call to
disappear!).
-Chris

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index b09abd754349..fb6bf4e2d3a1 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -730,9 +730,9 @@  static int intel_rcs_ctx_init(struct drm_i915_gem_request *req)
 
 	ret = i915_gem_render_state_init(req);
 	if (ret)
-		DRM_ERROR("init render state: %d\n", ret);
+		return ret;
 
-	return ret;
+	return 0;
 }
 
 static int wa_add(struct drm_i915_private *dev_priv,