diff mbox series

drm/i915/selftests: Take an explicit ref for rq->batch

Message ID 20200408091723.28937-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915/selftests: Take an explicit ref for rq->batch | expand

Commit Message

Chris Wilson April 8, 2020, 9:17 a.m. UTC
Since we are peeking into the batch object of the request, it is
beholden on us to hold a reference to it.

Closes: https://gitlab.freedesktop.org/drm/intel/issues/1634
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Mika Kuoppala April 8, 2020, 11:36 a.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> Since we are peeking into the batch object of the request, it is
> beholden on us to hold a reference to it.
>
> Closes: https://gitlab.freedesktop.org/drm/intel/issues/1634
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Follow the mon^H^H^H request.

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/gt/selftest_lrc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
> index 57db3d0ffaf2..616d03506c2c 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
> @@ -2655,7 +2655,7 @@ static int create_gang(struct intel_engine_cs *engine,
>  	if (IS_ERR(rq))
>  		goto err_obj;
>  
> -	rq->batch = vma;
> +	rq->batch = i915_vma_get(vma);
>  	i915_request_get(rq);
>  
>  	i915_vma_lock(vma);
> @@ -2679,6 +2679,7 @@ static int create_gang(struct intel_engine_cs *engine,
>  	return 0;
>  
>  err_rq:
> +	i915_vma_put(rq->batch);
>  	i915_request_put(rq);
>  err_obj:
>  	i915_gem_object_put(obj);
> @@ -2775,6 +2776,7 @@ static int live_preempt_gang(void *arg)
>  				err = -ETIME;
>  			}
>  
> +			i915_vma_put(rq->batch);
>  			i915_request_put(rq);
>  			rq = n;
>  		}
> -- 
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
index 57db3d0ffaf2..616d03506c2c 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -2655,7 +2655,7 @@  static int create_gang(struct intel_engine_cs *engine,
 	if (IS_ERR(rq))
 		goto err_obj;
 
-	rq->batch = vma;
+	rq->batch = i915_vma_get(vma);
 	i915_request_get(rq);
 
 	i915_vma_lock(vma);
@@ -2679,6 +2679,7 @@  static int create_gang(struct intel_engine_cs *engine,
 	return 0;
 
 err_rq:
+	i915_vma_put(rq->batch);
 	i915_request_put(rq);
 err_obj:
 	i915_gem_object_put(obj);
@@ -2775,6 +2776,7 @@  static int live_preempt_gang(void *arg)
 				err = -ETIME;
 			}
 
+			i915_vma_put(rq->batch);
 			i915_request_put(rq);
 			rq = n;
 		}