Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Bai, Zongyao" <zongyao.bai@intel.com>
To: <sashiko-reviews@lists.linux.dev>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2 2/3] drm/xe/forcewake: flush delayed release at power and teardown boundaries
Date: Mon, 16 Nov 2026 14:54:26 -0800	[thread overview]
Message-ID: <128971ca-ffee-458b-bf9e-2ca0dfe551c7@intel.com> (raw)
In-Reply-To: <sashiko-outbox-207828@kernel.org>


On 11/10/2026 2:26 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] drm/xe/forcewake: delayed domains stranded if runtime suspend
>    aborts
> --
>
> commit f7553aeb9060950e90243740fda0d4e4ec003892
> Author: Zongyao Bai <zongyao.bai@intel.com>
>
> drm/xe/forcewake: flush delayed release at power and teardown boundaries
>
> This commit adds xe_force_wake_flush() and xe_force_wake_stop() to cancel
> delayed forcewake releases and put delayed domains to sleep across suspend,
> shutdown, and device removal paths.
>
>> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
>> index 5ed96807fe342..a0a238f1a4515 100644
>> --- a/drivers/gpu/drm/xe/xe_gt.c
>> +++ b/drivers/gpu/drm/xe/xe_gt.c
> [ ... ]
>
>> @@ -1104,7 +1106,7 @@ int xe_gt_runtime_suspend(struct xe_gt *gt)
>>   {
>>   	xe_gt_dbg(gt, "runtime suspending\n");
>>   
>> -	CLASS(xe_force_wake, fw_ref)(gt_to_fw(gt), XE_FORCEWAKE_ALL);
>> +	CLASS(xe_force_wake_flush, fw_ref)(gt_to_fw(gt), XE_FORCEWAKE_ALL);
>>   	if (!xe_force_wake_ref_has_domain(fw_ref.domains, XE_FORCEWAKE_ALL)) {
>>   		xe_gt_err(gt, "runtime suspend failed (%pe)\n", ERR_PTR(-ETIMEDOUT));
>>   		return -ETIMEDOUT;
> [Severity: Medium]
> Can an aborted runtime suspend leave fw->delayed_domains awake with no
> worker pending?
>
> Once rpm_suspend() sets the device status to RPM_SUSPENDING,
> xe_pm_runtime_get_if_active() returns false, so
> xe_force_wake_delayed_release_work() exits early without sleeping
> fw->delayed_domains or requeuing itself, relying on the suspend flush here
> and in xe_gt_suspend().
>
> However, xe_pm_runtime_suspend() can fail before reaching this flush on all
> GTs:
>
> drivers/gpu/drm/xe/xe_pm.c:xe_pm_runtime_suspend() {
> 	...
> 	if (xe->d3cold.allowed) {
> 		err = xe_bo_evict_all(xe);
> 		if (err)
> 			goto out_resume;
> 	}
>
> 	for_each_gt(gt, xe, id) {
> 		err = xe->d3cold.allowed ? xe_gt_suspend(gt) : xe_gt_runtime_suspend(gt);
> 		if (err)
> 			goto out_resume;
> 	}
> 	...
> }
>
> If xe_bo_evict_all() fails, or an earlier GT fails in the loop, rpm_suspend()
> restores the device status to RPM_ACTIVE without flushing the remaining GTs.
> Any domain in fw->delayed_domains whose worker ran during the RPM_SUSPENDING
> window then stays awake with ref == 0 and delayed_release_work inactive,
> violating the DELAYED HOLD invariant documented in struct xe_force_wake and
> preventing GT C6 power saving until a later forcewake access or suspend.

This issue is caused by [patch 1/3], will fixed in that commit, and 
leave this patch the same.


>

  reply	other threads:[~2026-11-16 22:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-17  3:18 [PATCH 0/3] drm/xe/forcewake: add delayed release for engine-cycle queries Zongyao Bai
2026-10-17  3:18 ` [PATCH 1/3] drm/xe/forcewake: add delayed release with hysteresis Zongyao Bai
2026-11-09 20:55   ` Rodrigo Vivi
2026-11-10  1:00     ` Bai, Zongyao
2026-10-17  3:18 ` [PATCH 2/3] drm/xe/forcewake: flush delayed release at power and teardown boundaries Zongyao Bai
2026-10-17  3:18 ` [PATCH 3/3] drm/xe/query: use delayed forcewake release for engine-cycle queries Zongyao Bai
2026-10-17  3:25 ` ✗ CI.checkpatch: warning for drm/xe/forcewake: add delayed " Patchwork
2026-10-17  3:27 ` ✓ CI.KUnit: success " Patchwork
2026-10-17  3:27 ` [PATCH 0/3] " Simon Richter
2026-10-17  4:07 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-10-17  5:48 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-10 22:05 ` [PATCH v2 0/3] " Zongyao Bai
2026-11-10 22:05   ` [PATCH v2 1/3] drm/xe/forcewake: add delayed release with hysteresis Zongyao Bai
2026-11-10 22:34     ` sashiko-bot
2026-11-16 22:51       ` Bai, Zongyao
2026-11-10 22:05   ` [PATCH v2 2/3] drm/xe/forcewake: flush delayed release at power and teardown boundaries Zongyao Bai
2026-11-10 22:26     ` sashiko-bot
2026-11-16 22:54       ` Bai, Zongyao [this message]
2026-11-10 22:05   ` [PATCH v2 3/3] drm/xe/query: use delayed forcewake release for engine-cycle queries Zongyao Bai
2026-11-17  0:28 ` [PATCH v3 0/3] drm/xe/forcewake: add delayed " Zongyao Bai
2026-11-17  0:28   ` [PATCH v3 1/3] drm/xe/forcewake: add delayed release with hysteresis Zongyao Bai
2026-11-17  0:28   ` [PATCH v3 2/3] drm/xe/forcewake: flush delayed release at power and teardown boundaries Zongyao Bai
2026-11-17  0:28   ` [PATCH v3 3/3] drm/xe/query: use delayed forcewake release for engine-cycle queries Zongyao Bai

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=128971ca-ffee-458b-bf9e-2ca0dfe551c7@intel.com \
    --to=zongyao.bai@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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