<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div style="font-family: "segoe ui westeuropean", "segoe ui", helvetica, arial, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
One question inline</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px" readability="8"><font face="Verdana" readability="6"><font size="2"><b></b></font>
<p class="MsoNormal" style="margin-top: 0px; margin-bottom: 0px;"><a name="_MailAutoSig"><b><span style="color:black; text-transform:uppercase">KENT RUSSELL</span></b></a><span style=""><b><span style="font-variant:small-caps; color:black">
</span></b></span><span style=""><span style="font-size:10.0pt; color:black"> </span></span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-bottom: 0px;"><span style=""><span style="font-size:10.0pt; color:black">Sr. Software Engineer | Linux Compute Kernel</span></span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-bottom: 0px;"><span style=""><span style="font-size:10.0pt; color:black">1 Commerce Valley Drive East</span></span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-bottom: 0px;"><span style=""><span style="font-size:10.0pt; color:black">Markham, ON L3T 7X6</span></span></p>
<p class="MsoNormal" style="margin-top: 0px; margin-bottom: 0px;"><span style=""><b><span style="font-size:10.0pt; color:black">O</span></b></span><span style=""><span style="font-size:10.0pt; color:black"> +(1) 289-695-2122<b>
</b><span style="">| Ext 72122</span></span></span></p>
</font></div>
</div>
</div>
</div>
</div>
<div><br>
</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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Felix Kuehling <felix.kuehling@amd.com><br>
<b>Sent:</b> Tuesday, January 18, 2022 6:36 PM<br>
<b>To:</b> Huang, JinHuiEric <JinHuiEric.Huang@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH] drm/amdkfd: enable heavy-weight TLB flush on Arcturus</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 2022-01-18 um 5:45 p.m. schrieb Eric Huang:<br>
> SDMA FW fixes the hang issue for adding heavy-weight TLB<br>
> flush on Arcturus, so we can enable it.<br>
><br>
> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com><br>
<br>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com><br>
<br>
<br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 ------<br>
> drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++++--<br>
> 2 files changed, 8 insertions(+), 8 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c<br>
> index a64cbbd943ba..acb4fd973e60 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c<br>
> @@ -1892,12 +1892,6 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(<br>
> true);<br>
> ret = unreserve_bo_and_vms(&ctx, false, false);<br>
> <br>
> - /* Only apply no TLB flush on Aldebaran to<br>
> - * workaround regressions on other Asics.<br>
> - */<br>
> - if (table_freed && (adev->asic_type != CHIP_ALDEBARAN))<br>
> - *table_freed = true;<br>
> -<br>
> goto out;<br>
> <br>
> out_unreserve:<br>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c<br>
> index b570c0454ce9..485d4c52c7de 100644<br>
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c<br>
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c<br>
> @@ -1596,6 +1596,12 @@ static int kfd_ioctl_free_memory_of_gpu(struct file *filep,<br>
> return ret;<br>
> }<br>
> <br>
> +static bool kfd_flush_tlb_after_unmap(struct kfd_dev *dev) {<br>
> + return KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)</div>
<div class="PlainText"><br>
</div>
<div class="PlainText">Do we need to add a check for sdma ver >=8 here?</div>
<div class="PlainText"> </div>
<div class="PlainText">||<br>
> + (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) &&<br>
> + dev->adev->sdma.instance[0].fw_version >= 18);<br>
> +}<br>
> +<br>
> static int kfd_ioctl_map_memory_to_gpu(struct file *filep,<br>
> struct kfd_process *p, void *data)<br>
> {<br>
> @@ -1692,7 +1698,7 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep,<br>
> }<br>
> <br>
> /* Flush TLBs after waiting for the page table updates to complete */<br>
> - if (table_freed) {<br>
> + if (table_freed || !kfd_flush_tlb_after_unmap(dev)) {<br>
> for (i = 0; i < args->n_devices; i++) {<br>
> peer = kfd_device_by_id(devices_arr[i]);<br>
> if (WARN_ON_ONCE(!peer))<br>
> @@ -1806,7 +1812,7 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,<br>
> }<br>
> mutex_unlock(&p->mutex);<br>
> <br>
> - if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2)) {<br>
> + if (kfd_flush_tlb_after_unmap(dev)) {<br>
> err = amdgpu_amdkfd_gpuvm_sync_memory(dev->adev,<br>
> (struct kgd_mem *) mem, true);<br>
> if (err) {<br>
</div>
</span></font></div>
</body>
</html>