Intel-XE Archive on 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 2/2] drm/xe: Poll GT for C6 before D3
Date: Wed, 09 Sep 2026 01:53:43 +0000	[thread overview]
Message-ID: <20260909015343.CE12A1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260909013712.1962521-2-vinay.belgaumkar@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Returning -EAGAIN from xe_pci_runtime_suspend() without rolling back the successful xe_pm_runtime_suspend() call leaves the hardware permanently suspended while the PM core believes the device is active.
- [High] wait_for_gt_c6_state() dereferences a NULL idle_status pointer when executed on SR-IOV Virtual Functions.
--

commit 5290095cf4ef101ed42731b369d55f98f9bbeaa1
Author: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

drm/xe: Poll GT for C6 before D3

This commit adds a check before transitioning to D3 to ensure GTs are in the
C6 state. If the GT is not in C6, it returns -EAGAIN to allow the PM
subsystem to retry, preventing component access during forced D3 state.

> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
[ ... ]
> @@ -1377,10 +1378,25 @@ static int xe_pci_resume(struct device *dev)
>  	return 0;
>  }
>  
> +static int wait_for_gt_c6_state(struct xe_gt *gt,
> +				int timeout_ms)
> +{
> +	struct xe_guc_pc *pc = &gt->uc.guc.pc;
> +	enum xe_gt_idle_state state;
> +
> +	return poll_timeout_us(state = gt->gtidle.idle_status(pc),

[Severity: High]
Is it possible for this to dereference a NULL pointer for SR-IOV Virtual
Functions?

If IS_SRIOV_VF(xe) is true, initialization is skipped in xe_gt_idle_init(),
leaving the gtidle->idle_status function pointer NULL. The
xe_assert(xe, !IS_SRIOV_VF(xe)) in xe_pci_runtime_suspend() only emits a
warning in debug builds (or acts as a no-op in production builds) and does
not halt execution, allowing a VF to reach this unconditional dereference
in wait_for_gt_c6_state().

> +			       state == GT_IDLE_C6,
> +			       20,
> +			       timeout_ms * USEC_PER_MSEC,
> +			       false);
> +}
> +
>  static int xe_pci_runtime_suspend(struct device *dev)
>  {
[ ... ]
> @@ -1396,6 +1412,14 @@ static int xe_pci_runtime_suspend(struct device *dev)
>  	if (err)
>  		return err;
>  
> +	/* Poll and retry if we don't enter C6 on any GT */
> +	for_each_gt(gt, xe, id) {
> +		if (wait_for_gt_c6_state(gt, 200)) {
> +			xe_gt_info(gt, "GT is not in C6\n");
> +			return -EAGAIN;

[Severity: High]
Could returning -EAGAIN here leave the hardware permanently suspended while
the PM core believes the device is active?

The driver successfully suspends multiple hardware components (display, GTs,
IRQs) earlier in xe_pci_runtime_suspend() via xe_pm_runtime_suspend().
However, returning -EAGAIN here aborts the PM core transition, leaving the
device status as RPM_ACTIVE.

The PM core will not invoke the resume callback, and subsequent driver
operations will attempt to access powered-down hardware. Should this call
xe_pm_runtime_resume() to roll back the successful suspend operations before
returning?

> +		}
> +	}
> +
>  	pci_save_state(pdev);

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

  reply	other threads:[~2026-09-09  1:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  1:37 [PATCH 1/2] drm/xe: Inspect all forcewake bits for runtime idleness Vinay Belgaumkar
2026-09-09  1:37 ` [PATCH 2/2] drm/xe: Poll GT for C6 before D3 Vinay Belgaumkar
2026-09-09  1:53   ` sashiko-bot [this message]
2026-09-10  0:48     ` Belgaumkar, Vinay
2026-09-09  1:50 ` ✓ CI.KUnit: success for series starting with [1/2] drm/xe: Inspect all forcewake bits for runtime idleness Patchwork
2026-09-09  1:56 ` [PATCH 1/2] " sashiko-bot
2026-09-10  0:47   ` Belgaumkar, Vinay
2026-09-09  2:26 ` ✓ Xe.CI.BAT: success for series starting with [1/2] " Patchwork
2026-09-09 10:17 ` ✗ 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=20260909015343.CE12A1F00A3A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox