Re: [PATCH 19/19] drm/i915: Use ww pinning for intel_context_create_request()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>-----Original Message-----
>From: Intel-gfx <intel-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of
>Maarten Lankhorst
>Sent: Friday, February 14, 2020 5:31 AM
>To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>Subject:  [PATCH 19/19] drm/i915: Use ww pinning for
>intel_context_create_request()
>
>We want to get rid of intel_context_pin(), convert
>intel_context_create_request() first. :)
>
>Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
>---
> drivers/gpu/drm/i915/gt/intel_context.c | 20 +++++++++++++++-----
> 1 file changed, 15 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/gt/intel_context.c
>b/drivers/gpu/drm/i915/gt/intel_context.c
>index 87f9f9e61916..44868b10be0a 100644
>--- a/drivers/gpu/drm/i915/gt/intel_context.c
>+++ b/drivers/gpu/drm/i915/gt/intel_context.c
>@@ -436,15 +436,25 @@ int intel_context_prepare_remote_request(struct
>intel_context *ce,
>
> struct i915_request *intel_context_create_request(struct intel_context *ce)
> {
>+	struct i915_gem_ww_ctx ww;
> 	struct i915_request *rq;
> 	int err;
>
>-	err = intel_context_pin(ce);
>-	if (unlikely(err))
>-		return ERR_PTR(err);
>+	i915_gem_ww_ctx_init(&ww, true);
>+retry:
>+	err = intel_context_pin_ww(ce, &ww);
>+	if (!err) {
>+		rq = i915_request_create(ce);
>+		intel_context_unpin(ce);
>+	} else if (err == -EDEADLK) {
>+		err = i915_gem_ww_ctx_backoff(&ww);
>+		if (!err)
>+			goto retry;
>+	} else {
>+		rq = ERR_PTR(err);
>+	}

If you have the pathological path:

err = intel_context_pin_ww(cd, &&))
	else if (err == -EDEADLK)
		err = i915_gem_ww_ctx_backoff(&ww) ; (where err != 0)

It appears that you can get to IS_ERR(rq) with rq being garbage from the
stack.

Do you need to preset rq, or set it on: 

if (!err)
	goto retry;
else
	rq = ERR_PTR(err);

?

Thanks,

Mike


>
>-	rq = i915_request_create(ce);
>-	intel_context_unpin(ce);
>+	i915_gem_ww_ctx_fini(&ww);
>
> 	if (IS_ERR(rq))
> 		return rq;
>--
>2.25.0.24.g3f081b084b0
>
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux