<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">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:<br>
</div>
<blockquote type="cite" cite="mid:SN6PR12MB2800ADC4C5ED7DDCAEA288E787FA0@SN6PR12MB2800.namprd12.prod.outlook.com">
<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; ">
</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...</div>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0;
font-family: sans-serif; font-size: 11pt; color: black; ">
<br>
</div>
<div id="ms-outlook-mobile-signature" dir="auto" style="text-align: left;">
<div><br>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b>
Koenig, Christian <a class="moz-txt-link-rfc2396E" 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 class="moz-txt-link-rfc2396E" href="mailto:Xinhui.Pan@amd.com"><Xinhui.Pan@amd.com></a>;
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx@lists.freedesktop.org"><amd-gfx@lists.freedesktop.org></a><br>
<b>Cc:</b> Deucher, Alexander
<a class="moz-txt-link-rfc2396E" href="mailto:Alexander.Deucher@amd.com"><Alexander.Deucher@amd.com></a>; Kuehling, Felix
<a class="moz-txt-link-rfc2396E" 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</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
<a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a><br>
> Cc: Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a><br>
> Cc: Felix Kuehling <a class="moz-txt-link-rfc2396E" href="mailto:Felix.Kuehling@amd.com"><Felix.Kuehling@amd.com></a><br>
> Suggested-by: Christian König
<a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a><br>
> Signed-off-by: xinhui pan
<a class="moz-txt-link-rfc2396E" 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);<br>
<br>
</div>
</span></font></div>
</div>
</blockquote>
<br>
</body>
</html>