All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vinay Belgaumkar" <vinay.belgaumkar@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3 2/2] drm/xe: Poll GT for C6 before D3
Date: Thu, 10 Sep 2026 22:11:12 +0000	[thread overview]
Message-ID: <20260910221112.9970E1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260910215756.2393137-2-vinay.belgaumkar@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The system PM suspend abort path incorrectly uses runtime PM resume (`xe_pm_runtime_resume`), leaving the device hardware uninitialized, leaking PCI D3Cold configuration, and violating power management context separation rules.
--

commit 30b6702ddd1d3cfed0a5d047a525e3df63d91571
Author: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

drm/xe: Poll GT for C6 before D3

Check if GTs are in C6 before transitioning to D3. PM subsystem can
retry if this is not the case. This ensures some component is not
accessing the GT when D3 state is forced. This check can be added
to the runtime idle check since it helps to check for pending
forcewakes as well before we poll for GT C6.

Cc: Badal Nilawar <badal.nilawar@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

[ ... ]
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 278cfd390364c..e663cddcb9946 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -1326,7 +1326,7 @@ static int xe_pci_suspend(struct device *dev)
>  {
>  	struct pci_dev *pdev = to_pci_dev(dev);
>  	struct xe_device *xe = pdev_to_xe_device(pdev);
> -	int err;
> +	int err, ret;
>  
>  	if (xe_survivability_mode_is_boot_enabled(xe))
>  		return -EBUSY;
> @@ -1342,6 +1342,17 @@ static int xe_pci_suspend(struct device *dev)
>  	 */
>  	d3cold_toggle(pdev, D3COLD_ENABLE);
>  
> +	ret = xe_pm_check_runtime_idle(xe);
> +	if (ret) {
> +		err = xe_pm_runtime_resume(xe);

[Severity: High]
Does this error path leave the hardware in a broken, partially-suspended
state?

When xe_pm_check_runtime_idle() fails and aborts the system suspend, it calls
xe_pm_runtime_resume() to recover. However, xe_pm_runtime_resume() uses the
runtime PM flag xe->d3cold.allowed to conditionally skip critical
reinitialization steps:

drivers/gpu/drm/xe/xe_pm.c:xe_pm_runtime_resume() {
    ...
	if (xe->d3cold.allowed) {
		for_each_gt(gt, xe, id)
			xe_gt_idle_disable_c6(gt);
    ...
		err = xe_bo_restore_early(xe);
    ...
}

Because the device was fully suspended via xe_pm_suspend() earlier in
xe_pci_suspend(), bypassing these steps if xe->d3cold.allowed is false leaves
memory unrestored and the GT incorrectly suspended. Should system PM recovery
instead use system PM resume functions that do not rely on runtime PM flags?

> +		if (err) {
> +			drm_err(&xe->drm, "Resume failed after suspend was canceled");
> +			return err;
> +		}
> +
> +		return ret;

[Severity: High]
Could this exit path be leaving the device with incorrect D3Cold
configuration? 

The suspend function calls d3cold_toggle(pdev, D3COLD_ENABLE) just before the
idle check, but returns here without calling d3cold_toggle(pdev, D3COLD_DISABLE)
to revert the toggle when the suspend is aborted.

> +	}
> +
>  	pci_save_state(pdev);
>  	pci_disable_device(pdev);
>  	pci_set_power_state(pdev, PCI_D3cold);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910215756.2393137-1-vinay.belgaumkar@intel.com?part=2

  reply	other threads:[~2026-09-10 22:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 21:57 [PATCH v3 1/2] drm/xe: Inspect all forcewake bits for runtime idleness Vinay Belgaumkar
2026-09-10 21:57 ` [PATCH v3 2/2] drm/xe: Poll GT for C6 before D3 Vinay Belgaumkar
2026-09-10 22:11   ` sashiko-bot [this message]
2026-09-10 22:14 ` [PATCH v3 1/2] drm/xe: Inspect all forcewake bits for runtime idleness sashiko-bot
2026-09-10 22:18 ` ✗ CI.checkpatch: warning for series starting with [v3,1/2] " Patchwork
2026-09-10 22:20 ` ✓ CI.KUnit: success " Patchwork
2026-09-10 23:13 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-11  7:46 ` ✗ Xe.CI.FULL: failure " 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=20260910221112.9970E1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vinay.belgaumkar@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.