Tvrtko Ursulin <tvrtko.ursu...@linux.intel.com> writes:

> From: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
>
> Reference needs to be taken before arming the timer. Luckily, given the
> default timer period of 20s, the potential to hit the race is extremely
> unlikely.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
> Fixes: 9b4d0598ee94 ("drm/i915: Request watchdog infrastructure")
> Cc: Daniel Vetter <daniel.vet...@ffwll.ch>

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

> ---
> Test-with: 20210318162400.2065097-1-tvrtko.ursu...@linux.intel.com
> ---
>  drivers/gpu/drm/i915/i915_request.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_request.c 
> b/drivers/gpu/drm/i915/i915_request.c
> index 9165971c3c47..bec9c3652188 100644
> --- a/drivers/gpu/drm/i915/i915_request.c
> +++ b/drivers/gpu/drm/i915/i915_request.c
> @@ -350,6 +350,8 @@ static void __rq_arm_watchdog(struct i915_request *rq)
>       if (!ce->watchdog.timeout_us)
>               return;
>  
> +     i915_request_get(rq);
> +
>       hrtimer_init(&wdg->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>       wdg->timer.function = __rq_watchdog_expired;
>       hrtimer_start_range_ns(&wdg->timer,
> @@ -357,7 +359,6 @@ static void __rq_arm_watchdog(struct i915_request *rq)
>                                          NSEC_PER_USEC),
>                              NSEC_PER_MSEC,
>                              HRTIMER_MODE_REL);
> -     i915_request_get(rq);
>  }
>  
>  static void __rq_cancel_watchdog(struct i915_request *rq)
> -- 
> 2.27.0
>
> _______________________________________________
> Intel-gfx mailing list
> intel-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to