<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<blockquote type="cite" cite="mid:SN1PR12MB2575BD1009EC55A184222D8DE324A@SN1PR12MB2575.namprd12.prod.outlook.com"><br>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Courier
New"">Does this read well.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-family:"Courier New"">drm/amdkfd:
Access gpuvm_export_dmabuf() API to get Dmabuf<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-family:"Courier New"">Directly
invoking the function amdgpu_gem_prime_export() from
within<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-family:"Courier New"">KFD is not
correct. By utilizing the KFD API to obtain Dmabuf, the<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-family:"Courier New"">implementation
can prevent the creation of multiple instances of<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-family:"Courier New"">struct
dma_buf.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">Ramesh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
</div>
</div>
</blockquote>
<pre>Looks good.
With the new commit message, patch is
Reviewed-by: David Francis <a class="moz-txt-link-rfc2396E" href="mailto:David.Francis@amd.com"><David.Francis@amd.com></a>
</pre>
<blockquote type="cite" cite="mid:SN1PR12MB2575BD1009EC55A184222D8DE324A@SN1PR12MB2575.namprd12.prod.outlook.com">
<div>
<div class="WordSection1"><o:p> </o:p>
<pre>On 2023-06-22 17:10, Ramesh Errabolu wrote:<o:p></o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><o:p> </o:p></pre>
<pre>Call KFD api to get Dmabuf instead of calling GEM Prime API<o:p></o:p></pre>
</blockquote>
<pre>Would appreciate a more detailed commit message to explain why the<o:p></o:p></pre>
<pre>KFD API is preferred over the GEM API.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>With or without that change, this is<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Reviewed-by: David Francis <a href="mailto:David.Francis@amd.com" moz-do-not-send="true"><David.Francis@amd.com></a><o:p></o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Signed-off-by: Ramesh Errabolu <a href="mailto:Ramesh.Errabolu@amd.com" moz-do-not-send="true"><Ramesh.Errabolu@amd.com></a><o:p></o:p></pre>
<pre>---<o:p></o:p></pre>
<pre> drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 11 +++++------<o:p></o:p></pre>
<pre> 1 file changed, 5 insertions(+), 6 deletions(-)<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c<o:p></o:p></pre>
<pre>index cf1db0ab3471..40ac093b5035 100644<o:p></o:p></pre>
<pre>--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c<o:p></o:p></pre>
<pre>+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c<o:p></o:p></pre>
<pre>@@ -1852,15 +1852,14 @@ static uint32_t get_process_num_bos(struct kfd_process *p)<o:p></o:p></pre>
<pre> return num_of_bos;<o:p></o:p></pre>
<pre> }<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>-static int criu_get_prime_handle(struct drm_gem_object *gobj, int flags,<o:p></o:p></pre>
<pre>+static int criu_get_prime_handle(struct kgd_mem *mem, int flags,<o:p></o:p></pre>
<pre> u32 *shared_fd)<o:p></o:p></pre>
<pre> {<o:p></o:p></pre>
<pre> struct dma_buf *dmabuf;<o:p></o:p></pre>
<pre> int ret;<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>- dmabuf = amdgpu_gem_prime_export(gobj, flags);<o:p></o:p></pre>
<pre>- if (IS_ERR(dmabuf)) {<o:p></o:p></pre>
<pre>- ret = PTR_ERR(dmabuf);<o:p></o:p></pre>
<pre>+ ret = amdgpu_amdkfd_gpuvm_export_dmabuf(mem, &dmabuf);<o:p></o:p></pre>
<pre>+ if (ret) {<o:p></o:p></pre>
<pre> pr_err("dmabuf export failed for the BO\n");<o:p></o:p></pre>
<pre> return ret;<o:p></o:p></pre>
<pre> }<o:p></o:p></pre>
<pre>@@ -1940,7 +1939,7 @@ static int criu_checkpoint_bos(struct kfd_process *p,<o:p></o:p></pre>
<pre> }<o:p></o:p></pre>
<pre> if (bo_bucket->alloc_flags<o:p></o:p></pre>
<pre> & (KFD_IOC_ALLOC_MEM_FLAGS_VRAM | KFD_IOC_ALLOC_MEM_FLAGS_GTT)) {<o:p></o:p></pre>
<pre>- ret = criu_get_prime_handle(&dumper_bo->tbo.base,<o:p></o:p></pre>
<pre>+ ret = criu_get_prime_handle(kgd_mem,<o:p></o:p></pre>
<pre> bo_bucket->alloc_flags &<o:p></o:p></pre>
<pre> KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE ? DRM_RDWR : 0,<o:p></o:p></pre>
<pre> &bo_bucket->dmabuf_fd);<o:p></o:p></pre>
<pre>@@ -2402,7 +2401,7 @@ static int criu_restore_bo(struct kfd_process *p,<o:p></o:p></pre>
<pre> /* create the dmabuf object and export the bo */<o:p></o:p></pre>
<pre> if (bo_bucket->alloc_flags<o:p></o:p></pre>
<pre> & (KFD_IOC_ALLOC_MEM_FLAGS_VRAM | KFD_IOC_ALLOC_MEM_FLAGS_GTT)) {<o:p></o:p></pre>
<pre>- ret = criu_get_prime_handle(&kgd_mem->bo->tbo.base, DRM_RDWR,<o:p></o:p></pre>
<pre>+ ret = criu_get_prime_handle(kgd_mem, DRM_RDWR,<o:p></o:p></pre>
<pre> &bo_bucket->dmabuf_fd);<o:p></o:p></pre>
<pre> if (ret)<o:p></o:p></pre>
<pre> return ret;<o:p></o:p></pre>
<pre>--<o:p></o:p></pre>
<pre>2.25.1<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
</blockquote>
</div>
</div>
</blockquote>
</body>
</html>