From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>,
Carlos Santa <carlos.santa@intel.com>
Subject: Re: [PATCH 2/2] drm/xe/pm: skip BO eviction on iGPU for non-hibernation sleep
Date: Fri, 06 Nov 2026 16:11:58 +0100 [thread overview]
Message-ID: <95fc1b6fd8dad1cf3ec620e1ef535a5ec9a391e1.camel@linux.intel.com> (raw)
In-Reply-To: <20261106-s4-opti-v1-2-5edaea2c6d31@intel.com>
On Fri, 2026-11-06 at 10:16 +0000, Matthew Auld wrote:
> On iGPU platforms, system RAM and graphics stolen memory remain
> powered
> during S2idle and S3 (< S4) suspend, so evicting user buffers or
> preparing pinned BOs is unnecessary and needlessly purges DONTNEED
> buffers in userspace caches.
>
> Distinguish S4 hibernation (.freeze and PM_HIBERNATION_PREPARE) from
> < S4 suspend (.suspend and PM_SUSPEND_PREPARE), and skip BO eviction
> on
> iGPU when not creating a hibernation image.
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Carlos Santa <carlos.santa@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
> drivers/gpu/drm/xe/xe_pci.c | 21 ++++++++++++++++++---
> drivers/gpu/drm/xe/xe_pm.c | 26 ++++++++++++++++++++------
> drivers/gpu/drm/xe/xe_pm.h | 2 +-
> 3 files changed, 39 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pci.c
> b/drivers/gpu/drm/xe/xe_pci.c
> index ba23ec60477b..67be6e707361 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -1335,7 +1335,7 @@ static void d3cold_toggle(struct pci_dev *pdev,
> enum toggle_d3cold toggle)
> }
> }
>
> -static int xe_pci_suspend(struct device *dev)
> +static int __xe_pci_suspend(struct device *dev, bool hibernate)
> {
> struct pci_dev *pdev = to_pci_dev(dev);
> struct xe_device *xe = pdev_to_xe_device(pdev);
> @@ -1344,7 +1344,7 @@ static int xe_pci_suspend(struct device *dev)
> if (xe_survivability_mode_is_boot_enabled(xe))
> return -EBUSY;
>
> - err = xe_pm_suspend(xe);
> + err = xe_pm_suspend(xe, hibernate);
> if (err)
> return err;
>
> @@ -1362,6 +1362,16 @@ static int xe_pci_suspend(struct device *dev)
> return 0;
> }
>
> +static int xe_pci_suspend(struct device *dev)
> +{
> + return __xe_pci_suspend(dev, false);
> +}
> +
> +static int xe_pci_freeze(struct device *dev)
> +{
> + return __xe_pci_suspend(dev, true);
> +}
> +
> static int xe_pci_resume(struct device *dev)
> {
> struct pci_dev *pdev = to_pci_dev(dev);
> @@ -1491,7 +1501,12 @@ static int xe_pci_runtime_idle(struct device
> *dev)
> }
>
> static const struct dev_pm_ops xe_pm_ops = {
> - SET_SYSTEM_SLEEP_PM_OPS(xe_pci_suspend, xe_pci_resume)
> + .suspend = pm_sleep_ptr(xe_pci_suspend),
> + .resume = pm_sleep_ptr(xe_pci_resume),
> + .freeze = pm_sleep_ptr(xe_pci_freeze),
> + .thaw = pm_sleep_ptr(xe_pci_resume),
> + .poweroff = pm_sleep_ptr(xe_pci_suspend),
> + .restore = pm_sleep_ptr(xe_pci_resume),
> SET_RUNTIME_PM_OPS(xe_pci_runtime_suspend,
> xe_pci_runtime_resume, xe_pci_runtime_idle)
> };
> #endif
> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> index 61d68c09189f..e73192b03074 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -166,13 +166,19 @@ static void xe_rpm_lockmap_release(const struct
> xe_device *xe)
> &xe_pm_runtime_d3cold_map);
> }
>
> +static bool xe_pm_needs_bo_evict(struct xe_device *xe, bool
> hibernate)
> +{
> + return IS_DGFX(xe) || hibernate;
> +}
> +
> /**
> - * xe_pm_suspend - Helper for System suspend, i.e. S0->S3 / S0-
> >S2idle
> + * xe_pm_suspend - Helper for System suspend, i.e. S0->S3 / S0-
> >S2idle / S0->S4
> * @xe: xe device instance
> + * @hibernate: true if preparing for S4 hibernation, false for < S4
> suspend
> *
> * Return: 0 on success
> */
> -int xe_pm_suspend(struct xe_device *xe)
> +int xe_pm_suspend(struct xe_device *xe, bool hibernate)
> {
> struct xe_gt *gt;
> u8 id;
> @@ -193,10 +199,12 @@ int xe_pm_suspend(struct xe_device *xe)
>
> xe_display_pm_suspend(xe);
>
> - /* FIXME: Super racey... */
> - err = xe_bo_evict_all(xe);
> - if (err)
> - goto err_display;
> + if (xe_pm_needs_bo_evict(xe, hibernate)) {
> + /* FIXME: Super racey... */
> + err = xe_bo_evict_all(xe);
> + if (err)
> + goto err_display;
> + }
>
> for_each_gt(gt, xe, id) {
> err = xe_gt_suspend(gt);
> @@ -461,6 +469,9 @@ static int xe_pm_notifier_callback(struct
> notifier_block *nb,
> struct xe_validation_ctx ctx;
>
> reinit_completion(&xe->pm_block);
> + if (!xe_pm_needs_bo_evict(xe, action ==
> PM_HIBERNATION_PREPARE))
> + break;
> +
> xe_pm_block_begin_signalling();
> xe_pm_runtime_get(xe);
> (void)xe_validation_ctx_init(&ctx, &xe->val, NULL,
> @@ -485,6 +496,9 @@ static int xe_pm_notifier_callback(struct
> notifier_block *nb,
> case PM_POST_SUSPEND:
> complete_all(&xe->pm_block);
> xe_pm_wake_rebind_workers(xe);
> + if (!xe_pm_needs_bo_evict(xe, action ==
> PM_POST_HIBERNATION))
> + break;
> +
> xe_bo_notifier_unprepare_all_pinned(xe);
> xe_pm_runtime_put(xe);
> break;
> diff --git a/drivers/gpu/drm/xe/xe_pm.h b/drivers/gpu/drm/xe/xe_pm.h
> index 16d4e6c629f1..af81f2a2975f 100644
> --- a/drivers/gpu/drm/xe/xe_pm.h
> +++ b/drivers/gpu/drm/xe/xe_pm.h
> @@ -13,7 +13,7 @@
>
> struct xe_device;
>
> -int xe_pm_suspend(struct xe_device *xe);
> +int xe_pm_suspend(struct xe_device *xe, bool hibernate);
> int xe_pm_resume(struct xe_device *xe);
>
> int xe_pm_init_early(struct xe_device *xe);
next prev parent reply other threads:[~2026-11-06 15:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 10:16 [PATCH 0/2] Optimise suspend handling for CCS igpu platforms Matthew Auld
2026-11-06 10:16 ` [PATCH 1/2] drm/xe: only evict CCS buffers from TT on iGPU Matthew Auld
2026-11-06 10:50 ` sashiko-bot
2026-11-06 11:34 ` Matthew Auld
2026-11-06 15:07 ` Thomas Hellström
2026-11-06 10:16 ` [PATCH 2/2] drm/xe/pm: skip BO eviction on iGPU for non-hibernation sleep Matthew Auld
2026-11-06 10:31 ` sashiko-bot
2026-11-06 10:32 ` Thomas Hellström
2026-11-06 11:02 ` Matthew Auld
2026-11-06 13:16 ` Matthew Auld
2026-11-06 15:11 ` Thomas Hellström [this message]
2026-11-06 17:07 ` Ville Syrjälä
2026-11-09 9:31 ` Matthew Auld
2026-11-06 11:06 ` ✓ CI.KUnit: success for Optimise suspend handling for CCS igpu platforms Patchwork
2026-11-06 11:40 ` ✓ Xe.CI.BAT: " 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=95fc1b6fd8dad1cf3ec620e1ef535a5ec9a391e1.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=carlos.santa@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--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