<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Thanks Christian for the review. I'll remove the leading blanks before submitting the patch.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Pierre-Eric<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Sent:</b> Wednesday, June 21, 2023 5:00 PM<br>
<b>To:</b> Pelloux-Prayer, Pierre-Eric <Pierre-eric.Pelloux-prayer@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: add VISIBLE info in amdgpu_bo_print_info</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 21.06.23 um 16:35 schrieb Pierre-Eric Pelloux-Prayer:<br>
> This allows tools to distinguish between VRAM and visible VRAM.<br>
><br>
> Use the opportunity to fix locking before accessing bo.<br>
><br>
> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com><br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 33 ++++++++++++++--------<br>
> 1 file changed, 21 insertions(+), 12 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 ff73cc11d47e..f12f019d7f99 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> @@ -1583,18 +1583,27 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)<br>
> unsigned int pin_count;<br>
> u64 size;<br>
> <br>
> - domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);<br>
> - switch (domain) {<br>
> - case AMDGPU_GEM_DOMAIN_VRAM:<br>
> - placement = "VRAM";<br>
> - break;<br>
> - case AMDGPU_GEM_DOMAIN_GTT:<br>
> - placement = " GTT";<br>
> - break;<br>
> - case AMDGPU_GEM_DOMAIN_CPU:<br>
> - default:<br>
> - placement = " CPU";<br>
> - break;<br>
> + if (dma_resv_trylock(bo->tbo.base.resv)) {<br>
> + unsigned int domain;<br>
> + domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);<br>
> + switch (domain) {<br>
> + case AMDGPU_GEM_DOMAIN_VRAM:<br>
> + if (amdgpu_bo_in_cpu_visible_vram(bo))<br>
> + placement = "VRAM VISIBLE";<br>
> + else<br>
> + placement = "VRAM";<br>
> + break;<br>
> + case AMDGPU_GEM_DOMAIN_GTT:<br>
> + placement = " GTT";<br>
<br>
We can probably drop the leading blank here and<br>
<br>
> + break;<br>
> + case AMDGPU_GEM_DOMAIN_CPU:<br>
> + default:<br>
> + placement = " CPU";<br>
<br>
here when we don't keep the strings at the same length anyway.<br>
<br>
With that fixed the change is Reviewed-by: Christian König <br>
<christian.koenig@amd.com><br>
<br>
Regards,<br>
Christian.<br>
<br>
> + break;<br>
> + }<br>
> + dma_resv_unlock(bo->tbo.base.resv);<br>
> + } else {<br>
> + placement = "UNKNOWN";<br>
> }<br>
> <br>
> size = amdgpu_bo_size(bo);<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>