1. 01 Nov, 2023 3 commits
    • Matthew Brost's avatar
      drm/sched: Convert drm scheduler to use a work queue rather than kthread · a6149f03
      Matthew Brost authored
      In Xe, the new Intel GPU driver, a choice has made to have a 1 to 1
      mapping between a drm_gpu_scheduler and drm_sched_entity. At first this
      seems a bit odd but let us explain the reasoning below.
      
      1. In Xe the submission order from multiple drm_sched_entity is not
      guaranteed to be the same completion even if targeting the same hardware
      engine. This is because in Xe we have a firmware scheduler, the GuC,
      which allowed to reorder, timeslice, and preempt submissions. If a using
      shared drm_gpu_scheduler across multiple drm_sched_entity, the TDR falls
      apart as the TDR expects submission order == completion order. Using a
      dedicated drm_gpu_scheduler per drm_sched_entity solve this problem.
      
      2. In Xe submissions are done via programming a ring buffer (circular
      buffer), a drm_gpu_scheduler provides a limit on number of jobs, if the
      limit of number jobs is set to RING_SIZE / MAX_SIZE_PER_JOB we get flow
      control on the ring for free.
      
      A problem with this design is currently a drm_gpu_scheduler uses a
      kthread for submission / job cleanup. This doesn't scale if a large
      number of drm_gpu_scheduler are used. To work around the scaling issue,
      use a worker rather than kthread for submission / job cleanup.
      
      v2:
        - (Rob Clark) Fix msm build
        - Pass in run work queue
      v3:
        - (Boris) don't have loop in worker
      v4:
        - (Tvrtko) break out submit ready, stop, start helpers into own patch
      v5:
        - (Boris) default to ordered work queue
      v6:
        - (Luben / checkpatch) fix alignment in msm_ringbuffer.c
        - (Luben) s/drm_sched_submit_queue/drm_sched_wqueue_enqueue
        - (Luben) Update comment for drm_sched_wqueue_enqueue
        - (Luben) Positive check for submit_wq in drm_sched_init
        - (Luben) s/alloc_submit_wq/own_submit_wq
      v7:
        - (Luben) s/drm_sched_wqueue_enqueue/drm_sched_run_job_queue
      v8:
        - (Luben) Adjust var names / comments
      Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
      Reviewed-by: default avatarLuben Tuikov <luben.tuikov@amd.com>
      Link: https://lore.kernel.org/r/20231031032439.1558703-3-matthew.brost@intel.comSigned-off-by: default avatarLuben Tuikov <ltuikov89@gmail.com>
      a6149f03
    • Matthew Brost's avatar
      drm/sched: Add drm_sched_wqueue_* helpers · 35963cf2
      Matthew Brost authored
      Add scheduler wqueue ready, stop, and start helpers to hide the
      implementation details of the scheduler from the drivers.
      
      v2:
        - s/sched_wqueue/sched_wqueue (Luben)
        - Remove the extra white line after the return-statement (Luben)
        - update drm_sched_wqueue_ready comment (Luben)
      
      Cc: Luben Tuikov <luben.tuikov@amd.com>
      Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
      Reviewed-by: default avatarLuben Tuikov <luben.tuikov@amd.com>
      Link: https://lore.kernel.org/r/20231031032439.1558703-2-matthew.brost@intel.comSigned-off-by: default avatarLuben Tuikov <ltuikov89@gmail.com>
      35963cf2
    • Christian König's avatar
      dma-buf: add dma_fence_timestamp helper · 0da611a8
      Christian König authored
      When a fence signals there is a very small race window where the timestamp
      isn't updated yet. sync_file solves this by busy waiting for the
      timestamp to appear, but on other ocassions didn't handled this
      correctly.
      
      Provide a dma_fence_timestamp() helper function for this and use it in
      all appropriate cases.
      
      Another alternative would be to grab the spinlock when that happens.
      
      v2 by teddy: add a wait parameter to wait for the timestamp to show up, in case
         the accurate timestamp is needed and/or the timestamp is not based on
         ktime (e.g. hw timestamp)
      v3 chk: drop the parameter again for unified handling
      Signed-off-by: default avatarYunxiang Li <Yunxiang.Li@amd.com>
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Fixes: 1774baa6 ("drm/scheduler: Change scheduled fence track v2")
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      CC: stable@vger.kernel.org
      Link: https://patchwork.freedesktop.org/patch/msgid/20230929104725.2358-1-christian.koenig@amd.com
      0da611a8
  2. 31 Oct, 2023 10 commits
  3. 30 Oct, 2023 14 commits
  4. 27 Oct, 2023 10 commits
  5. 26 Oct, 2023 3 commits