<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    I've pushed the scheduler patch to drm-misc-next and the whole set
    to amd-staging-drm-next.<br>
    <br>
    Christian.<br>
    <br>
    <div class="moz-cite-prefix">Am 21.04.23 um 15:40 schrieb Deucher,
      Alexander:<br>
    </div>
    <blockquote type="cite"
cite="mid:BL1PR12MB5144DF199535F1DC66F981F4F7609@BL1PR12MB5144.namprd12.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <p
        style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;"
        align="Left">
        [AMD Official Use Only - General]<br>
      </p>
      <br>
      <div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0); background-color:
          rgb(255, 255, 255);" class="elementToProof">
          Sure.  We can pull it into amd-staging-drm-next as well if we
          need it for any customers in the short term.</div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0); background-color:
          rgb(255, 255, 255);" class="elementToProof">
          <br>
        </div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0); background-color:
          rgb(255, 255, 255);" class="elementToProof">
          Alex<br>
        </div>
        <hr style="display:inline-block;width:98%" tabindex="-1">
        <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
            face="Calibri, sans-serif" color="#000000"><b>From:</b>
            Christian König <a class="moz-txt-link-rfc2396E" href="mailto:ckoenig.leichtzumerken@gmail.com"><ckoenig.leichtzumerken@gmail.com></a><br>
            <b>Sent:</b> Friday, April 21, 2023 9:27 AM<br>
            <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
            <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx@lists.freedesktop.org"><amd-gfx@lists.freedesktop.org></a>; Deucher, Alexander
            <a class="moz-txt-link-rfc2396E" href="mailto:Alexander.Deucher@amd.com"><Alexander.Deucher@amd.com></a><br>
            <b>Cc:</b> Tuikov, Luben <a class="moz-txt-link-rfc2396E" href="mailto:Luben.Tuikov@amd.com"><Luben.Tuikov@amd.com></a><br>
            <b>Subject:</b> Re: [PATCH 1/8] drm/scheduler: properly
            forward fence errors</font>
          <div> </div>
        </div>
        <div class="BodyFragment"><font size="2"><span
              style="font-size:11pt;">
              <div class="PlainText">Alex can I merge that through
                drm-misc-next or do we really need
                <br>
                amd-staging-drm-next?<br>
                <br>
                Christian.<br>
                <br>
                Am 21.04.23 um 07:22 schrieb Luben Tuikov:<br>
                > Hi Christian,<br>
                ><br>
                > Thanks for working on this.<br>
                ><br>
                > Series is,<br>
                > Reviewed-by: Luben Tuikov
                <a class="moz-txt-link-rfc2396E" href="mailto:luben.tuikov@amd.com"><luben.tuikov@amd.com></a><br>
                ><br>
                > Regards,<br>
                > Luben<br>
                ><br>
                > On 2023-04-20 07:57, Christian König wrote:<br>
                >> When a hw fence is signaled with an error
                properly forward that to the<br>
                >> finished fence.<br>
                >><br>
                >> Signed-off-by: Christian König
                <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a><br>
                >> ---<br>
                >>   drivers/gpu/drm/scheduler/sched_entity.c |  4
                +---<br>
                >>   drivers/gpu/drm/scheduler/sched_fence.c  |  4
                +++-<br>
                >>   drivers/gpu/drm/scheduler/sched_main.c   | 18
                ++++++++----------<br>
                >>   include/drm/gpu_scheduler.h              |  2
                +-<br>
                >>   4 files changed, 13 insertions(+), 15
                deletions(-)<br>
                >><br>
                >> diff --git
                a/drivers/gpu/drm/scheduler/sched_entity.c
                b/drivers/gpu/drm/scheduler/sched_entity.c<br>
                >> index 15d04a0ec623..eaf71fe15ed3 100644<br>
                >> --- a/drivers/gpu/drm/scheduler/sched_entity.c<br>
                >> +++ b/drivers/gpu/drm/scheduler/sched_entity.c<br>
                >> @@ -144,7 +144,7 @@ static void
                drm_sched_entity_kill_jobs_work(struct work_struct *wrk)<br>
                >>   {<br>
                >>       struct drm_sched_job *job =
                container_of(wrk, typeof(*job), work);<br>
                >>   <br>
                >> -    drm_sched_fence_finished(job->s_fence);<br>
                >> +    drm_sched_fence_finished(job->s_fence,
                -ESRCH);<br>
                >>       WARN_ON(job->s_fence->parent);<br>
                >>       job->sched->ops->free_job(job);<br>
                >>   }<br>
                >> @@ -195,8 +195,6 @@ static void
                drm_sched_entity_kill(struct drm_sched_entity *entity)<br>
                >>       while ((job =
                to_drm_sched_job(spsc_queue_pop(&entity->job_queue))))
                {<br>
                >>               struct drm_sched_fence *s_fence =
                job->s_fence;<br>
                >>   <br>
                >> -           
                dma_fence_set_error(&s_fence->finished, -ESRCH);<br>
                >> -<br>
                >>              
                dma_fence_get(&s_fence->finished);<br>
                >>               if (!prev ||
                dma_fence_add_callback(prev, &job->finish_cb,<br>
                >>                                         
                drm_sched_entity_kill_jobs_cb))<br>
                >> diff --git
                a/drivers/gpu/drm/scheduler/sched_fence.c
                b/drivers/gpu/drm/scheduler/sched_fence.c<br>
                >> index 7fd869520ef2..1a6bea98c5cc 100644<br>
                >> --- a/drivers/gpu/drm/scheduler/sched_fence.c<br>
                >> +++ b/drivers/gpu/drm/scheduler/sched_fence.c<br>
                >> @@ -53,8 +53,10 @@ void
                drm_sched_fence_scheduled(struct drm_sched_fence *fence)<br>
                >>      
                dma_fence_signal(&fence->scheduled);<br>
                >>   }<br>
                >>   <br>
                >> -void drm_sched_fence_finished(struct
                drm_sched_fence *fence)<br>
                >> +void drm_sched_fence_finished(struct
                drm_sched_fence *fence, int result)<br>
                >>   {<br>
                >> +    if (result)<br>
                >> +           
                dma_fence_set_error(&fence->finished, result);<br>
                >>      
                dma_fence_signal(&fence->finished);<br>
                >>   }<br>
                >>   <br>
                >> diff --git
                a/drivers/gpu/drm/scheduler/sched_main.c
                b/drivers/gpu/drm/scheduler/sched_main.c<br>
                >> index fcd4bfef7415..649fac2e1ccb 100644<br>
                >> --- a/drivers/gpu/drm/scheduler/sched_main.c<br>
                >> +++ b/drivers/gpu/drm/scheduler/sched_main.c<br>
                >> @@ -257,7 +257,7 @@
                drm_sched_rq_select_entity_fifo(struct drm_sched_rq *rq)<br>
                >>    *<br>
                >>    * Finish the job's fence and wake up the
                worker thread.<br>
                >>    */<br>
                >> -static void drm_sched_job_done(struct
                drm_sched_job *s_job)<br>
                >> +static void drm_sched_job_done(struct
                drm_sched_job *s_job, int result)<br>
                >>   {<br>
                >>       struct drm_sched_fence *s_fence =
                s_job->s_fence;<br>
                >>       struct drm_gpu_scheduler *sched =
                s_fence->sched;<br>
                >> @@ -268,7 +268,7 @@ static void
                drm_sched_job_done(struct drm_sched_job *s_job)<br>
                >>       trace_drm_sched_process_job(s_fence);<br>
                >>   <br>
                >>       dma_fence_get(&s_fence->finished);<br>
                >> -    drm_sched_fence_finished(s_fence);<br>
                >> +    drm_sched_fence_finished(s_fence, result);<br>
                >>       dma_fence_put(&s_fence->finished);<br>
                >>      
                wake_up_interruptible(&sched->wake_up_worker);<br>
                >>   }<br>
                >> @@ -282,7 +282,7 @@ static void
                drm_sched_job_done_cb(struct dma_fence *f, struct
                dma_fence_cb *cb)<br>
                >>   {<br>
                >>       struct drm_sched_job *s_job =
                container_of(cb, struct drm_sched_job, cb);<br>
                >>   <br>
                >> -    drm_sched_job_done(s_job);<br>
                >> +    drm_sched_job_done(s_job, f->error);<br>
                >>   }<br>
                >>   <br>
                >>   /**<br>
                >> @@ -533,12 +533,12 @@ void
                drm_sched_start(struct drm_gpu_scheduler *sched, bool
                full_recovery)<br>
                >>                       r =
                dma_fence_add_callback(fence, &s_job->cb,<br>
>>                                                 
                drm_sched_job_done_cb);<br>
                >>                       if (r == -ENOENT)<br>
                >> -                           
                drm_sched_job_done(s_job);<br>
                >> +                           
                drm_sched_job_done(s_job, fence->error);<br>
                >>                       else if (r)<br>
                >>                              
                DRM_DEV_ERROR(sched->dev, "fence add callback failed
                (%d)\n",<br>
                >>                                         r);<br>
                >>               } else<br>
                >> -                    drm_sched_job_done(s_job);<br>
                >> +                    drm_sched_job_done(s_job,
                0);<br>
                >>       }<br>
                >>   <br>
                >>       if (full_recovery) {<br>
                >> @@ -1010,15 +1010,13 @@ static int
                drm_sched_main(void *param)<br>
                >>                       r =
                dma_fence_add_callback(fence, &sched_job->cb,<br>
>>                                                 
                drm_sched_job_done_cb);<br>
                >>                       if (r == -ENOENT)<br>
                >> -                           
                drm_sched_job_done(sched_job);<br>
                >> +                           
                drm_sched_job_done(sched_job, fence->error);<br>
                >>                       else if (r)<br>
                >>                              
                DRM_DEV_ERROR(sched->dev, "fence add callback failed
                (%d)\n",<br>
                >>                                         r);<br>
                >>               } else {<br>
                >> -                    if (IS_ERR(fence))<br>
                >> -                           
                dma_fence_set_error(&s_fence->finished,
                PTR_ERR(fence));<br>
                >> -<br>
                >> -                   
                drm_sched_job_done(sched_job);<br>
                >> +                   
                drm_sched_job_done(sched_job, IS_ERR(fence) ?<br>
                >> +                                      
                PTR_ERR(fence) : 0);<br>
                >>               }<br>
                >>   <br>
                >>              
                wake_up(&sched->job_scheduled);<br>
                >> diff --git a/include/drm/gpu_scheduler.h
                b/include/drm/gpu_scheduler.h<br>
                >> index ca857ec9e7eb..5c1df6b12ced 100644<br>
                >> --- a/include/drm/gpu_scheduler.h<br>
                >> +++ b/include/drm/gpu_scheduler.h<br>
                >> @@ -569,7 +569,7 @@ void
                drm_sched_fence_init(struct drm_sched_fence *fence,<br>
                >>   void drm_sched_fence_free(struct
                drm_sched_fence *fence);<br>
                >>   <br>
                >>   void drm_sched_fence_scheduled(struct
                drm_sched_fence *fence);<br>
                >> -void drm_sched_fence_finished(struct
                drm_sched_fence *fence);<br>
                >> +void drm_sched_fence_finished(struct
                drm_sched_fence *fence, int result);<br>
                >>   <br>
                >>   unsigned long
                drm_sched_suspend_timeout(struct drm_gpu_scheduler
                *sched);<br>
                >>   void drm_sched_resume_timeout(struct
                drm_gpu_scheduler *sched,<br>
                <br>
              </div>
            </span></font></div>
      </div>
    </blockquote>
    <br>
  </body>
</html>