[Intel-xe] [PATCH] drm/xe: Fix an invalid locking wait context bug

Matthew Brost matthew.brost at intel.com
Wed Jul 19 21:14:09 UTC 2023


On Wed, Jul 19, 2023 at 03:27:26PM -0400, Rodrigo Vivi wrote:
> xe_irq_{suspend,resume} were incorrectly using the xe->irq.lock.
> 
> The lock was created to protect the gt irq handlers, and not
> the irq.enabled. Since suspend/resume and other places touching
> irq.enabled are already serialized they don't need protection.
> (see other irq.enabled accesses).
> 
> Then with this spin lock around xe_irq_reset, we will end up
> calling the intel_display_power_is_enabled() function, and
> that needs a mutex lock. Hence causing the undesired
> "[ BUG: Invalid wait context ]"
> 
> Cc: Matthew Auld <matthew.auld at intel.com>

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

> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_irq.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
> index eae190cb0969..df01af780a57 100644
> --- a/drivers/gpu/drm/xe/xe_irq.c
> +++ b/drivers/gpu/drm/xe/xe_irq.c
> @@ -574,10 +574,8 @@ void xe_irq_shutdown(struct xe_device *xe)
>  
>  void xe_irq_suspend(struct xe_device *xe)
>  {
> -	spin_lock_irq(&xe->irq.lock);
>  	xe->irq.enabled = false;
>  	xe_irq_reset(xe);
> -	spin_unlock_irq(&xe->irq.lock);
>  }
>  
>  void xe_irq_resume(struct xe_device *xe)
> @@ -585,13 +583,10 @@ void xe_irq_resume(struct xe_device *xe)
>  	struct xe_gt *gt;
>  	int id;
>  
> -	spin_lock_irq(&xe->irq.lock);
>  	xe->irq.enabled = true;
>  	xe_irq_reset(xe);
>  	xe_irq_postinstall(xe);
>  
>  	for_each_gt(gt, xe, id)
>  		xe_irq_enable_hwe(gt);
> -
> -	spin_unlock_irq(&xe->irq.lock);
>  }
> -- 
> 2.41.0
> 


More information about the Intel-xe mailing list