<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">Thanks Monk for the summary!</span></font></div>
<div class=""><br class="">
</div>
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">Hi Nicolai,</span></font></div>
<font face="Calibri" class=""><span style="font-size: 14px;" class="">In order to block the usage of new context reference the old allocation, i think we need to do something in UMD so that KMD don’t need to monitor the resource list.</span></font>
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">I want to make sure we are on the same page.</span></font></div>
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">If you agree, then there might have two options to do that in UMD: (You can do whatever you want, i just want to elaborate the idea a little bit to facilitate the discussion).<br class="">
</span></font>
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">-  If sharelist is valid, driver need to compare the current vram_lost_count and share list’s vram_lost count, The context will fail to create if share list created before the
 reset. </span></font></div>
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">- Or, we can copy the vram_lost count from the sharelist, kernel will fail the submission if the vram_lost count is smaller than current one. </span></font></div>
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">I personally want to go first for OrcaGL.</span></font></div>
<div class=""><br class="">
</div>
<div class="">Thanks.</div>
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">Best Regards,</span></font></div>
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">David</span></font></div>
<div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">-<br class="">
</span></font>
<div>
<blockquote type="cite" class="">
<div class="">On 12 Oct 2017, at 4:03 PM, Liu, Monk <<a href="mailto:Monk.Liu@amd.com" class="">Monk.Liu@amd.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">V2 summary<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">Hi team<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<b class=""><span lang="EN-US" class="">please give your comments</span></b><span lang="EN-US" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">When
 a job timed out (set from lockup_timeout kernel parameter), What KMD should do in TDR routine :<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">1.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Update
 adev-><b class="">gpu_reset_counter</b>, and stop scheduler first<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">2.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Set
 its fence error status to<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">ECANCELED</span></b>”<span lang="EN-US" class="">,<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">3.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Find
 the<span class="Apple-converted-space"> </span><b class="">context</b><span class="Apple-converted-space"> </span>behind this job, and set this<span class="Apple-converted-space"> </span><b class="">context</b><span class="Apple-converted-space"> </span>as<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">guilty</span></b>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>(will
 have a new member field in context structure –<span class="Apple-converted-space"> </span><b class="">bool guilty</b>)<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">a)<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">      <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">There
 will be “<b class="">bool * guilty</b>” in entity structure, which points to its father context’s member – “<b class="">bool guilty”<span class="Apple-converted-space"> </span></b>when context initialized<b class=""><span class="Apple-converted-space"> </span></b>,
 so no matter we get context or entity, we always know if it is “guilty”<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">b)<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">      <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">For
 kernel entity that used for VM updates, there is no context back it, so kernel entity’s “bool *guilty” always “NULL”.<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">c)<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">The
 idea to skip the whole context is for consistence consideration, because we’ll fake signal the hang job in job_run(), so all jobs in its context shall be dropped otherwise either bad drawing/computing results or more GPU hang.<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: 0cm; font-size: 10.5pt; font-family: 等线;" class="">
<b class=""><span lang="EN-US" class=""><o:p class=""> </o:p></span></b></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">4.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Do
 GPU reset, which is can be some callbacks to let bare-metal and SR-IOV implement with their favor style<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">5.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">After
 reset, KMD need to aware if the VRAM lost happens or not, bare-metal can implement some function to judge, while for SR-IOV I prefer to read it from GIM side (for initial version we consider it</span>’<span lang="EN-US" class="">s always VRAM lost, till GIM
 side change aligned)<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">6.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">If
 VRAM lost hit, update adev-><b class="">vram_lost_counter</b>.<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">7.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Do
 GTT recovery and shadow buffer recovery.<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">8.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Re-schedule
 all JOBs in mirror list and restart scheduler<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">For
 GPU scheduler function --- job_run()<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">1.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Before
 schedule a job to ring, checks if job-><b class="">vram_lost_counter</b><span class="Apple-converted-space"> </span>== adev-><b class="">vram_lost_counter</b>, and drop this job if mismatch<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">2.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Before
 schedule a job to ring, checks if job->entity-><b class="">guilty</b><span class="Apple-converted-space"> </span>is NULL or not,<span class="Apple-converted-space"> </span><b class="">and drop this job if (guilty!=NULL && *guilty == TRUE)</b><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">3.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">if
 a job is dropped:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 63pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">a)<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">      <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">set
 job’s sched_fence status to “<b class="">ECANCELED</b>”<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 63pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">b)<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">      <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">fake/force
 signal job’s hw fence (no need to set hw fence’s status)<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">For
 cs_wait() IOCTL:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">After it found fence signaled, it should check if there is error on this fence and return the error status of this fence<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">For
 cs_wait_fences() IOCTL:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">Similar with above approach<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">For
 cs_submit() IOCTL:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">1.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">check
 if current ctx been marked<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">guilty</span></b>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>and return<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">ECANCELED</span></b>”<span class="Apple-converted-space"> </span><span lang="EN-US" class=""> if
 so.<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">2.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">set
 job-><b class="">vram_lost_counter</b><span class="Apple-converted-space"> </span>with adev-><b class="">vram_lost_counter</b>, and return “<b class="">ECANCELED</b>” if ctx-><b class="">vram_lost_counter</b><span class="Apple-converted-space"> </span>!= job-><b class="">vram_lost_counter</b>(Christian
 already submitted this patch)<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">a)<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">      <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">discussion:
 can we return “ENODEV” if vram_lost_counter mismatch ? that way UMD know this context is under “device lost”<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Introduce
 a new IOCTL to let UMD query latest adev-><b class="">vram_lost_counter</b>:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">For
 amdgpu_ctx_query():<span class="Apple-converted-space"> </span><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">n<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><b class=""><span lang="EN-US" class="">Don’t
 update ctx->reset_counter when querying this function, otherwise the query result is not consistent<o:p class=""></o:p></span></b></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">n<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Set
 out->state.reset_status to “AMDGPU_CTX_GUILTY_RESET” if the ctx is “<b class="">guilty</b>”, no need to check “ctx->reset_counter”<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">n<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Set
 out->state.reset_status to “AMDGPU_CTX_INNOCENT_RESET”<b class="">if the ctx isn’t “guilty” && ctx->reset_counter != adev->reset_counter<span class="Apple-converted-space"> </span></b><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">n<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Set
 out->state.reset_status to “AMDGPU_CTX_NO_RESET” if ctx->reset_counter == adev->reset_counter<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">n<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Set
 out->state.flags to “AMDGPU_CTX_FLAG_VRAM_LOST” if ctx->vram_lost_counter != adev->vram_lost_counter<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 63pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">u<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">discussion:
 can we return “ENODEV” for amdgpu_ctx_query() if ctx->vram_lost_counter != adev->vram_lost_counter ? that way UMD know this context is under “device lost”<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">n<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">UMD
 shall release this context if it is AMDGPU_CTX_GUILTY_RESET or its flags is “AMDGPU_CTX_FLAG_VRAM_LOST”<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: 0cm; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">For UMD behavior we still have something need to consider:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">If MESA creates a new context from an old context (share list?? I’m not familiar with UMD , David Mao shall have some discuss on it with Nicolai), the new created context’s vram_lost_counter<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">And reset_counter shall all be ported from that old context , otherwise CS_SUBMIT will not block it which isn’t correct<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">Need your feedback, thx<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div class="">
<div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(225, 225, 225); padding: 3pt 0cm 0cm;" class="">
<div style="margin: 0cm 0cm 0.0001pt; text-align: left; font-size: 10.5pt; font-family: 等线;" class="">
<b class=""><span lang="EN-US" style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">From:</span></b><span lang="EN-US" style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span class="Apple-converted-space"> </span>amd-gfx [<a href="mailto:amd-gfx-bounces@lists.freedesktop.org" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">mailto:amd-gfx-bounces@lists.freedesktop.org</a>]<span class="Apple-converted-space"> </span><b class="">On
 Behalf Of<span class="Apple-converted-space"> </span></b>Liu, Monk<br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>2017</span><span style="font-size: 11pt; font-family: 宋体;" class="">年</span><span lang="EN-US" style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">10</span><span style="font-size: 11pt; font-family: 宋体;" class="">月</span><span lang="EN-US" style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">11</span><span style="font-size: 11pt; font-family: 宋体;" class="">日</span><span lang="EN-US" style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span class="Apple-converted-space"> </span>13:34<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span>Koenig, Christian <<a href="mailto:Christian.Koenig@amd.com" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">Christian.Koenig@amd.com</a>>; Haehnle, Nicolai <<a href="mailto:Nicolai.Haehnle@amd.com" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">Nicolai.Haehnle@amd.com</a>>;
 Olsak, Marek <<a href="mailto:Marek.Olsak@amd.com" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">Marek.Olsak@amd.com</a>>; Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">Alexander.Deucher@amd.com</a>><br class="">
<b class="">Cc:</b><span class="Apple-converted-space"> </span>Ramirez, Alejandro <<a href="mailto:Alejandro.Ramirez@amd.com" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">Alejandro.Ramirez@amd.com</a>>;<span class="Apple-converted-space"> </span><a href="mailto:amd-gfx@lists.freedesktop.org" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">amd-gfx@lists.freedesktop.org</a>;
 Filipas, Mario <<a href="mailto:Mario.Filipas@amd.com" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">Mario.Filipas@amd.com</a>>; Ding, Pixel <<a href="mailto:Pixel.Ding@amd.com" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">Pixel.Ding@amd.com</a>>;
 Li, Bingley <<a href="mailto:Bingley.Li@amd.com" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">Bingley.Li@amd.com</a>>; Jiang, Jerry (SW) <<a href="mailto:Jerry.Jiang@amd.com" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">Jerry.Jiang@amd.com</a>><br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>TDR and VRAM lost handling in KMD:<o:p class=""></o:p></span></div>
</div>
</div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: left; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">Hi Christian & Nicolai,<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">We need to achieve some agreements on what should MESA/UMD do and what should KMD do,<span class="Apple-converted-space"> </span><b class="">please give your comments with<span class="Apple-converted-space"> </span></b></span><b class="">“<span lang="EN-US" class="">okay</span>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>or<span class="Apple-converted-space"> </span></span>“<span lang="EN-US" class="">No</span>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>and
 your idea on below items,</span></b><span lang="EN-US" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">When
 a job timed out (set from lockup_timeout kernel parameter), What KMD should do in TDR routine :<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">1.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Update
 adev-><b class="">gpu_reset_counter</b>, and stop scheduler first, (<b class="">gpu_reset_counter</b><span class="Apple-converted-space"> </span>is used to force vm flush after GPU reset, out of this thread</span>’<span lang="EN-US" class="">s scope so no
 more discussion on it)<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">2.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Set
 its fence error status to<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">ETIME</span></b>”<span lang="EN-US" class="">,<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">3.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Find
 the entity/ctx behind this job, and set this ctx as<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">guilty</span></b>”<span lang="EN-US" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">4.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Kick
 out this job from scheduler</span>’<span lang="EN-US" class="">s mirror list, so this job won</span>’<span lang="EN-US" class="">t get re-scheduled to ring anymore.<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">5.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Kick
 out all jobs in this<span class="Apple-converted-space"> </span></span>“<span lang="EN-US" class="">guilty</span>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>ctx</span>’<span lang="EN-US" class="">s KFIFO queue, and set all their
 fence status to<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">ECANCELED</span></b>”<span lang="EN-US" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<b class=""><span lang="EN-US" class=""><span class="">6.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">      <span class="Apple-converted-space"> </span></span></span></span></b><span lang="EN-US" class="">Force
 signal all fences that get kicked out by above two steps,<b class=""><span class="Apple-converted-space"> </span>otherwise UMD will block forever if waiting on those fences<o:p class=""></o:p></b></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">7.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Do
 gpu reset, which is can be some callbacks to let bare-metal and SR-IOV implement with their favor style<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">8.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">After
 reset, KMD need to aware if the VRAM lost happens or not, bare-metal can implement some function to judge, while for SR-IOV I prefer to read it from GIM side (for initial version we consider it</span>’<span lang="EN-US" class="">s always VRAM lost, till GIM
 side change aligned)<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">9.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">If
 VRAM lost not hit, continue, otherwise:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">a)<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">      <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Update
 adev-><b class="">vram_lost_counter</b>,<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">b)<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">      <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Iterate
 over all living ctx, and set all ctx as<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">guilty</span></b>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>since VRAM lost actually ruins all
 VRAM contents<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 42pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">c)<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">       <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Kick
 out all jobs in all ctx</span>’<span lang="EN-US" class="">s KFIFO queue, and set all their fence status to<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">ECANCELDED</span></b>”<span lang="EN-US" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">10.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">    <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Do
 GTT recovery and VRAM page tables/entries recovery (optional, do we need it ???)<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><span class="">11.<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class="">    <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Re-schedule
 all JOBs remains in mirror list to ring again and restart scheduler (for VRAM lost case, no JOB will re-scheduled)<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">For
 cs_wait() IOCTL:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">After it found fence signaled, it should check with<span class="Apple-converted-space"> </span></span><b class="">“<span lang="EN-US" class="">dma_fence_get_status</span>”<span class="Apple-converted-space"> </span></b><span lang="EN-US" class="">to
 see if there is error there,<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">And return the error status of fence<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">For
 cs_wait_fences() IOCTL:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">Similar with above approach<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">For
 cs_submit() IOCTL:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">It need to check if current ctx been marked as<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">guilty</span></b>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>and
 return<span class="Apple-converted-space"> </span></span>“<b class=""><span lang="EN-US" class="">ECANCELED</span></b>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>if so<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Introduce
 a new IOCTL to let UMD query<span class="Apple-converted-space"> </span><b class="">vram_lost_counter</b>:<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">This way, UMD can also block app from submitting, like @Nicolai mentioned, we can cache one copy of<span class="Apple-converted-space"> </span><b class="">vram_lost_counter</b><span class="Apple-converted-space"> </span>when enumerate
 physical device, and deny all<span class="Apple-converted-space"> </span><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">gl-context from submitting if the counter queried bigger than that one cached in physical device. (looks a little overkill to me, but easy to implement )<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">UMD can also return error to APP when creating gl-context if found current queried<b class=""><span class="Apple-converted-space"> </span>vram_lost_counter<span class="Apple-converted-space"> </span></b>bigger than that one cached
 in physical device.<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">BTW: I realized that gl-context is a little different with kernel</span>’<span lang="EN-US" class="">s context. Because for kernel. BO is not related with context but only with FD, while in UMD, BO have a backend<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">gl-context, so block submitting in UMD layer is also needed although KMD will do its job as bottom line<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; text-indent: -21pt; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" style="font-family: Wingdings;" class=""><span class="">l<span style="font-style: normal; font-variant-caps: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';" class=""> <span class="Apple-converted-space"> </span></span></span></span><span lang="EN-US" class="">Basically<span class="Apple-converted-space"> </span></span>“<span lang="EN-US" class="">vram_lost_counter</span>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>is
 exposure by kernel to let UMD take the control of robust extension feature, it will be UMD</span>’<span lang="EN-US" class="">s call to move, KMD only deny<span class="Apple-converted-space"> </span></span>“<span lang="EN-US" class="">guilty</span>”<span lang="EN-US" class=""><span class="Apple-converted-space"> </span>context
 from submitting<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">Need your feedback, thx<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">We</span>’<span lang="EN-US" class="">d better make TDR feature landed ASAP<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线;" class="">
<span lang="EN-US" class="">BR Monk</span></div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</body>
</html>