<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 8, 2018 at 4:42 PM Nayan Deshmukh <<a href="mailto:nayan26deshmukh@gmail.com">nayan26deshmukh@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 8, 2018 at 4:36 PM Christian König <<a href="mailto:ckoenig.leichtzumerken@gmail.com" target="_blank">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">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div class="m_4530807054036902076m_266081010531689909moz-cite-prefix">Am 08.08.2018 um 12:55 schrieb Nayan
      Deshmukh:<br>
    </div>
    <blockquote type="cite">
      
      <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" target="_blank">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>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    No, not really. But this is a bug fix and bug fixes should be as
    simple as possible.<br>
    <br>
    Improvements should come in separate patches. Didn't thought
    initially that this is actually a fix.<br>
    <br>
    BTW: Another small fix is required, looks like we need the scheduler
    correctly set for debugging even earlier.<br></div></blockquote><div>Yes I saw the mail earlier. I can work on the patch if you have not started working on it already. <br></div></div></div></blockquote><div>I guess I was late for this. I will look at your patch now. <br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>Nayan  <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
    <br>
    Christian.<br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div class="gmail_quote">
            <div><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></blockquote></div></div></div></blockquote></div></blockquote></div></div></blockquote><div>Reviewed-by: Nayan Deshmukh <<a href="mailto:nayan26deshmukh@gmail.com">nayan26deshmukh@gmail.com</a>> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><blockquote type="cite"><div dir="ltr"><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              > ---<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>
    </blockquote>
    <br>
  </div>

</blockquote></div></div>
</blockquote></div></div>