Skip to content

RFC GPU scheduler for i915 driver

[email protected] intel-gfx 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest44 patches 44 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/44drm/i915: Corrected 'file_priv' to 'file' in 'i915_driver_preclose()'drivers/gpu/drm/i915/i915_dma.c drivers/gpu/drm/i915/i915_drv.h+6 -62 replies
2/44drm/i915: Added getparam for native syncdrivers/gpu/drm/i915/i915_dma.c include/uapi/drm/i915_drm.h+8 -01 reply
3/44drm/i915: Add extra add_request callsdrivers/gpu/drm/i915/i915_dma.c drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c +4 more+52 -183 replies
4/44drm/i915: Fix null pointer dereference in error capturedrivers/gpu/drm/i915/i915_gpu_error.c+7 -64 replies
5/44drm/i915: Updating assorted register and status page definitionsdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_reg.h drivers/gpu/drm/i915/intel_ringbuffer.h+92 -41 reply
6/44drm/i915: Fixes for FIFO space queriesdrivers/gpu/drm/i915/intel_uncore.c+42 -71 reply
7/44drm/i915: Disable 'get seqno' workaround for VLVdrivers/gpu/drm/i915/intel_ringbuffer.c+4 -12 replies
8/44drm/i915: Added GPU scheduler config optiondrivers/gpu/drm/i915/Kconfig+8 -01 reply
9/44drm/i915: Start of GPU schedulerdrivers/gpu/drm/i915/Makefile drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c +2 more+107 -02 replies
10/44drm/i915: Prepare retire_requests to handle out-of-order seqnosdrivers/gpu/drm/i915/i915_gem.c+32 -283 replies
11/44drm/i915: Added scheduler hook into i915_seqno_passed()drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_irq.c +2 more+54 -101 reply
12/44drm/i915: Disable hardware semaphores when GPU scheduler is enableddrivers/gpu/drm/i915/i915_drv.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h +1 more+23 -01 reply
13/44drm/i915: Added scheduler hook when closing DRM file handlesdrivers/gpu/drm/i915/i915_dma.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+23 -03 replies
14/44drm/i915: Added getparam for GPU schedulerdrivers/gpu/drm/i915/i915_dma.c include/uapi/drm/i915_drm.h+4 -02 replies
15/44drm/i915: Added deferred work handler for schedulerdrivers/gpu/drm/i915/i915_dma.c drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c +2 more+48 -05 replies
16/44drm/i915: Alloc early seqnodrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/intel_ringbuffer.c drivers/gpu/drm/i915/intel_ringbuffer.h+7 -12 replies
17/44drm/i915: Prelude to splitting i915_gem_do_execbuffer in twodrivers/gpu/drm/i915/i915_gem_execbuffer.c+16 -74 replies
18/44drm/i915: Added scheduler debug macroinclude/drm/drmP.h+7 -02 replies
19/44drm/i915: Split i915_dem_do_execbuffer() in halfdrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.h+121 -290 replies
20/44drm/i915: Redirect execbuffer_final() via schedulerdrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+26 -50 replies
21/44drm/i915: Added tracking/locking of batch buffer objectsdrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+80 -30 replies
22/44drm/i915: Ensure OLS & PLR are always in syncdrivers/gpu/drm/i915/intel_ringbuffer.c+19 -80 replies
23/44drm/i915: Added manipulation of OLS/PLRdrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.h+69 -10 replies
24/44drm/i915: Added scheduler interrupt handler hookdrivers/gpu/drm/i915/i915_irq.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+20 -00 replies
25/44drm/i915: Added hook to catch 'unexpected' ring submissionsdrivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+27 -10 replies
26/44drm/i915: Added scheduler support to __wait_seqno() callsdrivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+61 -90 replies
27/44drm/i915: Added scheduler support to page fault handlerdrivers/gpu/drm/i915/i915_gem.c+8 -20 replies
28/44drm/i915: Added scheduler flush calls to ring throttle and idle functionsdrivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+27 -10 replies
29/44drm/i915: Hook scheduler into intel_ring_idle()drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h drivers/gpu/drm/i915/intel_ringbuffer.c+21 -00 replies
30/44drm/i915: Added a module parameter for allowing scheduler overridesdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_params.c drivers/gpu/drm/i915/i915_scheduler.h+10 -00 replies
31/44drm/i915: Implemented the GPU schedulerdrivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+965 -390 replies
32/44drm/i915: Added immediate submission override to schedulerdrivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+6 -20 replies
33/44drm/i915: Added trace points to schedulerdrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_trace.h+226 -10 replies
34/44drm/i915: Added scheduler queue throttling by DRM file handledrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.c +1 more+51 -00 replies
35/44drm/i915: Added debugfs interface to scheduler tuning parametersdrivers/gpu/drm/i915/i915_debugfs.c+117 -00 replies
36/44drm/i915: Added debug state dump facilities to schedulerdrivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+272 -00 replies
37/44drm/i915: Added facility for cancelling an outstanding requestdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c+17 -00 replies
38/44drm/i915: Add early exit to execbuff_final() if insufficient ring spacedrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/intel_ringbuffer.c drivers/gpu/drm/i915/intel_ringbuffer.h+73 -70 replies
39/44drm/i915: Added support for pre-emptive schedulingdrivers/gpu/drm/i915/Kconfig drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_gem_execbuffer.c +4 more+797 -150 replies
40/44drm/i915: REVERTME Hack to allow IGT to test pre-emptiondrivers/gpu/drm/i915/i915_gem_execbuffer.c include/uapi/drm/i915_drm.h+17 -00 replies
41/44drm/i915: Added validation callback to trace pointsdrivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h drivers/gpu/drm/i915/i915_trace.h+36 -00 replies
42/44drm/i915: Added scheduler statistic reporting to debugfsdrivers/gpu/drm/i915/i915_debugfs.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+198 -30 replies
43/44drm/i915: Added support for submitting out-of-batch ring commandsdrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+153 -560 replies
44/44drm/i915: Fake batch support for page flipsdrivers/gpu/drm/i915/intel_display.c+40 -441 reply

Reviews trailers per patch

11 of 44 patches have a Reviewed-by or Acked-by.

PatchJesse Barnes
1/44R-b
2/44
3/44R-b
4/44R-b
5/44R-b
6/44R-b
7/44R-b
8/44
9/44
10/44R-b
11/44
12/44
13/44
14/44R-b
15/44
16/44R-b
17/44R-b
18/44R-b
19/44
20/44
21/44
22/44
23/44
24/44
25/44
26/44
27/44
28/44
29/44
30/44
31/44
32/44
33/44
34/44
35/44
36/44
37/44
38/44
39/44
40/44
41/44
42/44
43/44
44/44

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC 00/44] GPU scheduler for i915 driver

From: John Harrison <[email protected]>

Implemented a batch buffer submission scheduler for the i915 DRM driver.

The general theory of operation is that when batch buffers are submitted to the driver, the execbuffer() code assigns a unique seqno value and then packages up all the information required to execute the batch buffer at a later time. This package is given over to the scheduler which adds it to an internal node list. The scheduler also scans the list of objects associated with the batch buffer and compares them against the objects already in use by other buffers in the node list. If matches are found then the new batch buffer node is marked as being dependent upon the matching node. The same is done for the context object. The scheduler also bumps up the priority of such matching nodes on the grounds that the more dependencies a given batch buffer has the more important it is likely to be.

The scheduler aims to have a given (tuneable) number of batch buffers in flight on the hardware at any given time. If fewer than this are currently executing when a new node is queued, then the node is passed straight through to the submit function. Otherwise it is simply added to the queue and the driver returns back to user land.

As each batch buffer completes, it raises an interrupt which wakes up the scheduler. Note that it is possible for multiple buffers to complete before the IRQ handler gets to run. Further, the seqno values of the individual buffers are not necessary incrementing as the scheduler may have re-ordered their submission. However, the scheduler keeps the list of executing buffers in order of hardware submission. Thus it can scan through the list until a matching seqno is found and then mark all in flight nodes from that point on as completed.

A deferred work queue is also poked by the interrupt handler. When this wakes up it can do more involved processing such as actually removing completed nodes from the queue and freeing up the resources associated with them (internal memory allocations, DRM object references, context reference, etc.). The work handler also checks the in flight count and calls the submission code if a new slot has appeared.

When the scheduler's submit code is called, it scans the queued node list for the highest priority node that has no unmet dependencies. Note that the dependency calculation is complex as it must take inter-ring dependencies and potential preemptions into account. Note also that in the future this will be extended to include external dependencies such as the Android Native Sync file descriptors and/or the linux dma-buff synchronisation scheme.

If a suitable node is found then it is sent to execbuff_final() for submission to the hardware. The in flight count is then re-checked and a new node popped from the list if appropriate.

The scheduler also allows high priority batch buffers (e.g. from a desktop compositor) to jump ahead of whatever is already running if the underlying hardware supports pre-emption. In this situation, any work that was pre-empted is returned to the queued list ready to be resubmitted when no more high priority work is outstanding.

[Patches against drm-intel-nightly tree fetched 30/05/2014]

John Harrison (44):
drm/i915: Corrected 'file_priv' to 'file' in 'i915_driver_preclose()' drm/i915: Added getparam for native sync
drm/i915: Add extra add_request calls
drm/i915: Fix null pointer dereference in error capture drm/i915: Updating assorted register and status page definitions drm/i915: Fixes for FIFO space queries
drm/i915: Disable 'get seqno' workaround for VLV
drm/i915: Added GPU scheduler config option
drm/i915: Start of GPU scheduler
drm/i915: Prepare retire_requests to handle out-of-order seqnos drm/i915: Added scheduler hook into i915_seqno_passed() drm/i915: Disable hardware semaphores when GPU scheduler is enabled drm/i915: Added scheduler hook when closing DRM file handles drm/i915: Added getparam for GPU scheduler
drm/i915: Added deferred work handler for scheduler
drm/i915: Alloc early seqno
drm/i915: Prelude to splitting i915_gem_do_execbuffer in two drm/i915: Added scheduler debug macro
drm/i915: Split i915_dem_do_execbuffer() in half
drm/i915: Redirect execbuffer_final() via scheduler
drm/i915: Added tracking/locking of batch buffer objects drm/i915: Ensure OLS & PLR are always in sync
drm/i915: Added manipulation of OLS/PLR
drm/i915: Added scheduler interrupt handler hook
drm/i915: Added hook to catch 'unexpected' ring submissions drm/i915: Added scheduler support to __wait_seqno() calls drm/i915: Added scheduler support to page fault handler drm/i915: Added scheduler flush calls to ring throttle and idle functions drm/i915: Hook scheduler into intel_ring_idle()
drm/i915: Added a module parameter for allowing scheduler overrides drm/i915: Implemented the GPU scheduler
drm/i915: Added immediate submission override to scheduler drm/i915: Added trace points to scheduler
drm/i915: Added scheduler queue throttling by DRM file handle drm/i915: Added debugfs interface to scheduler tuning parameters drm/i915: Added debug state dump facilities to scheduler drm/i915: Added facility for cancelling an outstanding request drm/i915: Add early exit to execbuff_final() if insufficient ring space drm/i915: Added support for pre-emptive scheduling
drm/i915: REVERTME Hack to allow IGT to test pre-emption drm/i915: Added validation callback to trace points
drm/i915: Added scheduler statistic reporting to debugfs drm/i915: Added support for submitting out-of-batch ring commands drm/i915: Fake batch support for page flips

 drivers/gpu/drm/i915/Kconfig                 |   16 +
 drivers/gpu/drm/i915/Makefile                |    1 +
 drivers/gpu/drm/i915/i915_debugfs.c          |  202 +++
 drivers/gpu/drm/i915/i915_dma.c              |   27 +-
 drivers/gpu/drm/i915/i915_drv.c              |    9 +
 drivers/gpu/drm/i915/i915_drv.h              |   61 +-
 drivers/gpu/drm/i915/i915_gem.c              |  256 +++-
 drivers/gpu/drm/i915/i915_gem_context.c      |    9 +
 drivers/gpu/drm/i915/i915_gem_execbuffer.c   |  658 ++++++++-
 drivers/gpu/drm/i915/i915_gem_render_state.c |    2 +-
 drivers/gpu/drm/i915/i915_gpu_error.c        |   13 +-
 drivers/gpu/drm/i915/i915_irq.c              |    7 +-
 drivers/gpu/drm/i915/i915_params.c           |    4 +
 drivers/gpu/drm/i915/i915_reg.h              |   30 +-
 drivers/gpu/drm/i915/i915_scheduler.c        | 1979 ++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_scheduler.h        |  277 ++++
 drivers/gpu/drm/i915/i915_trace.h            |  223 +++
 drivers/gpu/drm/i915/intel_display.c         |   92 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c      |   80 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h      |   68 +-
 drivers/gpu/drm/i915/intel_uncore.c          |   49 +-
 include/drm/drmP.h                           |    7 +
 include/uapi/drm/i915_drm.h                  |    7 +
 23 files changed, 3880 insertions(+), 197 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_scheduler.c
 create mode 100644 drivers/gpu/drm/i915/i915_scheduler.h
Signature · 1 line
1.7.9.5