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

Thomas Hellström thomas.hellstrom at linux.intel.com
Fri May 26 13:02:45 UTC 2023


On 5/26/23 14:10, Maarten Lankhorst wrote:
> Easy for testing, when you just want your BO evicted.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>

Do we have some documentation somewhere about what our debugfs entries 
are doing that needs updating?

Also can we evict stolen memory?

/Thomas

> ---
>   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);


More information about the Intel-xe mailing list