Skip to content

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 Latest39 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/39drm/i915: Add total count to context status debugfs outputdrivers/gpu/drm/i915/i915_debugfs.c+4 -01 reply
2/39drm/i915: Updating assorted register and status page definitionsdrivers/gpu/drm/i915/i915_reg.h drivers/gpu/drm/i915/intel_ringbuffer.h+58 -42 replies
3/39drm/i915: Explicit power enable during deferred context initialisationdrivers/gpu/drm/i915/intel_lrc.c+8 -11 reply
4/39drm/i915: Prelude to splitting i915_gem_do_execbuffer in twodrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/intel_lrc.c+51 -310 replies
5/39drm/i915: Split i915_dem_do_execbuffer() in halfdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 more+146 -561 reply
6/39drm/i915: Re-instate request->uniq because it is extremely usefuldrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_trace.h+24 -90 replies
7/39drm/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+840 -01 reply
8/39drm/i915: Prepare retire_requests to handle out-of-order seqnosdrivers/gpu/drm/i915/i915_gem.c+13 -180 replies
9/39drm/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+21 -00 replies
10/39drm/i915: Force MMIO flips when scheduler enableddrivers/gpu/drm/i915/intel_display.c+3 -00 replies
11/39drm/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+71 -01 reply
12/39drm/i915: Added scheduler hook into i915_gem_request_notify()drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_scheduler.c +1 more+37 -100 replies
13/39drm/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+35 -20 replies
14/39drm/i915: Redirect execbuffer_final() via schedulerdrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/intel_lrc.c+11 -190 replies
15/39drm/i915: Keep the reserved space mechanism happydrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/intel_lrc.c+22 -21 reply
16/39drm/i915: Added tracking/locking of batch buffer objectsdrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.c+76 -51 reply
17/39drm/i915: Hook scheduler node clean up into retire requestsdrivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+39 -161 reply
18/39drm/i915: Added scheduler support to __wait_request() callsdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_scheduler.c +3 more+151 -111 reply
19/39drm/i915: Added scheduler support to page fault handlerdrivers/gpu/drm/i915/i915_gem.c+7 -20 replies
20/39drm/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+118 -11 reply
21/39drm/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.c +1 more+14 -10 replies
22/39drm/i915: Support for 'unflushed' ring idledrivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/intel_lrc.c drivers/gpu/drm/i915/intel_ringbuffer.c +1 more+19 -60 replies
23/39drm/i915: Defer seqno allocation until actual hardware submission timedrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 more+47 -11 reply
24/39drm/i915: Added immediate submission override to schedulerdrivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+6 -20 replies
25/39drm/i915: Add sync wait support to schedulerdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+146 -50 replies
26/39drm/i915: Connecting execbuff fences to schedulerdrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.c+21 -10 replies
27/39drm/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 +1 more+218 -01 reply
28/39drm/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+46 -01 reply
29/39drm/i915: Added debugfs interface to scheduler tuning parametersdrivers/gpu/drm/i915/i915_debugfs.c+141 -00 replies
30/39drm/i915: Added debug state dump facilities to schedulerdrivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+290 -01 reply
31/39drm/i915: Add early exit to execbuff_final() if insufficient ring spacedrivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/intel_lrc.c drivers/gpu/drm/i915/intel_ringbuffer.c +1 more+109 -151 reply
32/39drm/i915: Added scheduler statistic reporting to debugfsdrivers/gpu/drm/i915/i915_debugfs.c drivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_scheduler.c +1 more+203 -81 reply
33/39drm/i915: Added seqno values to scheduler status dumpdrivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+11 -00 replies
34/39drm/i915: Add scheduler support functions for TDRdrivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+32 -00 replies
35/39drm/i915: GPU priority bumping to prevent starvationdrivers/gpu/drm/i915/i915_debugfs.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+43 -00 replies
36/39drm/i915: Scheduler state dump via debugfsdrivers/gpu/drm/i915/i915_debugfs.c drivers/gpu/drm/i915/i915_scheduler.c drivers/gpu/drm/i915/i915_scheduler.h+44 -40 replies
37/39drm/i915: Enable GPU scheduler by defaultdrivers/gpu/drm/i915/i915_params.c+2 -20 replies
38/39drm/i915: Add scheduling priority to per-context parametersdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem_context.c drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 more+42 -00 replies
39/39drm/i915: Allow scheduler to manage inter-ring object synchronisationdrivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 more+18 -70 replies

Reviews trailers per patch

3 of 39 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

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

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 00/39] 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.

Various IGT tests are in progress to test the scheduler's operation and will follow.

v2: Updated for changes in struct fence patch series and other changes to underlying tree (e.g. removal of cliprects). Also changed priority levels to be signed +/-1023 range and reduced mutex lock usage.

[Patches against drm-intel-nightly tree fetched 17/11/2015 with struct fence conversion patches applied]

Dave Gordon (2):
drm/i915: Updating assorted register and status page definitions drm/i915: Add scheduling priority to per-context parameters

John Harrison (37):
drm/i915: Add total count to context status debugfs output drm/i915: Explicit power enable during deferred context initialisation drm/i915: Prelude to splitting i915_gem_do_execbuffer in two drm/i915: Split i915_dem_do_execbuffer() in half
drm/i915: Re-instate request->uniq because it is extremely useful drm/i915: Start of GPU scheduler
drm/i915: Prepare retire_requests to handle out-of-order seqnos drm/i915: Disable hardware semaphores when GPU scheduler is enabled drm/i915: Force MMIO flips when scheduler enabled
drm/i915: Added scheduler hook when closing DRM file handles drm/i915: Added scheduler hook into i915_gem_request_notify() drm/i915: Added deferred work handler for scheduler
drm/i915: Redirect execbuffer_final() via scheduler
drm/i915: Keep the reserved space mechanism happy
drm/i915: Added tracking/locking of batch buffer objects drm/i915: Hook scheduler node clean up into retire requests drm/i915: Added scheduler support to __wait_request() calls drm/i915: Added scheduler support to page fault handler drm/i915: Added scheduler flush calls to ring throttle and idle functions drm/i915: Added a module parameter for allowing scheduler overrides drm/i915: Support for 'unflushed' ring idle
drm/i915: Defer seqno allocation until actual hardware submission time drm/i915: Added immediate submission override to scheduler drm/i915: Add sync wait support to scheduler
drm/i915: Connecting execbuff fences 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: Add early exit to execbuff_final() if insufficient ring space drm/i915: Added scheduler statistic reporting to debugfs drm/i915: Added seqno values to scheduler status dump drm/i915: Add scheduler support functions for TDR
drm/i915: GPU priority bumping to prevent starvation drm/i915: Scheduler state dump via debugfs
drm/i915: Enable GPU scheduler by default
drm/i915: Allow scheduler to manage inter-ring object synchronisation

 drivers/gpu/drm/i915/Makefile              |    1 +
 drivers/gpu/drm/i915/i915_debugfs.c        |  283 +++++
 drivers/gpu/drm/i915/i915_dma.c            |    6 +
 drivers/gpu/drm/i915/i915_drv.c            |    9 +
 drivers/gpu/drm/i915/i915_drv.h            |   56 +-
 drivers/gpu/drm/i915/i915_gem.c            |  174 ++-
 drivers/gpu/drm/i915/i915_gem_context.c    |   24 +
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  341 ++++--
 drivers/gpu/drm/i915/i915_params.c         |    4 +
 drivers/gpu/drm/i915/i915_reg.h            |   30 +-
 drivers/gpu/drm/i915/i915_scheduler.c      | 1697 ++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_scheduler.h      |  176 +++
 drivers/gpu/drm/i915/i915_trace.h          |  215 +++-
 drivers/gpu/drm/i915/intel_display.c       |   10 +-
 drivers/gpu/drm/i915/intel_lrc.c           |  162 ++-
 drivers/gpu/drm/i915/intel_lrc.h           |    1 +
 drivers/gpu/drm/i915/intel_ringbuffer.c    |   47 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h    |   35 +-
 include/uapi/drm/i915_drm.h                |    1 +
 19 files changed, 3110 insertions(+), 162 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_scheduler.c
 create mode 100644 drivers/gpu/drm/i915/i915_scheduler.h
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx