<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
page table BOs share same resv.It should be ok using any of them, root bo resv or bo resv.<br>
</div>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
I forgot to unref bos which cause problems. not good at rebasing...<br>
<br>
</div>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
thanks<br>
</div>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
xinhui</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> Friday, March 13, 2020 9:34:42 PM<br>
<b>To:</b> Pan, Xinhui <Xinhui.Pan@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Kuehling, Felix <Felix.Kuehling@amd.com><br>
<b>Subject:</b> Re: [PATCH 1/2] drm//amdgpu: Add job fence to resv conditionally</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 13.03.20 um 12:53 schrieb xinhui pan:<br>
> If a job need sync the bo resv, it is likely that bo need the job fence<br>
> to sync with others.<br>
<br>
That won't work because this is the wrong resv object :)<br>
<br>
You added the fence to the mapped BO and not the page table.<br>
<br>
No wonder that this doesn't work,<br>
Christian.<br>
<br>
><br>
> Cc: Christian König <christian.koenig@amd.com><br>
> Cc: Alex Deucher <alexander.deucher@amd.com><br>
> Cc: Felix Kuehling <Felix.Kuehling@amd.com><br>
> Suggested-by: Christian König <christian.koenig@amd.com><br>
> Signed-off-by: xinhui pan <xinhui.pan@amd.com><br>
> ---<br>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h      | 5 +++++<br>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 9 +++++++++<br>
>   2 files changed, 14 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
> index b5705fcfc935..ca6021b4200b 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
> @@ -226,6 +226,11 @@ struct amdgpu_vm_update_params {<br>
>         * @num_dw_left: number of dw left for the IB<br>
>         */<br>
>        unsigned int num_dw_left;<br>
> +<br>
> +     /**<br>
> +      * @resv: sync the resv and add job fence to it conditionally.<br>
> +      */<br>
> +     struct dma_resv *resv;<br>
>   };<br>
>   <br>
>   struct amdgpu_vm_update_funcs {<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c<br>
> index 4cc7881f438c..0cfac59bff36 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c<br>
> @@ -70,6 +70,8 @@ static int amdgpu_vm_sdma_prepare(struct amdgpu_vm_update_params *p,<br>
>   <br>
>        p->num_dw_left = ndw;<br>
>   <br>
> +     p->resv = resv;<br>
> +<br>
>        if (!resv)<br>
>                return 0;<br>
>   <br>
> @@ -111,6 +113,13 @@ static int amdgpu_vm_sdma_commit(struct amdgpu_vm_update_params *p,<br>
>                swap(p->vm->last_delayed, tmp);<br>
>        dma_fence_put(tmp);<br>
>   <br>
> +     /* add job fence to resv.<br>
> +      * MM notifier path is an exception as we can not grab the<br>
> +      * resv lock.<br>
> +      */<br>
> +     if (!p->direct && p->resv)<br>
> +             dma_resv_add_shared_fence(p->resv, f);<br>
> +<br>
>        if (fence && !p->direct)<br>
>                swap(*fence, f);<br>
>        dma_fence_put(f);<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>