From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Yunxiang Li <Yunxiang.Li@amd.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, christian.koenig@amd.com,
tvrtko.ursulin@igalia.com
Subject: Re: [PATCH v5 3/4] drm/amdgpu: stop tracking visible memory stats
Date: Tue, 22 Oct 2024 09:22:26 +0200 [thread overview]
Message-ID: <06fec703-4e0b-475e-84cd-c7a270deec82@gmail.com> (raw)
In-Reply-To: <20241018133308.889-4-Yunxiang.Li@amd.com>
Am 18.10.24 um 15:33 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 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>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 6 ------
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 12 ++----------
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 10 ----------
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 11 ++++++++++-
> 4 files changed, 12 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> index 8281dd45faaa0..7a9573958d87c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> @@ -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);
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 2a53e72f3964f..2436b7c9ad12b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -40,6 +40,7 @@
> #include "amdgpu_trace.h"
> #include "amdgpu_amdkfd.h"
> #include "amdgpu_vram_mgr.h"
> +#include "amdgpu_vm.h"
>
> /**
> * DOC: amdgpu_object
> @@ -1235,23 +1236,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;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index a5653f474f85c..be6769852ece4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -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);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 428f7379bd759..6a1b344e15e1b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -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;
next prev parent reply other threads:[~2024-10-22 7:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 13:33 [PATCH v5 0/4] rework bo mem stats tracking Yunxiang Li
2024-10-18 13:33 ` [PATCH v5 1/4] drm/amdgpu: remove unused function parameter Yunxiang Li
2024-10-22 6:58 ` Christian König
2024-10-18 13:33 ` [PATCH v5 2/4] drm/amdgpu: make drm-memory-* report resident memory Yunxiang Li
2024-10-18 15:39 ` Tvrtko Ursulin
2024-10-22 7:00 ` Christian König
2024-10-18 13:33 ` [PATCH v5 3/4] drm/amdgpu: stop tracking visible memory stats Yunxiang Li
2024-10-22 7:22 ` Christian König [this message]
2024-10-18 13:33 ` [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime Yunxiang Li
2024-10-22 7:43 ` Christian König
2024-10-22 15:17 ` Li, Yunxiang (Teddy)
2024-10-22 16:24 ` Christian König
2024-10-22 16:46 ` Li, Yunxiang (Teddy)
2024-10-22 17:06 ` Christian König
2024-10-22 17:09 ` Li, Yunxiang (Teddy)
2024-10-23 6:34 ` Christian König
2024-10-23 7:33 ` Tvrtko Ursulin
2024-10-23 7:38 ` Tvrtko Ursulin
2024-10-23 9:14 ` Christian König
2024-10-23 11:37 ` Tvrtko Ursulin
2024-10-23 12:12 ` Christian König
2024-10-23 12:24 ` Tvrtko Ursulin
2024-10-23 12:56 ` Christian König
2024-10-24 8:29 ` Tvrtko Ursulin
2024-10-23 13:31 ` Li, Yunxiang (Teddy)
2024-10-23 13:40 ` Li, Yunxiang (Teddy)
2024-10-23 14:27 ` Tvrtko Ursulin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06fec703-4e0b-475e-84cd-c7a270deec82@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Alexander.Deucher@amd.com \
--cc=Yunxiang.Li@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=tvrtko.ursulin@igalia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox