]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/xe: handle pinned memory in PM notifier
authorMatthew Auld <matthew.auld@intel.com>
Wed, 16 Apr 2025 15:09:17 +0000 (16:09 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Wed, 23 Apr 2025 08:32:16 +0000 (09:32 +0100)
commit7e3f4a352337f1ce09c1795b58be23dfab29e610
tree5ea666855750af896a4d0d10feb6f65c6f7436ef
parente28647b677789b51b2de3e7934bb86dbd8e67fdf
drm/xe: handle pinned memory in PM notifier

Userspace is still alive and kicking at this point so actually moving
pinned stuff here is tricky. However, we can instead pre-allocate the
backup storage upfront from the notifier, such that we scoop up as much
as we can, and then leave the final .suspend() to do the actual copy (or
allocate anything that we missed). That way the bulk of our allocations
will hopefully be done outside the more restrictive .suspend().

We do need to be extra careful though, since the pinned handling can now
race with PM notifier, like something becoming unpinned after we prepare
it from the notifier.

v2 (Thomas):
  - Fix kernel doc and drop the pin as soon as we are done with the
    restore, instead of deferring to later.

Suggested-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://lore.kernel.org/r/20250416150913.434369-8-matthew.auld@intel.com
drivers/gpu/drm/xe/xe_bo.c
drivers/gpu/drm/xe/xe_bo.h
drivers/gpu/drm/xe/xe_bo_evict.c
drivers/gpu/drm/xe/xe_bo_evict.h
drivers/gpu/drm/xe/xe_pm.c