]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: stop tracking visible memory stats
authorYunxiang Li <Yunxiang.Li@amd.com>
Thu, 24 Oct 2024 09:23:39 +0000 (10:23 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Nov 2024 16:32:40 +0000 (11:32 -0500)
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 really needed we can add it back on top of
the new implementation, or just report all the BOs as visible.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h

index 8281dd45faaa0feec9e35838786e6fe4a855331c..7a9573958d87ce1b66ec00c9daa5ebfeebfdf1ad 100644 (file)
@@ -103,16 +103,10 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
                   stats[TTM_PL_SYSTEM].drm.resident/1024UL);
 
        /* Amdgpu specific memory accounting keys: */
-       drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
-                  stats[TTM_PL_VRAM].visible/1024UL);
        drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
                   stats[TTM_PL_VRAM].evicted/1024UL);
-       drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
-                  stats[TTM_PL_VRAM].evicted_visible/1024UL);
        drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
                   stats[TTM_PL_VRAM].requested/1024UL);
-       drm_printf(p, "amd-requested-visible-vram:\t%llu KiB\n",
-                  stats[TTM_PL_VRAM].requested_visible/1024UL);
        drm_printf(p, "amd-requested-gtt:\t%llu KiB\n",
                   stats[TTM_PL_TT].requested/1024UL);
 
index d41686a8e5ec02758667b8998a58e0caa7679f22..0d3fb6b4212e6b18f23309a4810731c104f9c73f 100644 (file)
@@ -40,6 +40,7 @@
 #include "amdgpu_trace.h"
 #include "amdgpu_amdkfd.h"
 #include "amdgpu_vram_mgr.h"
+#include "amdgpu_vm.h"
 
 /**
  * DOC: amdgpu_object
@@ -1236,23 +1237,14 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
                        stats[type].drm.active += size;
                else if (bo->flags & AMDGPU_GEM_CREATE_DISCARDABLE)
                        stats[type].drm.purgeable += size;
-
-               if (type == TTM_PL_VRAM && amdgpu_res_cpu_visible(adev, res))
-                       stats[type].visible += size;
        }
 
        /* amdgpu specific stats: */
 
        if (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) {
                stats[TTM_PL_VRAM].requested += size;
-               if (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)
-                       stats[TTM_PL_VRAM].requested_visible += size;
-
-               if (type != TTM_PL_VRAM) {
+               if (type != TTM_PL_VRAM)
                        stats[TTM_PL_VRAM].evicted += size;
-                       if (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)
-                               stats[TTM_PL_VRAM].evicted_visible += size;
-               }
        } else if (bo->preferred_domains & AMDGPU_GEM_DOMAIN_GTT) {
                stats[TTM_PL_TT].requested += size;
        }
index a5653f474f85cf421f9934676fa485d72b98211c..be6769852ece4d752744a7117f8d818b7733873a 100644 (file)
@@ -139,16 +139,6 @@ struct amdgpu_bo_vm {
        struct amdgpu_vm_bo_base        entries[];
 };
 
-struct amdgpu_mem_stats {
-       struct drm_memory_stats drm;
-
-       uint64_t visible;
-       uint64_t evicted;
-       uint64_t evicted_visible;
-       uint64_t requested;
-       uint64_t requested_visible;
-};
-
 static inline struct amdgpu_bo *ttm_to_amdgpu_bo(struct ttm_buffer_object *tbo)
 {
        return container_of(tbo, struct amdgpu_bo, tbo);
index c5b41e3ed14f2c34a1e05f8ef1161c8647227f02..5d119ac26c4fe4c890f6f101d6bc0426f2a2a2fc 100644 (file)
@@ -42,7 +42,6 @@ struct amdgpu_bo_va;
 struct amdgpu_job;
 struct amdgpu_bo_list_entry;
 struct amdgpu_bo_vm;
-struct amdgpu_mem_stats;
 
 /*
  * GPUVM handling
@@ -322,6 +321,16 @@ struct amdgpu_vm_fault_info {
        unsigned int    vmhub;
 };
 
+struct amdgpu_mem_stats {
+       struct drm_memory_stats drm;
+
+       /* buffers that requested this placement */
+       uint64_t requested;
+       /* buffers that requested this placement
+        * but are currently evicted */
+       uint64_t evicted;
+};
+
 struct amdgpu_vm {
        /* tree of virtual addresses mapped */
        struct rb_root_cached   va;