<div dir="ltr">Hi Christian,<br><div><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 8, 2018 at 4:20 PM Christian König <<a href="mailto:ckoenig.leichtzumerken@gmail.com">ckoenig.leichtzumerken@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ping, Nayan any comments on that or can I commit it?<br>
<br>
This is just a stripped down version of my original last_scheduled <br>
improvement patch.<br>
<br></blockquote><div>I had missed the mail yesterday. I was just looking at the code right now. The code looks fine but I wanted to run it once before giving it a Rb. <br><br></div><div>I was wondering why you stripped it down. Was there some problem with the previous one?<br><br></div><div>Cheers,<br></div><div>Nayan <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Christian.<br>
<br>
Am 07.08.2018 um 14:54 schrieb Christian König:<br>
> Make sure we access last_scheduled only after checking that there are no<br>
> more jobs on the entity.<br>
><br>
> Signed-off-by: Christian König <<a href="mailto:christian.koenig@amd.com" target="_blank">christian.koenig@amd.com</a>><br>
> ---<br>
> drivers/gpu/drm/scheduler/gpu_scheduler.c | 21 +++++++++++----------<br>
> 1 file changed, 11 insertions(+), 10 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c<br>
> index 8ee249886473..bd7883d1b964 100644<br>
> --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c<br>
> +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c<br>
> @@ -568,19 +568,20 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job,<br>
> struct drm_sched_entity *entity)<br>
> {<br>
> struct drm_sched_rq *rq = entity->rq;<br>
> - bool first, reschedule, idle;<br>
> + bool first;<br>
> <br>
> - idle = entity->last_scheduled == NULL ||<br>
> - dma_fence_is_signaled(entity->last_scheduled);<br>
> first = spsc_queue_count(&entity->job_queue) == 0;<br>
> - reschedule = idle && first && (entity->num_rq_list > 1);<br>
> + if (first && (entity->num_rq_list > 1)) {<br>
> + struct dma_fence *fence;<br>
> <br>
> - if (reschedule) {<br>
> - rq = drm_sched_entity_get_free_sched(entity);<br>
> - spin_lock(&entity->rq_lock);<br>
> - drm_sched_rq_remove_entity(entity->rq, entity);<br>
> - entity->rq = rq;<br>
> - spin_unlock(&entity->rq_lock);<br>
> + fence = READ_ONCE(entity->last_scheduled);<br>
> + if (fence == NULL || dma_fence_is_signaled(fence)) {<br>
> + rq = drm_sched_entity_get_free_sched(entity);<br>
> + spin_lock(&entity->rq_lock);<br>
> + drm_sched_rq_remove_entity(entity->rq, entity);<br>
> + entity->rq = rq;<br>
> + spin_unlock(&entity->rq_lock);<br>
> + }<br>
> }<br>
> <br>
> sched_job->sched = entity->rq->sched;<br>
<br>
</blockquote></div></div></div>