<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta content="text/html; charset=us-ascii">
<style type="text/css" style="display:none">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
</head>
<body dir="ltr">
<div dir="auto">Correct, yes.
<div dir="auto"><br>
</div>
<div dir="auto">For example if you have a 16GB VRAM Vega10 in a system with just 4GB RAM you can only allocate < 4GB VRAM (actually more like ~3GB) in a single BO.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Otherwise we wouldn't be able to evacuate VRAM to system memory and disk during suspend/resume or during memory pressure.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Regards,</div>
<div dir="auto">Christian.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">Am 21.03.2020 09:32 schrieb "Yin, Tianci (Rico)" <Tianci.Yin@amd.com>:<br type="attribution">
</div>
</div>
<div>
<p align="Left" style="font-family:Arial; font-size:10pt; color:#0078D7; margin:15pt">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi Christian,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
You mean <span style="color:rgb(32,31,30); font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important">amdgpu_bo_validate_size() return false is the expectation when GTT < request < VRAM, even if VRAM size can meet the requirement, right?</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(32,31,30); font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important"><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(32,31,30); font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important">Thanks!</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(32,31,30); font-size:14.6667px; background-color:rgb(255,255,255); display:inline!important">Rico</span></div>
<div id="appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Christian König <ckoenig.leichtzumerken@gmail.com><br>
<b>Sent:</b> Saturday, March 21, 2020 2:27<br>
<b>To:</b> Yin, Tianci (Rico) <Tianci.Yin@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Xu, Feifei <Feifei.Xu@amd.com>; Li, Pauline <Pauline.Li@amd.com>; Long, Gang <Gang.Long@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: fix size validation failure in large buffer creation</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Am 20.03.20 um 10:46 schrieb Tianci Yin:<br>
> From: "Tianci.Yin" <tianci.yin@amd.com><br>
><br>
> [why]<br>
> When GTT domain size is smaller than VRAM, if APP apply a very large<br>
> buffer whose size is larger than GTT but smaller than VRAM, the size<br>
> validation will fail.<br>
><br>
> [how]<br>
> Validate VRAM domain size at first place, then GTT domain.<br>
<br>
NAK, this is intended behavior. VRAM allocations larger than GTT <br>
allocations are illegal and can crash the memory management.<br>
<br>
Regards,<br>
Christian.<br>
<br>
><br>
> Change-Id: Ic1d31b9b0a4939e6bba0241ff79ae9aa2225ee05<br>
> Signed-off-by: Tianci.Yin <tianci.yin@amd.com><br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 18 +++++++++---------<br>
> 1 file changed, 9 insertions(+), 9 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> index 84745f9e7408..bab134b6369f 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> @@ -464,21 +464,21 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,<br>
> {<br>
> struct ttm_mem_type_manager *man = NULL;<br>
> <br>
> - /*<br>
> - * If GTT is part of requested domains the check must succeed to<br>
> - * allow fall back to GTT<br>
> - */<br>
> - if (domain & AMDGPU_GEM_DOMAIN_GTT) {<br>
> - man = &adev->mman.bdev.man[TTM_PL_TT];<br>
> + if (domain & AMDGPU_GEM_DOMAIN_VRAM) {<br>
> + man = &adev->mman.bdev.man[TTM_PL_VRAM];<br>
> <br>
> if (size < (man->size << PAGE_SHIFT))<br>
> return true;<br>
> - else<br>
> + else if (!(domain & AMDGPU_GEM_DOMAIN_GTT))<br>
> goto fail;<br>
> }<br>
> <br>
> - if (domain & AMDGPU_GEM_DOMAIN_VRAM) {<br>
> - man = &adev->mman.bdev.man[TTM_PL_VRAM];<br>
> + /*<br>
> + * If GTT is part of requested domains the check must succeed to<br>
> + * allow fall back to GTT<br>
> + */<br>
> + if (domain & AMDGPU_GEM_DOMAIN_GTT) {<br>
> + man = &adev->mman.bdev.man[TTM_PL_TT];<br>
> <br>
> if (size < (man->size << PAGE_SHIFT))<br>
> return true;<br>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>