[PATCH v3 1/3] drm/amdgpu: stop tracking visible memory stats

Christian König ckoenig.leichtzumerken at gmail.com
Fri Sep 13 07:32:55 UTC 2024


Am 11.09.24 um 17:13 schrieb Yunxiang Li:
> Since on modern systems all of vram can be made visible anyways, to
> simplify the new implementation, drops tracking how much memory is
> visible for now. If this is still needed we can add it back on top of
> the new implementation.
>
> Signed-off-by: Yunxiang Li <Yunxiang.Li at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c |  6 ------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +----------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 14 ++++----------
>   3 files changed, 5 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> index c7df7fa3459f..9a40ff5c6dd3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> @@ -85,16 +85,10 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
>   	drm_printf(p, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
>   	drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
>   	drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
> -	drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
> -		   stats.visible_vram/1024UL);
>   	drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
>   		   stats.evicted_vram/1024UL);
> -	drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
> -		   stats.evicted_visible_vram/1024UL);
>   	drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
>   		   stats.requested_vram/1024UL);
> -	drm_printf(p, "amd-requested-visible-vram:\t%llu KiB\n",
> -		   stats.requested_visible_vram/1024UL);
>   	drm_printf(p, "amd-requested-gtt:\t%llu KiB\n",
>   		   stats.requested_gtt/1024UL);
>   	drm_printf(p, "drm-shared-vram:\t%llu KiB\n", stats.vram_shared/1024UL);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 6faeb9e4a572..bcf25c7e85e0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -1282,7 +1282,6 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
>   void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
>   			  struct amdgpu_mem_stats *stats)
>   {
> -	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
>   	struct ttm_resource *res = bo->tbo.resource;
>   	uint64_t size = amdgpu_bo_size(bo);
>   	struct drm_gem_object *obj;
> @@ -1298,8 +1297,6 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
>   	switch (res->mem_type) {
>   	case TTM_PL_VRAM:
>   		stats->vram += size;
> -		if (amdgpu_res_cpu_visible(adev, res))
> -			stats->visible_vram += size;
>   		if (shared)
>   			stats->vram_shared += size;
>   		break;
> @@ -1318,14 +1315,8 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
>   
>   	if (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) {
>   		stats->requested_vram += size;
> -		if (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)
> -			stats->requested_visible_vram += size;
> -
> -		if (res->mem_type != TTM_PL_VRAM) {
> +		if (res->mem_type != TTM_PL_VRAM)
>   			stats->evicted_vram += size;
> -			if (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)
> -				stats->evicted_visible_vram += size;
> -		}
>   	} else if (bo->preferred_domains & AMDGPU_GEM_DOMAIN_GTT) {
>   		stats->requested_gtt += size;
>   	}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index d7e27957013f..e14b4fbb486e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -142,12 +142,10 @@ struct amdgpu_bo_vm {
>   };
>   
>   struct amdgpu_mem_stats {
> -	/* current VRAM usage, includes visible VRAM */
> +	/* current VRAM usage */
>   	uint64_t vram;
> -	/* current shared VRAM usage, includes visible VRAM */
> +	/* current shared VRAM usage */
>   	uint64_t vram_shared;
> -	/* current visible VRAM usage */
> -	uint64_t visible_vram;
>   	/* current GTT usage */
>   	uint64_t gtt;
>   	/* current shared GTT usage */
> @@ -156,14 +154,10 @@ struct amdgpu_mem_stats {
>   	uint64_t cpu;
>   	/* current shared system memory usage */
>   	uint64_t cpu_shared;
> -	/* sum of evicted buffers, includes visible VRAM */
> +	/* sum of evicted buffers */
>   	uint64_t evicted_vram;
> -	/* sum of evicted buffers due to CPU access */
> -	uint64_t evicted_visible_vram;
> -	/* how much userspace asked for, includes vis.VRAM */
> -	uint64_t requested_vram;
>   	/* how much userspace asked for */
> -	uint64_t requested_visible_vram;
> +	uint64_t requested_vram;
>   	/* how much userspace asked for */
>   	uint64_t requested_gtt;
>   };



More information about the amd-gfx mailing list