[PATCH 2/2] drm/xe_device: Evict all the VRAM objects during device remove
Aradhya Bhatia
aradhya.bhatia at intel.com
Fri Feb 28 06:52:24 UTC 2025
Now that xe's migrate subsystem is dev managed, instead of drm managed,
evict all the VRAM objects during the xe device remove.
The VRAM and TTM resource manager are drm managed, and so they are
destroyed when all the references to DRM are put. When that happens, the
VRAM and TTM resource managers evict all the BOs before their
destruction. Since the migrate subsystem will already be finished by
that point, the resource managers won't be able to evict the BOs
successfully.
Change that by preemptively evicting all the VRAM BOs during xe device
remove.
Signed-off-by: Aradhya Bhatia <aradhya.bhatia at intel.com>
---
drivers/gpu/drm/xe/xe_device.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 9454b51f7ad8..ef293552db6c 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -905,8 +905,22 @@ int xe_device_probe(struct xe_device *xe)
void xe_device_remove(struct xe_device *xe)
{
+ int ret;
+ u32 mem_type;
+
xe_display_unregister(xe);
+ for (mem_type = XE_PL_VRAM0; mem_type <= XE_PL_VRAM1; ++mem_type) {
+ struct ttm_resource_manager *man =
+ ttm_manager_type(&xe->ttm, mem_type);
+
+ if (man) {
+ ret = ttm_resource_manager_evict_all(&xe->ttm, man);
+ if (ret)
+ drm_err(&xe->drm, "VRAM evict failed! %d\n", ret);
+ }
+ }
+
drm_dev_unplug(&xe->drm);
}
--
2.45.2
More information about the Intel-xe
mailing list