Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/xe: Do not wake device during a GT reset
Date: Wed, 22 Oct 2025 11:03:37 +0100	[thread overview]
Message-ID: <ff2a8329-3c4d-4e58-b146-82242c4d549c@intel.com> (raw)
In-Reply-To: <20251022005538.828980-3-matthew.brost@intel.com>

On 22/10/2025 01:55, Matthew Brost wrote:
> Waking the device during a GT reset can lead to unintended memory
> allocation, which is not allowed since GT resets occur in the reclaim
> path. Prevent this by holding a PM reference while a reset is in flight.
> 
> Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Matthew Auld <matthew.auld@intel.com>


> ---
>   drivers/gpu/drm/xe/xe_gt.c | 19 ++++++++++++-------
>   1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
> index d8e94fb8b9bd..89808b33d0a8 100644
> --- a/drivers/gpu/drm/xe/xe_gt.c
> +++ b/drivers/gpu/drm/xe/xe_gt.c
> @@ -818,17 +818,19 @@ static int gt_reset(struct xe_gt *gt)
>   	unsigned int fw_ref;
>   	int err;
>   
> -	if (xe_device_wedged(gt_to_xe(gt)))
> -		return -ECANCELED;
> +	if (xe_device_wedged(gt_to_xe(gt))) {
> +		err = -ECANCELED;
> +		goto err_pm_put;
> +	}
>   
>   	/* We only support GT resets with GuC submission */
> -	if (!xe_device_uc_enabled(gt_to_xe(gt)))
> -		return -ENODEV;
> +	if (!xe_device_uc_enabled(gt_to_xe(gt))) {
> +		err = -ENODEV;
> +		goto err_pm_put;
> +	}
>   
>   	xe_gt_info(gt, "reset started\n");
>   
> -	xe_pm_runtime_get(gt_to_xe(gt));
> -
>   	if (xe_fault_inject_gt_reset()) {
>   		err = -ECANCELED;
>   		goto err_fail;
> @@ -875,6 +877,7 @@ static int gt_reset(struct xe_gt *gt)
>   	xe_gt_err(gt, "reset failed (%pe)\n", ERR_PTR(err));
>   
>   	xe_device_declare_wedged(gt_to_xe(gt));
> +err_pm_put:
>   	xe_pm_runtime_put(gt_to_xe(gt));
>   
>   	return err;
> @@ -896,7 +899,9 @@ void xe_gt_reset_async(struct xe_gt *gt)
>   		return;
>   
>   	xe_gt_info(gt, "reset queued\n");
> -	queue_work(gt->ordered_wq, &gt->reset.worker);
> +	xe_pm_runtime_get_noresume(gt_to_xe(gt));
> +	if (!queue_work(gt->ordered_wq, &gt->reset.worker))
> +		xe_pm_runtime_put(gt_to_xe(gt));
>   }
>   
>   void xe_gt_suspend_prepare(struct xe_gt *gt)


  reply	other threads:[~2025-10-22 10:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22  0:55 [PATCH 0/3] Fix low hanging workqueue / reclaim issues Matthew Brost
2025-10-22  0:55 ` [PATCH 1/3] drm/xe: Check return value of GGTT workqueue allocation Matthew Brost
2025-10-22  9:54   ` Matthew Auld
2025-10-22  0:55 ` [PATCH 2/3] drm/xe: Do not wake device during a GT reset Matthew Brost
2025-10-22 10:03   ` Matthew Auld [this message]
2025-10-22  0:55 ` [PATCH 3/3] drm/xe: Avoid PM wake reference during VF migration Matthew Brost
2025-10-22 10:08   ` Matthew Auld
2025-10-22  2:32 ` ✓ CI.KUnit: success for Fix low hanging workqueue / reclaim issues Patchwork
2025-10-22  4:20 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-22  6:24 ` ✓ Xe.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff2a8329-3c4d-4e58-b146-82242c4d549c@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox