From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Yifan Zhang <yifan1.zhang@amd.com>,
amd-gfx@lists.freedesktop.org, "Paneer Selvam,
Arunpravin" <Arunpravin.PaneerSelvam@amd.com>
Cc: Philip.Yang@amd.com, Felix.Kuehling@amd.com
Subject: Re: [PATCH] drm/amdgpu: simplify vram alloc logic since 2GB limitation removed
Date: Fri, 27 Sep 2024 09:13:46 +0200 [thread overview]
Message-ID: <98980fa6-2dca-4195-9afc-6311a1c35dc4@gmail.com> (raw)
In-Reply-To: <20240923081931.2126969-1-yifan1.zhang@amd.com>
Arun please take a look at that.
Looks valid to me in general.
Thanks,
Christian.
Am 23.09.24 um 10:19 schrieb Yifan Zhang:
> Make vram alloc loop simpler after 2GB limitation removed.
>
> Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index 7d26a962f811..3d129fd61fa7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@ -455,7 +455,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
> struct amdgpu_bo *bo = ttm_to_amdgpu_bo(tbo);
> u64 vis_usage = 0, max_bytes, min_block_size;
> struct amdgpu_vram_mgr_resource *vres;
> - u64 size, remaining_size, lpfn, fpfn;
> + u64 size, lpfn, fpfn;
> unsigned int adjust_dcc_size = 0;
> struct drm_buddy *mm = &mgr->mm;
> struct drm_buddy_block *block;
> @@ -516,25 +516,23 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
> adev->gmc.gmc_funcs->get_dcc_alignment)
> adjust_dcc_size = amdgpu_gmc_get_dcc_alignment(adev);
>
> - remaining_size = (u64)vres->base.size;
> + size = (u64)vres->base.size;
> if (bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS && adjust_dcc_size) {
> unsigned int dcc_size;
>
> dcc_size = roundup_pow_of_two(vres->base.size + adjust_dcc_size);
> - remaining_size = (u64)dcc_size;
> + size = (u64)dcc_size;
>
> vres->flags |= DRM_BUDDY_TRIM_DISABLE;
> }
>
> mutex_lock(&mgr->lock);
> - while (remaining_size) {
> + while (true) {
> if (tbo->page_alignment)
> min_block_size = (u64)tbo->page_alignment << PAGE_SHIFT;
> else
> min_block_size = mgr->default_page_size;
>
> - size = remaining_size;
> -
> if (bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS && adjust_dcc_size)
> min_block_size = size;
> else if ((size >= (u64)pages_per_block << PAGE_SHIFT) &&
> @@ -562,10 +560,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
> if (unlikely(r))
> goto error_free_blocks;
>
> - if (size > remaining_size)
> - remaining_size = 0;
> - else
> - remaining_size -= size;
> + break;
> }
> mutex_unlock(&mgr->lock);
>
prev parent reply other threads:[~2024-09-27 7:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 8:19 [PATCH] drm/amdgpu: simplify vram alloc logic since 2GB limitation removed Yifan Zhang
2024-09-24 14:06 ` Alex Deucher
2024-09-24 14:22 ` Zhang, Yifan
2024-09-25 17:16 ` Alex Deucher
2024-09-26 14:45 ` Zhang, Yifan
2024-09-26 15:21 ` Alex Deucher
2024-09-27 7:13 ` 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=98980fa6-2dca-4195-9afc-6311a1c35dc4@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Arunpravin.PaneerSelvam@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=Philip.Yang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=yifan1.zhang@amd.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