<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@等线";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:宋体;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:宋体;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:DengXian;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian">Yep, will send v3.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian">Thanks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian">xinhui<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="color:black">发件人</span></b><b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">:
</span></b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">"Koenig, Christian" <Christian.Koenig@amd.com><br>
</span><b><span style="color:black">日期</span></b><b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">:
</span></b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">2020</span><span style="color:black">年</span><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">3</span><span style="color:black">月</span><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">13</span><span style="color:black">日</span><span style="font-family:"Calibri",sans-serif;color:black">
</span><span style="color:black">星期五</span><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black"> 21:46<br>
</span><b><span style="color:black">收件人</span></b><b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">:
</span></b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">"Pan, Xinhui" <Xinhui.Pan@amd.com>, "amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org><br>
</span><b><span style="color:black">抄送</span></b><b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">:
</span></b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">"Deucher, Alexander" <Alexander.Deucher@amd.com>, "Kuehling, Felix" <Felix.Kuehling@amd.com><br>
</span><b><span style="color:black">主题</span></b><b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">:
</span></b><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:black">Re: [PATCH 1/2] drm//amdgpu: Add job fence to resv conditionally<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Yeah, but this is still the wrong resv object :)<br>
<br>
See the object passed to amdgpu_vm_sdma_prepare() is the one of the BO which is mapped into the page tables and NOT the one of the page tables.<br>
<br>
You need to use p->vm->root.base.bo->tbo.base.resv here.<br>
<br>
Regards,<br>
Christian.<br>
<br>
Am 13.03.20 um 14:43 schrieb Pan, Xinhui:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p style="margin:15.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#0078D7">[AMD Official Use Only - Internal Distribution Only]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">page table BOs share same resv.It should be ok using any of them, root bo resv or bo resv.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black">I forgot to unref bos which cause problems. not good at rebasing...<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US">
<hr size="0" width="100%" align="center">
</span></div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Koenig, Christian
<a href="mailto:Christian.Koenig@amd.com"><Christian.Koenig@amd.com></a><br>
<b>Sent:</b> Friday, March 13, 2020 9:34:42 PM<br>
<b>To:</b> Pan, Xinhui <a href="mailto:Xinhui.Pan@amd.com"><Xinhui.Pan@amd.com></a>;
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <a href="mailto:amd-gfx@lists.freedesktop.org">
<amd-gfx@lists.freedesktop.org></a><br>
<b>Cc:</b> Deucher, Alexander <a href="mailto:Alexander.Deucher@amd.com"><Alexander.Deucher@amd.com></a>; Kuehling, Felix
<a href="mailto:Felix.Kuehling@amd.com"><Felix.Kuehling@amd.com></a><br>
<b>Subject:</b> Re: [PATCH 1/2] drm//amdgpu: Add job fence to resv conditionally</span><span lang="EN-US">
<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US" style="font-size:11.0pt">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 <a href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a><br>
> Cc: Alex Deucher <a href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a><br>
> Cc: Felix Kuehling <a href="mailto:Felix.Kuehling@amd.com"><Felix.Kuehling@amd.com></a><br>
> Suggested-by: Christian König <a href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a><br>
> Signed-off-by: xinhui pan <a href="mailto:xinhui.pan@amd.com"><xinhui.pan@amd.com></a><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);<o:p></o:p></span></p>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal"><span lang="EN-US"><br>
<br>
<o:p></o:p></span></p>
</div>
</body>
</html>