<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>bool is_xgmi is added in bo_va structure , this change won't increase the size of struct amdgpu_vm_bo_base. Anyway , can I said it's reviewed by you now?
<br>
</p>
<p>shaoyun.liu<br>
</p>
<div class="moz-cite-prefix">On 2019-03-27 11:39 a.m., Koenig, Christian wrote:<br>
</div>
<blockquote type="cite" cite="mid:68f7ccfa-646e-492f-bdd7-b24f2e2029da@email.android.com">
<meta content="text/html; charset=utf-8">
<div dir="auto">Yeah, that one is intentionally very small because it is used so often.
<div dir="auto"><br>
</div>
<div dir="auto">When it grows over the next power of two by this change we need to figure out a different approach.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Christian.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">Am 27.03.2019 16:34 schrieb "Liu, Shaoyun" <a class="moz-txt-link-rfc2396E" href="mailto:Shaoyun.Liu@amd.com">
<Shaoyun.Liu@amd.com></a>:<br type="attribution">
</div>
</div>
<div>
<p>you mean struct amdgpu_vm_bo_base ? It only has few pointer and a list_head , should be pretty small .
<br>
</p>
<p>struct amdgpu_vm_bo_base {<br>
/* constant after initialization */<br>
struct amdgpu_vm *vm;<br>
struct amdgpu_bo *bo;<br>
<br>
/* protected by bo being reserved */<br>
struct amdgpu_vm_bo_base *next;<br>
<br>
/* protected by spinlock */<br>
struct list_head vm_status;<br>
<br>
/* protected by the BO being reserved */<br>
bool moved;<br>
};<br>
</p>
<p>shaoyun.liu<br>
</p>
<div class="moz-cite-prefix">On 2019-03-27 11:30 a.m., Koenig, Christian wrote:<br>
</div>
<blockquote type="cite">
<meta name="Generator" content="Microsoft Exchange Server">
<style>
<!--
.EmailQuote
{margin-left:1pt;
padding-left:4pt;
border-left:#800000 2px solid}
-->
</style>
<div>
<div dir="auto">Ah, of course. In this case feel free to go ahead.
<div dir="auto"> BTW: What's the size of the structure now?</div>
<div dir="auto"><br>
</div>
<div dir="auto">Christian.</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">Am 27.03.2019 16:22 schrieb "Liu, Shaoyun" <a class="moz-txt-link-rfc2396E" href="mailto:Shaoyun.Liu@amd.com" moz-do-not-send="true">
<Shaoyun.Liu@amd.com></a>:<br type="attribution">
</div>
</div>
</div>
<font size="2"><span style="font-size:11pt">
<div class="PlainText">The next in struct amdgpu_vm_bo_base is not a list_head, I'm not
<br>
sure whether we can use list_for_each_entry here.<br>
<br>
Regards<br>
<br>
shaoyun.liu<br>
<br>
On 2019-03-27 3:41 a.m., Christian König wrote:<br>
> Am 26.03.19 um 21:35 schrieb Liu, Shaoyun:<br>
>> Avoid unnecessary XGMI hight pstate trigger when mapping none-vram <br>
>> memory for peer device<br>
>><br>
>> Change-Id: I1881deff3da19f1f4b58d5765db03a590092a5b2<br>
>> Signed-off-by: shaoyunl <a class="moz-txt-link-rfc2396E" href="mailto:shaoyun.liu@amd.com" moz-do-not-send="true">
<shaoyun.liu@amd.com></a><br>
>> ---<br>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 11 +++++++++++<br>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-<br>
>> 2 files changed, 13 insertions(+), 1 deletion(-)<br>
>><br>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c <br>
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c<br>
>> index a82c3b1..a0f56e4 100644<br>
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c<br>
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c<br>
>> @@ -666,6 +666,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, <br>
>> void *data,<br>
>> struct amdgpu_device *adev = dev->dev_private;<br>
>> struct drm_amdgpu_gem_op *args = data;<br>
>> struct drm_gem_object *gobj;<br>
>> + struct amdgpu_vm_bo_base *base;<br>
>> + struct amdgpu_bo_va *bo_va;<br>
>> struct amdgpu_bo *robj;<br>
>> int r;<br>
>> @@ -704,6 +706,15 @@ int amdgpu_gem_op_ioctl(struct drm_device <br>
>> *dev, void *data,<br>
>> amdgpu_bo_unreserve(robj);<br>
>> break;<br>
>> }<br>
>> + for (base = robj->vm_bo; base; base = base->next) {<br>
>> + bo_va = container_of(base, struct amdgpu_bo_va, base);<br>
><br>
> Please use list_for_each_entry here instead of open coding it.<br>
><br>
> Christian.<br>
><br>
>> + if (bo_va && bo_va->is_xgmi) {<br>
>> + r = -EINVAL;<br>
>> + amdgpu_bo_unreserve(robj);<br>
>> + goto out;<br>
>> + }<br>
>> + }<br>
>> +<br>
>> robj->preferred_domains = args->value & <br>
>> (AMDGPU_GEM_DOMAIN_VRAM |<br>
>> AMDGPU_GEM_DOMAIN_GTT |<br>
>> AMDGPU_GEM_DOMAIN_CPU);<br>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c <br>
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
>> index 76eee7e..8ed23d2 100644<br>
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
>> @@ -2048,7 +2048,8 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct <br>
>> amdgpu_device *adev,<br>
>> INIT_LIST_HEAD(&bo_va->valids);<br>
>> INIT_LIST_HEAD(&bo_va->invalids);<br>
>> - if (bo && amdgpu_xgmi_same_hive(adev, <br>
>> amdgpu_ttm_adev(bo->tbo.bdev))) {<br>
>> + if (bo && amdgpu_xgmi_same_hive(adev, <br>
>> amdgpu_ttm_adev(bo->tbo.bdev)) &&<br>
>> + (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM)) {<br>
>> bo_va->is_xgmi = true;<br>
>> mutex_lock(&adev->vm_manager.lock_pstate);<br>
>> /* Power up XGMI if it can be potentially used */<br>
><br>
</div>
</span></font></blockquote>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
amd-gfx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></pre>
</blockquote>
</body>
</html>