From: "Christian König" <christian.koenig@amd.com>
To: Luben Tuikov <luben.tuikov@amd.com>,
AMD Graphics <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <Alexander.Deucher@amd.com>
Subject: Re: [PATCH v2] drm/amdgpu: Fix size validation for non-exclusive domains
Date: Mon, 12 Dec 2022 20:19:52 +0100 [thread overview]
Message-ID: <802b6283-d015-eb67-18fd-cba6fb03c96a@amd.com> (raw)
In-Reply-To: <20221212174834.36544-1-luben.tuikov@amd.com>
Am 12.12.22 um 18:48 schrieb Luben Tuikov:
> Fix amdgpu_bo_validate_size() to check whether the TTM domain manager for the
> requested memory exists, and to allow for non-exclusive domain allocations, as
> there would be if the domain is a mask, e.g. AMDGPU_GEM_DOMAIN_VRAM |
> AMDGPU_GEM_DOMAIN_GTT.
>
> Cc: Alex Deucher <Alexander.Deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index fd3ab4b5e5bb1f..e0f103f0ec2178 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -448,31 +448,26 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
>
> /*
> * If GTT is part of requested domains the check must succeed to
> - * allow fall back to GTT
> + * allow fall back to GTT.
> + *
> + * Note that allocations can request from either domain. For
> + * this reason, check either in non-exclusive way, and if
> + * neither satisfies, fail the validation.
That's not correct, the original logic was completely intentional.
If both VRAM and GTT are specified it's valid if the size fits only into
GTT.
Regards,
Christian.
> */
> if (domain & AMDGPU_GEM_DOMAIN_GTT) {
> man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
> -
> - if (size < man->size)
> + if (man && size < man->size)
> return true;
> - else
> - goto fail;
> }
>
> if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
> man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
> -
> - if (size < man->size)
> + if (man && size < man->size)
> return true;
> - else
> - goto fail;
> }
>
> -
> /* TODO add more domains checks, such as AMDGPU_GEM_DOMAIN_CPU */
> - return true;
>
> -fail:
> DRM_DEBUG("BO size %lu > total memory in domain: %llu\n", size,
> man->size);
> return false;
>
> base-commit: 20e03e7f6e8efd42168db6d3fe044b804e0ede8f
next prev parent reply other threads:[~2022-12-12 19:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-10 9:24 [PATCH] drm/amdgpu: Fix an oops with GTT | VRAM allocation Luben Tuikov
2022-12-12 17:48 ` [PATCH v2] drm/amdgpu: Fix size validation for non-exclusive domains Luben Tuikov
2022-12-12 19:19 ` Christian König [this message]
2022-12-12 23:44 ` Luben Tuikov
2022-12-13 4:13 ` Luben Tuikov
2022-12-13 4:16 ` [PATCH v3] drm/amdgpu: Fix size validation for non-exclusive domains (v3) Luben Tuikov
2022-12-13 7:00 ` [PATCH v2] drm/amdgpu: Fix size validation for non-exclusive domains Christian König
2022-12-13 9:52 ` Luben Tuikov
2022-12-13 11:40 ` Lazar, Lijo
2022-12-13 11:52 ` Christian König
2022-12-13 12:41 ` Lazar, Lijo
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=802b6283-d015-eb67-18fd-cba6fb03c96a@amd.com \
--to=christian.koenig@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=luben.tuikov@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