<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 07/30/2018 09:30 AM, Nayan Deshmukh
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFd4ddzC3f1HC+fmmD2wSOcC96SHpi=5-mnwC7EWaknErKOpQg@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div dir="ltr"><br>
        <br>
        <div class="gmail_quote">
          <div dir="ltr">On Mon, Jul 30, 2018 at 4:33 PM Christian König
            <<a href="mailto:ckoenig.leichtzumerken@gmail.com"
              target="_blank" moz-do-not-send="true">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">We removed
            the redundancy of having an extra scheduler field, so we<br>
            can't set the rq to NULL any more or otherwise won't know
            which<br>
            scheduler to use for the cleanup.<br>
            <br>
            Just remove the entity from the scheduling list instead.<br>
            <br>
            Signed-off-by: Christian König <<a
              href="mailto:christian.koenig@amd.com" target="_blank"
              moz-do-not-send="true">christian.koenig@amd.com</a>><br>
          </blockquote>
          <div>Good catch.<br>
             <br>
          </div>
          <div>Acked-by: Nayan Deshmukh <<a
              href="mailto:nayan26deshmukh@gmail.com" target="_blank"
              moz-do-not-send="true">nayan26deshmukh@gmail.com</a>> <br>
          </div>
          <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 | 35
            +++++++------------------------<br>
             1 file changed, 8 insertions(+), 27 deletions(-)<br>
            <br>
            diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c
            b/drivers/gpu/drm/scheduler/gpu_scheduler.c<br>
            index f563e4fbb4b6..1b733229201e 100644<br>
            --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c<br>
            +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c<br>
            @@ -198,21 +198,6 @@ int drm_sched_entity_init(struct
            drm_sched_entity *entity,<br>
             }<br>
             EXPORT_SYMBOL(drm_sched_entity_init);<br>
            <br>
            -/**<br>
            - * drm_sched_entity_is_initialized - Query if entity is
            initialized<br>
            - *<br>
            - * @sched: Pointer to scheduler instance<br>
            - * @entity: The pointer to a valid scheduler entity<br>
            - *<br>
            - * return true if entity is initialized, false otherwise<br>
            -*/<br>
            -static bool drm_sched_entity_is_initialized(struct
            drm_gpu_scheduler *sched,<br>
            -                                           struct
            drm_sched_entity *entity)<br>
            -{<br>
            -       return entity->rq != NULL &&<br>
            -               entity->rq->sched == sched;<br>
            -}<br>
            -<br>
             /**<br>
              * drm_sched_entity_is_idle - Check if entity is idle<br>
              *<br>
            @@ -224,7 +209,8 @@ static bool
            drm_sched_entity_is_idle(struct drm_sched_entity *entity)<br>
             {<br>
                    rmb();<br>
            <br>
            -       if (!entity->rq ||
            spsc_queue_peek(&entity->job_queue) == NULL)<br>
            +       if (list_empty(&entity->list) ||<br>
            +           spsc_queue_peek(&entity->job_queue) ==
            NULL)<br>
                            return true;<br>
            <br>
                    return false;<br>
            @@ -279,8 +265,6 @@ long drm_sched_entity_flush(struct
            drm_sched_entity *entity, long timeout)<br>
                    long ret = timeout;<br>
            <br>
                    sched = entity->rq->sched;<br>
            -       if (!drm_sched_entity_is_initialized(sched, entity))<br>
            -               return ret;<br>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
    Just to be clear, you remove this function because it's redundant to
    call it?<br>
    <br>
    Andrey<br>
    <br>
    <blockquote type="cite"
cite="mid:CAFd4ddzC3f1HC+fmmD2wSOcC96SHpi=5-mnwC7EWaknErKOpQg@mail.gmail.com">
      <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">
                    /**<br>
                     * The client will not queue more IBs during this
            fini, consume existing<br>
                     * queued IBs or discard them on SIGKILL<br>
            @@ -299,7 +283,7 @@ long drm_sched_entity_flush(struct
            drm_sched_entity *entity, long timeout)<br>
                    last_user = cmpxchg(&entity->last_user,
            current->group_leader, NULL);<br>
                    if ((!last_user || last_user ==
            current->group_leader) &&<br>
                        (current->flags & PF_EXITING) &&
            (current->exit_code == SIGKILL))<br>
            -               drm_sched_entity_set_rq(entity, NULL);<br>
            +               drm_sched_rq_remove_entity(entity->rq,
            entity);<br>
            <br>
                    return ret;<br>
             }<br>
            @@ -320,7 +304,7 @@ void drm_sched_entity_fini(struct
            drm_sched_entity *entity)<br>
                    struct drm_gpu_scheduler *sched;<br>
            <br>
                    sched = entity->rq->sched;<br>
            -       drm_sched_entity_set_rq(entity, NULL);<br>
            +       drm_sched_rq_remove_entity(entity->rq, entity);<br>
            <br>
                    /* Consumption of existing IBs wasn't completed.
            Forcefully<br>
                     * remove them here.<br>
            @@ -416,15 +400,12 @@ void drm_sched_entity_set_rq(struct
            drm_sched_entity *entity,<br>
                    if (entity->rq == rq)<br>
                            return;<br>
            <br>
            -       spin_lock(&entity->rq_lock);<br>
            -<br>
            -       if (entity->rq)<br>
            -               drm_sched_rq_remove_entity(entity->rq,
            entity);<br>
            +       BUG_ON(!rq);<br>
            <br>
            +       spin_lock(&entity->rq_lock);<br>
            +       drm_sched_rq_remove_entity(entity->rq, entity);<br>
                    entity->rq = rq;<br>
            -       if (rq)<br>
            -               drm_sched_rq_add_entity(rq, entity);<br>
            -<br>
            +       drm_sched_rq_add_entity(rq, entity);<br>
                    spin_unlock(&entity->rq_lock);<br>
             }<br>
             EXPORT_SYMBOL(drm_sched_entity_set_rq);<br>
            -- <br>
            2.14.1<br>
            <br>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
dri-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/dri-devel">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>