<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">I would also prefer to update the SPM
VMID register using PM4 packets instead of the current handling.<br>
<br>
Regards,<br>
Christian.<br>
<br>
Am 20.04.20 um 09:50 schrieb Liu, Monk:<br>
</div>
<blockquote type="cite"
cite="mid:DM5PR12MB1708E9E86CD1A92C54A1969284D40@DM5PR12MB1708.namprd12.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<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:"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:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.xmsonormal, li.xmsonormal, div.xmsonormal
{mso-style-name:x_msonormal;
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.xmsochpdefault, li.xmsochpdefault, div.xmsochpdefault
{mso-style-name:x_msochpdefault;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.xmsohyperlink
{mso-style-name:x_msohyperlink;
color:#0563C1;
text-decoration:underline;}
span.xmsohyperlinkfollowed
{mso-style-name:x_msohyperlinkfollowed;
color:#954F72;
text-decoration:underline;}
span.xemailstyle17
{mso-style-name:x_emailstyle17;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle25
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
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]-->
<div class="WordSection1">
<p class="MsoNormal">I just try to explain what I want to do
here, no real patch formalized yet
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">_____________________________________<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:12.0pt;color:black;background:white">Monk
Liu|GPU Virtualization Team |</span><span
style="font-size:12.0pt;color:#C82613;border:none
windowtext 1.0pt;padding:0in;background:white">AMD<o:p></o:p></span></p>
<p class="MsoNormal"><img style="width:.8333in;height:.8333in"
id="Picture_x0020_1"
src="cid:part1.C3FD06B1.31D84B93@gmail.com"
alt="sig-cloud-gpu" class="" width="80" height="80"><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> He, Jacob
<a class="moz-txt-link-rfc2396E" href="mailto:Jacob.He@amd.com"><Jacob.He@amd.com></a> <br>
<b>Sent:</b> Monday, April 20, 2020 3:45 PM<br>
<b>To:</b> Liu, Monk <a class="moz-txt-link-rfc2396E" href="mailto:Monk.Liu@amd.com"><Monk.Liu@amd.com></a>; Koenig,
Christian <a class="moz-txt-link-rfc2396E" href="mailto:Christian.Koenig@amd.com"><Christian.Koenig@amd.com></a><br>
<b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<b>Subject:</b> Re: why we need to do infinite RLC_SPM
register setting during VM flush<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:15.0pt"><span
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"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt;color:black">Do you miss a file
which adds </span><span
style="color:#201F1E;background:white">spm_updated</span><span
style="font-size:12.0pt;color:black"> to vm structure?<o:p></o:p></span></p>
</div>
<div class="MsoNormal" style="text-align:center"
align="center">
<hr width="98%" size="2" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span
style="color:black"> Liu, Monk <<a
href="mailto:Monk.Liu@amd.com" moz-do-not-send="true">Monk.Liu@amd.com</a>><br>
<b>Sent:</b> Monday, April 20, 2020 3:32 PM<br>
<b>To:</b> He, Jacob <<a
href="mailto:Jacob.He@amd.com" moz-do-not-send="true">Jacob.He@amd.com</a>>;
Koenig, Christian <<a
href="mailto:Christian.Koenig@amd.com"
moz-do-not-send="true">Christian.Koenig@amd.com</a>><br>
<b>Cc:</b> <a
href="mailto:amd-gfx@lists.freedesktop.org"
moz-do-not-send="true">amd-gfx@lists.freedesktop.org</a>
<<a href="mailto:amd-gfx@lists.freedesktop.org"
moz-do-not-send="true">amd-gfx@lists.freedesktop.org</a>><br>
<b>Subject:</b> why we need to do infinite RLC_SPM
register setting during VM flush</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="xmsonormal">Hi Jaco & Christian<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">As titled , check below patch:<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">commit
10790a09ea584cc832353a5c2a481012e5e31a13<o:p></o:p></p>
<p class="xmsonormal">Author: Jacob He <<a
href="mailto:jacob.he@amd.com" moz-do-not-send="true">jacob.he@amd.com</a>><o:p></o:p></p>
<p class="xmsonormal">Date: Fri Feb 28 20:24:41 2020
+0800<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal"> drm/amdgpu: Update SPM_VMID with
the job's vmid when application reserves the vmid<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal"> SPM access the video memory
according to SPM_VMID. It should be updated<o:p></o:p></p>
<p class="xmsonormal"> with the job's vmid right before
the job is scheduled. SPM_VMID is a<o:p></o:p></p>
<p class="xmsonormal"> global resource<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal"> Change-Id:
Id3881908960398f87e7c95026a54ff83ff826700<o:p></o:p></p>
<p class="xmsonormal"> Signed-off-by: Jacob He <<a
href="mailto:jacob.he@amd.com" moz-do-not-send="true">jacob.he@amd.com</a>><o:p></o:p></p>
<p class="xmsonormal"> Reviewed-by: Christian König
<<a href="mailto:christian.koenig@amd.com"
moz-do-not-send="true">christian.koenig@amd.com</a>><o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<o:p></o:p></p>
<p class="xmsonormal">index 6e6fc8c..ba2236a 100644<o:p></o:p></p>
<p class="xmsonormal">---
a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<o:p></o:p></p>
<p class="xmsonormal">+++
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<o:p></o:p></p>
<p class="xmsonormal">@@ -1056,8 +1056,12 @@ int
amdgpu_vm_flush(struct amdgpu_ring *ring, struct
amdgpu_job *job,<o:p></o:p></p>
<p class="xmsonormal"> struct dma_fence *fence =
NULL;<o:p></o:p></p>
<p class="xmsonormal"> bool pasid_mapping_needed =
false;<o:p></o:p></p>
<p class="xmsonormal"> unsigned patch_offset = 0;<o:p></o:p></p>
<p class="xmsonormal">+ bool update_spm_vmid_needed
= (job->vm &&
(job->vm->reserved_vmid[vmhub] != NULL));<o:p></o:p></p>
<p class="xmsonormal"> int r;<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">+ if (update_spm_vmid_needed
&& adev->gfx.rlc.funcs->update_spm_vmid)<o:p></o:p></p>
<p class="xmsonormal">+
adev->gfx.rlc.funcs->update_spm_vmid(adev,
job->vmid);<o:p></o:p></p>
<p class="xmsonormal">+<o:p></o:p></p>
<p class="xmsonormal"> if
(amdgpu_vmid_had_gpu_reset(adev, id)) {<o:p></o:p></p>
<p class="xmsonormal"> gds_switch_needed =
true;<o:p></o:p></p>
<p class="xmsonormal"> vm_flush_needed =
true;<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">this update_spm_vmid() looks an
completely overkill to me, we only need to do it once
for its VM …<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">in SRIOV the register
reading/writing for update_spm_vmid() is now carried by
KIQ thus there is too much burden on KIQ for such
unnecessary jobs …<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">I want to change it to only do it
once per VM, like:<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<o:p></o:p></p>
<p class="xmsonormal">index 6e6fc8c..ba2236a 100644<o:p></o:p></p>
<p class="xmsonormal">---
a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<o:p></o:p></p>
<p class="xmsonormal">+++
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<o:p></o:p></p>
<p class="xmsonormal">@@ -1056,8 +1056,12 @@ int
amdgpu_vm_flush(struct amdgpu_ring *ring, struct
amdgpu_job *job,<o:p></o:p></p>
<p class="xmsonormal"> struct dma_fence *fence =
NULL;<o:p></o:p></p>
<p class="xmsonormal"> bool pasid_mapping_needed =
false;<o:p></o:p></p>
<p class="xmsonormal"> unsigned patch_offset = 0;<o:p></o:p></p>
<p class="xmsonormal">+ bool update_spm_vmid_needed
= (job->vm &&
(job->vm->reserved_vmid[vmhub] != NULL));<o:p></o:p></p>
<p class="xmsonormal"> int r;<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">+ if (update_spm_vmid_needed
&& adev->gfx.rlc.funcs->update_spm_vmid
&& !vm->spm_updated) {<o:p></o:p></p>
<p class="xmsonormal">+
adev->gfx.rlc.funcs->update_spm_vmid(adev,
job->vmid);
<o:p></o:p></p>
<p class="xmsonormal">+ vm->spm_updated =
true;<o:p></o:p></p>
<p class="xmsonormal">+ }<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal"> if
(amdgpu_vmid_had_gpu_reset(adev, id)) {<o:p></o:p></p>
<p class="xmsonormal"> gds_switch_needed =
true;<o:p></o:p></p>
<p class="xmsonormal"> vm_flush_needed =
true;<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">what do you think ?<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">P.S.: the best way is to let GFX
ring itself to do the update_spm_vmid() instead of let
CPU doing it, e.g.: we put more PM4 command in VM-FLUSH
packets ….
<o:p></o:p></p>
<p class="xmsonormal">But I prefer the simple way first
like I demonstrated above
<o:p></o:p></p>
<p class="xmsonormal">_____________________________________<o:p></o:p></p>
<p class="xmsonormal"><span
style="font-size:12.0pt;color:black;background:white">Monk
Liu|GPU Virtualization Team |</span><span
style="font-size:12.0pt;color:#C82613;border:none
windowtext 1.0pt;padding:0in;background:white">AMD</span><o:p></o:p></p>
<p class="xmsonormal"><img
style="width:.8333in;height:.8333in"
id="x_Picture_x0020_1"
src="cid:part1.C3FD06B1.31D84B93@gmail.com"
alt="sig-cloud-gpu" class="" width="80" height="80"
border="0"><o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
amd-gfx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
</pre>
</blockquote>
<br>
</body>
</html>