[Intel-xe] [PATCH 2/5] drm/xe: Add debugfs files to evict everything.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Fri May 26 12:10:58 UTC 2023


Easy for testing, when you just want your BO evicted.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 drivers/gpu/drm/xe/xe_debugfs.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
index 7827a785b020..0a2f1becb5c6 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_debugfs.c
@@ -94,6 +94,15 @@ static const struct file_operations forcewake_all_fops = {
 	.release = forcewake_release,
 };
 
+static int evict(void *data, u64 val)
+{
+	struct ttm_resource_manager *man = data;
+
+	return ttm_resource_manager_evict_all(man->bdev, man);
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(evict_all_fops, NULL, evict, "%lld\n");
+
 void xe_debugfs_register(struct xe_device *xe)
 {
 	struct ttm_device *bdev = &xe->ttm;
@@ -119,15 +128,21 @@ void xe_debugfs_register(struct xe_device *xe)
 
 			sprintf(name, "vram%d_mm", mem_type - XE_PL_VRAM0);
 			ttm_resource_manager_create_debugfs(man, root, name);
+
+			sprintf(name, "vram%d_evict", mem_type - XE_PL_VRAM0);
+			debugfs_create_file(name, 0644, root, man, &evict_all_fops);
 		}
 	}
 
 	man = ttm_manager_type(bdev, XE_PL_TT);
 	ttm_resource_manager_create_debugfs(man, root, "gtt_mm");
+	debugfs_create_file("gtt_evict", 0644, root, man, &evict_all_fops);
 
 	man = ttm_manager_type(bdev, XE_PL_STOLEN);
-	if (man)
+	if (man) {
 		ttm_resource_manager_create_debugfs(man, root, "stolen_mm");
+		debugfs_create_file("stolen_evict", 0644, root, man, &evict_all_fops);
+	}
 
 	for_each_gt(gt, xe, id)
 		xe_gt_debugfs_register(gt);
-- 
2.34.1



More information about the Intel-xe mailing list