From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Tvrtko Ursulin <tursulin@igalia.com>, amd-gfx@lists.freedesktop.org
Cc: "Christian König" <christian.koenig@amd.com>,
kernel-dev@igalia.com,
"Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>,
"Felix Kuehling" <Felix.Kuehling@amd.com>
Subject: Re: [PATCH 3/3] drm/amdgpu: Fix pinned GART area accounting and fdinfo reporting
Date: Mon, 29 Apr 2024 13:06:14 +0200 [thread overview]
Message-ID: <c66a5f9a-99df-43ea-b2c7-94db01957951@gmail.com> (raw)
In-Reply-To: <20240426164355.1563-4-tursulin@igalia.com>
Am 26.04.24 um 18:43 schrieb Tvrtko Ursulin:
> From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
>
> When commit b453e42a6e8b ("drm/amdgpu: Add new placement for preemptible
> SG BOs") added a new TTM region it missed to notice the conceptual
> imbalance in GART pin size accounting as done in amdgpu_bo_pin/unpin.
>
> That imbalance leads to such objects getting accounted against the
> resource, but are not un-accounted when unpinned.
>
> Fix by extending the accounting criteria in amdgpu_bo_unpin.
>
> What also aappears needs fixing is not reporting their size from the
> amdgpu_bo_get_memory, which is used to implement fdinfo stats, so they are
> not mixed with the regular userspace created and driver owned objects.
>
> And also amdgpu_bo_print_info for debugfs reporting.
>
> Note that the patch depends on the previous one which broke down the
> relevant checks from the domain based to placement based.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Fixes: b453e42a6e8b ("drm/amdgpu: Add new placement for preemptible SG BOs")
> Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index fb984669fc3a..5a2bbc793953 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -1032,7 +1032,8 @@ void amdgpu_bo_unpin(struct amdgpu_bo *bo)
> atomic64_sub(amdgpu_bo_size(bo), &adev->vram_pin_size);
> atomic64_sub(amdgpu_vram_mgr_bo_visible_size(bo),
> &adev->visible_pin_size);
> - } else if (bo->tbo.resource->mem_type == TTM_PL_TT) {
> + } else if (bo->tbo.resource->mem_type == TTM_PL_TT ||
> + bo->tbo.resource->mem_type == AMDGPU_PL_PREEMPT) {
Good catch, but please separate that one from the other changes since we
probably want to backport it.
> atomic64_sub(amdgpu_bo_size(bo), &adev->gart_pin_size);
> }
>
> @@ -1298,7 +1299,6 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
> stats->vram_shared += size;
> break;
> case TTM_PL_TT:
> - case AMDGPU_PL_PREEMPT:
> stats->gtt += size;
> if (shared)
> stats->gtt_shared += size;
> @@ -1599,7 +1599,6 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)
> placement = "VRAM";
> break;
> case TTM_PL_TT:
> - case AMDGPU_PL_PREEMPT:
Yeah, that makes sense as well. But we need a case for AMDGPU_PL_PREEMPT
here as well then.
Regards,
Christian.
> placement = "GTT";
> break;
> case TTM_PL_SYSTEM:
prev parent reply other threads:[~2024-04-29 11:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 16:43 [PATCH 0/3] Some refactoring and maybe a memory accounting fixlet Tvrtko Ursulin
2024-04-26 16:43 ` [PATCH 1/3] drm/amdgpu: Add amdgpu_bo_is_vm_bo helper Tvrtko Ursulin
2024-04-29 11:02 ` Christian König
2024-04-29 13:34 ` Tvrtko Ursulin
2024-04-29 13:51 ` Christian König
2024-04-26 16:43 ` [PATCH 2/3] drm/amdgpu: Reduce mem_type to domain double indirection Tvrtko Ursulin
2024-04-29 11:03 ` Christian König
2024-04-29 13:38 ` Tvrtko Ursulin
2024-04-26 16:43 ` [PATCH 3/3] drm/amdgpu: Fix pinned GART area accounting and fdinfo reporting Tvrtko Ursulin
2024-04-26 22:24 ` Felix Kuehling
2024-04-29 9:43 ` Tvrtko Ursulin
2024-04-29 11:11 ` Christian König
2024-04-29 13:45 ` Tvrtko Ursulin
2024-04-29 14:34 ` Felix Kuehling
2024-04-29 14:43 ` Felix Kuehling
2024-04-29 16:51 ` Tvrtko Ursulin
2024-04-29 11:06 ` Christian König [this message]
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=c66a5f9a-99df-43ea-b2c7-94db01957951@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Felix.Kuehling@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=kernel-dev@igalia.com \
--cc=tursulin@igalia.com \
--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