On 03/12/2026 08:53, Thomas Hellström wrote:
Pinned VRAM BOs are evicted at suspend by copying their contents to a
backup object, while the BOs themselves remain in VRAM. Pinned kernel
BOs are additionally moved to the evicted lists.

If suspend fails after some or all pinned BOs have been evicted, either
in xe_bo_evict_all() itself, for example due to -ENOMEM when allocating
a backup object, or in a later suspend step, nothing undoes this, and
the device continues operating with the stale backups. That causes:

- A subsequent suspend skipping the BOs on the evicted lists, and the
   following resume overwriting their VRAM contents with stale data.
- The backup objects of pinned external BOs being leaked through a
   reference cycle when the BOs are later unpinned.
- A subsequent PM notifier prepare step hitting the
   xe_assert(xe, !bo->backup_obj) in xe_bo_notifier_prepare_pinned().

This has been an issue since the initial driver. Before commit
86f69c26113c ("drm/xe: use backup object for pinned save/restore"),
pinned BOs were instead moved out of VRAM, and with a failed suspend,
the GuC would continue to access the freed VRAM through the GGTT while
the CPU would access the moved copy. This patch only addresses the
backup object scheme.

Add xe_bo_evict_all_undo() that drops the backup objects created by the
eviction and moves the pinned kernel BOs back to the present lists, and
call it on failure in xe_bo_evict_all() and on failures after
xe_bo_evict_all() in the system- and runtime suspend paths. Backup
objects pre-allocated by the PM notifier are kept and released as
usual by the notifier.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Fixes: 86f69c26113c ("drm/xe: use backup object for pinned save/restore")
Cc: Matthew Auld <[email protected]>
Cc: Satyanarayana K V P <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Rodrigo Vivi <[email protected]>
Cc: [email protected]
Cc: <[email protected]> # v6.16+
Signed-off-by: Thomas Hellström <[email protected]>

Reviewed-by: Matthew Auld <[email protected]>

Reply via email to