<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div>commit d6c650c0a8f6f671e49553725e1db541376d95f2<br>
Author: Nicolai Hähnle <nicolai.haehnle@amd.com><br>
@@ -611,6 +611,10 @@ static int amd_sched_main(void *param)<br>
 <br>
                fence = sched->ops->run_job(sched_job);<br>
                amd_sched_fence_scheduled(s_fence);<br>
+<br>
+               /* amd_sched_process_job drops the job's reference of the fence. */<br>
+               sched_job->s_fence = NULL;<br>
+<br>
                if (fence) {<br>
                        s_fence->parent = dma_fence_get(fence);<br>
                        r = dma_fence_add_callback(fence, &s_fence->cb,<br>
<br>
</div>
<p></p>
<p>Hi Nicolai</p>
<p><br>
</p>
<p>with this patch, you will break "amdgpu_sched_hw_job_reset()"routine:</p>
<p></p>
<div style="color: #d4d4d4;background-color: #1e1e1e;font-family: 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;">
<div><span style="color: #569cd6;">void</span><span style="color: #d4d4d4;"> </span>
<span style="color: #dcdcaa;">amd_sched_hw_job_reset</span><span style="color: #d4d4d4;">(</span><span style="color: #569cd6;">struct</span><span style="color: #d4d4d4;"> amd_gpu_scheduler
</span><span style="color: #d4d4d4;">*</span><span style="color: #d4d4d4;">sched)</span></div>
<div><span style="color: #d4d4d4;">{</span></div>
<div><span style="color: #d4d4d4;">    </span><span style="color: #569cd6;">struct</span><span style="color: #d4d4d4;"> amd_sched_job
</span><span style="color: #d4d4d4;">*</span><span style="color: #d4d4d4;">s_job;</span></div>
<br>
<div><span style="color: #d4d4d4;">    </span><span style="color: #dcdcaa;">spin_lock</span><span style="color: #d4d4d4;">(</span><span style="color: #d4d4d4;">&</span><span style="color: #d4d4d4;">sched-></span><span style="color: #9cdcfe;">job_list_lock</span><span style="color: #d4d4d4;">);</span></div>
<div><span style="color: #d4d4d4;">    </span><span style="color: #dcdcaa;">list_for_each_entry_reverse</span><span style="color: #d4d4d4;">(s_job,
</span><span style="color: #d4d4d4;">&</span><span style="color: #d4d4d4;">sched-></span><span style="color: #9cdcfe;">ring_mirror_list</span><span style="color: #d4d4d4;">, node) {</span></div>
<div><span style="color: #d4d4d4;">        </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (s_job-></span><span style="color: #9cdcfe;">s_fence</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">parent</span><span style="color: #d4d4d4;">
</span><span style="color: #d4d4d4;">&&</span></div>
<div><span style="color: #d4d4d4;">         </span><span style="color: #dcdcaa;">fence_remove_callback</span><span style="color: #d4d4d4;">(s_job-></span><span style="color: #9cdcfe;">s_fence</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">parent</span><span style="color: #d4d4d4;">,</span></div>
<div><span style="color: #d4d4d4;">                     </span><span style="color: #d4d4d4;">&</span><span style="color: #d4d4d4;">s_job-></span><span style="color: #9cdcfe;">s_fence</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">cb</span><span style="color: #d4d4d4;">))
 {</span></div>
<div><span style="color: #d4d4d4;">            </span><span style="color: #dcdcaa;">fence_put</span><span style="color: #d4d4d4;">(s_job-></span><span style="color: #9cdcfe;">s_fence</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">parent</span><span style="color: #d4d4d4;">);</span></div>
<div><span style="color: #d4d4d4;">            s_job-></span><span style="color: #9cdcfe;">s_fence</span><span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">parent</span><span style="color: #d4d4d4;">
</span><span style="color: #d4d4d4;">=</span><span style="color: #d4d4d4;"> </span>
<span style="color: #569cd6;">NULL</span><span style="color: #d4d4d4;">;</span></div>
<div><span style="color: #d4d4d4;">            </span><span style="color: #dcdcaa;">atomic_dec</span><span style="color: #d4d4d4;">(</span><span style="color: #d4d4d4;">&</span><span style="color: #d4d4d4;">sched-></span><span style="color: #9cdcfe;">hw_rq_count</span><span style="color: #d4d4d4;">);</span></div>
<div><span style="color: #d4d4d4;">        }</span></div>
<div><span style="color: #d4d4d4;">    }</span></div>
<div><span style="color: #d4d4d4;">    </span><span style="color: #dcdcaa;">spin_unlock</span><span style="color: #d4d4d4;">(</span><span style="color: #d4d4d4;">&</span><span style="color: #d4d4d4;">sched-></span><span style="color: #9cdcfe;">job_list_lock</span><span style="color: #d4d4d4;">);</span></div>
<div><span style="color: #d4d4d4;">}</span></div>
</div>
<p></p>
<p><br>
</p>
<p>see that without sched_job->s_fence, you cannot remove the callback from its hw fence,</p>
<p><br>
</p>
<p>any idea??</p>
<p><br>
</p>
<p>BR Monk<br>
</p>
<p><br>
</p>
<p><br>
</p>
</div>
</body>
</html>