[PATCH 2/2] drm/xe: fix unbalanced rpm put() with declare_wedged()

Matthew Brost matthew.brost at intel.com
Tue Oct 8 17:14:11 UTC 2024


On Tue, Oct 08, 2024 at 11:47:25AM +0100, Matthew Auld wrote:
> Technically the or_reset() means we call the action on failure, however
> that would lead to unbalanced rpm put(). Move the get() earlier to fix
> this. It should be extremely unlikely to ever trigger this in practice.
> 
> Fixes: 452bca0edbd0 ("drm/xe: Don't suspend device upon wedge")
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> Cc: Nirmoy Das <nirmoy.das at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_device.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index cd241a8e1838..962751c966d1 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -1016,13 +1016,13 @@ void xe_device_declare_wedged(struct xe_device *xe)
>  		return;
>  	}
>  
> +	xe_pm_runtime_get_noresume(xe);
> +
>  	if (drmm_add_action_or_reset(&xe->drm, xe_device_wedged_fini, xe)) {
>  		drm_err(&xe->drm, "Failed to register xe_device_wedged_fini clean-up. Although device is wedged.\n");
>  		return;
>  	}
>  
> -	xe_pm_runtime_get_noresume(xe);
> -
>  	if (!atomic_xchg(&xe->wedged.flag, 1)) {
>  		xe->needs_flr_on_fini = true;
>  		drm_err(&xe->drm,
> -- 
> 2.46.2
> 


More information about the Intel-xe mailing list