All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/39] GPU scheduler for i915 driver
@ 2015-11-23 11:38 John.C.Harrison
  2015-11-23 11:38 ` [PATCH 01/39] drm/i915: Add total count to context status debugfs output John.C.Harrison
                   ` (41 more replies)
  0 siblings, 42 replies; 143+ messages in thread
From: John.C.Harrison @ 2015-11-23 11:38 UTC (permalink / raw)
  To: Intel-GFX

From: John Harrison <John.C.Harrison@Intel.com>

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

-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 143+ messages in thread

end of thread, other threads:[~2016-02-19 10:14 UTC | newest]

Thread overview: 143+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-23 11:38 [PATCH 00/39] GPU scheduler for i915 driver John.C.Harrison
2015-11-23 11:38 ` [PATCH 01/39] drm/i915: Add total count to context status debugfs output John.C.Harrison
2016-01-08  9:50   ` Joonas Lahtinen
2015-11-23 11:38 ` [PATCH 02/39] drm/i915: Updating assorted register and status page definitions John.C.Harrison
2016-01-08 12:26   ` Joonas Lahtinen
2016-01-11  7:47     ` Daniel Vetter
2015-11-23 11:38 ` [PATCH 03/39] drm/i915: Explicit power enable during deferred context initialisation John.C.Harrison
2016-01-08 12:35   ` Joonas Lahtinen
2015-11-23 11:38 ` [PATCH 04/39] drm/i915: Prelude to splitting i915_gem_do_execbuffer in two John.C.Harrison
2015-11-23 11:39 ` [PATCH 05/39] drm/i915: Split i915_dem_do_execbuffer() in half John.C.Harrison
2015-12-11 13:15   ` [PATCH 05/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 06/39] drm/i915: Re-instate request->uniq because it is extremely useful John.C.Harrison
2015-11-23 11:39 ` [PATCH 07/39] drm/i915: Start of GPU scheduler John.C.Harrison
2015-12-11 13:16   ` [PATCH 08/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 08/39] drm/i915: Prepare retire_requests to handle out-of-order seqnos John.C.Harrison
2015-11-23 11:39 ` [PATCH 09/39] drm/i915: Disable hardware semaphores when GPU scheduler is enabled John.C.Harrison
2015-11-23 11:39 ` [PATCH 10/39] drm/i915: Force MMIO flips when scheduler enabled John.C.Harrison
2015-11-23 11:39 ` [PATCH 11/39] drm/i915: Added scheduler hook when closing DRM file handles John.C.Harrison
2015-12-11 13:19   ` [PATCH 12/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 12/39] drm/i915: Added scheduler hook into i915_gem_request_notify() John.C.Harrison
2015-11-23 11:39 ` [PATCH 13/39] drm/i915: Added deferred work handler for scheduler John.C.Harrison
2015-11-23 11:39 ` [PATCH 14/39] drm/i915: Redirect execbuffer_final() via scheduler John.C.Harrison
2015-11-23 11:39 ` [PATCH 15/39] drm/i915: Keep the reserved space mechanism happy John.C.Harrison
2015-12-11 13:19   ` [PATCH 16/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 16/39] drm/i915: Added tracking/locking of batch buffer objects John.C.Harrison
2015-12-11 13:19   ` [PATCH 17/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 17/39] drm/i915: Hook scheduler node clean up into retire requests John.C.Harrison
2015-12-11 13:19   ` [PATCH 18/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 18/39] drm/i915: Added scheduler support to __wait_request() calls John.C.Harrison
2015-12-11 13:20   ` [PATCH 19/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 19/39] drm/i915: Added scheduler support to page fault handler John.C.Harrison
2015-11-23 11:39 ` [PATCH 20/39] drm/i915: Added scheduler flush calls to ring throttle and idle functions John.C.Harrison
2015-12-11 13:20   ` [PATCH 21/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 21/39] drm/i915: Added a module parameter for allowing scheduler overrides John.C.Harrison
2015-11-23 11:39 ` [PATCH 22/39] drm/i915: Support for 'unflushed' ring idle John.C.Harrison
2015-11-23 11:39 ` [PATCH 23/39] drm/i915: Defer seqno allocation until actual hardware submission time John.C.Harrison
2015-12-11 13:20   ` [PATCH 24/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 24/39] drm/i915: Added immediate submission override to scheduler John.C.Harrison
2015-11-23 11:39 ` [PATCH 25/39] drm/i915: Add sync wait support " John.C.Harrison
2015-11-23 11:39 ` [PATCH 26/39] drm/i915: Connecting execbuff fences " John.C.Harrison
2015-11-23 11:39 ` [PATCH 27/39] drm/i915: Added trace points " John.C.Harrison
2015-12-11 13:20   ` [PATCH 28/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 28/39] drm/i915: Added scheduler queue throttling by DRM file handle John.C.Harrison
2015-12-11 13:21   ` [PATCH 29/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 29/39] drm/i915: Added debugfs interface to scheduler tuning parameters John.C.Harrison
2015-11-23 11:39 ` [PATCH 30/39] drm/i915: Added debug state dump facilities to scheduler John.C.Harrison
2015-12-11 13:21   ` [PATCH 31/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 31/39] drm/i915: Add early exit to execbuff_final() if insufficient ring space John.C.Harrison
2015-12-11 13:21   ` [PATCH 32/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 32/39] drm/i915: Added scheduler statistic reporting to debugfs John.C.Harrison
2015-12-11 13:21   ` [PATCH 33/40] " John.C.Harrison
2015-11-23 11:39 ` [PATCH 33/39] drm/i915: Added seqno values to scheduler status dump John.C.Harrison
2015-11-23 11:39 ` [PATCH 34/39] drm/i915: Add scheduler support functions for TDR John.C.Harrison
2015-11-23 11:39 ` [PATCH 35/39] drm/i915: GPU priority bumping to prevent starvation John.C.Harrison
2015-11-23 11:39 ` [PATCH 36/39] drm/i915: Scheduler state dump via debugfs John.C.Harrison
2015-11-23 11:39 ` [PATCH 37/39] drm/i915: Enable GPU scheduler by default John.C.Harrison
2015-11-23 11:39 ` [PATCH 38/39] drm/i915: Add scheduling priority to per-context parameters John.C.Harrison
2015-11-23 11:39 ` [PATCH 39/39] drm/i915: Allow scheduler to manage inter-ring object synchronisation John.C.Harrison
2015-12-11 13:16 ` [PATCH 06/40] drm/i915: Cache request pointer in *_submission_final() John.C.Harrison
2015-12-11 13:23 ` [PATCH 00/40] GPU scheduler for i915 driver John.C.Harrison
2016-01-11 18:42 ` [PATCH v4 00/38] " John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 01/38] drm/i915: Add total count to context status debugfs output John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 02/38] drm/i915: Explicit power enable during deferred context initialisation John.C.Harrison
2016-01-12  0:20     ` Chris Wilson
2016-01-12 11:11       ` John Harrison
2016-01-12 11:28         ` Chris Wilson
2016-01-12 11:50           ` John Harrison
2016-01-12 14:04             ` Daniel Vetter
2016-01-12 14:21               ` John Harrison
2016-01-12 15:35                 ` Daniel Vetter
2016-01-12 15:59                   ` Imre Deak
2016-01-12 16:11                     ` Daniel Vetter
2016-01-12 16:59                       ` Chris Wilson
2016-01-11 18:42   ` [PATCH v4 03/38] drm/i915: Prelude to splitting i915_gem_do_execbuffer in two John.C.Harrison
2016-02-04 17:01     ` Jesse Barnes
2016-02-12 16:18       ` John Harrison
2016-01-11 18:42   ` [PATCH v4 04/38] drm/i915: Split i915_dem_do_execbuffer() in half John.C.Harrison
2016-01-11 22:03     ` Chris Wilson
2016-02-04 17:08     ` Jesse Barnes
2016-01-11 18:42   ` [PATCH v4 05/38] drm/i915: Cache request pointer in *_submission_final() John.C.Harrison
2016-02-04 17:09     ` Jesse Barnes
2016-01-11 18:42   ` [PATCH v4 06/38] drm/i915: Re-instate request->uniq because it is extremely useful John.C.Harrison
2016-01-11 22:04     ` Chris Wilson
2016-01-12 11:16       ` John Harrison
2016-01-11 18:42   ` [PATCH v4 07/38] drm/i915: Start of GPU scheduler John.C.Harrison
2016-01-20 13:18     ` Joonas Lahtinen
2016-02-18 14:22       ` John Harrison
2016-02-19 10:13         ` Joonas Lahtinen
2016-01-11 18:42   ` [PATCH v4 08/38] drm/i915: Prepare retire_requests to handle out-of-order seqnos John.C.Harrison
2016-01-11 22:10     ` Chris Wilson
2016-02-04 17:14       ` Jesse Barnes
2016-01-11 18:42   ` [PATCH v4 09/38] drm/i915: Disable hardware semaphores when GPU scheduler is enabled John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 10/38] drm/i915: Force MMIO flips when scheduler enabled John.C.Harrison
2016-01-11 22:16     ` Chris Wilson
2016-01-12 11:19       ` John Harrison
2016-01-12 14:07         ` Daniel Vetter
2016-01-12 21:53           ` Chris Wilson
2016-01-13 12:37             ` John Harrison
2016-01-13 13:14               ` Chris Wilson
2016-01-11 18:42   ` [PATCH v4 11/38] drm/i915: Added scheduler hook when closing DRM file handles John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 12/38] drm/i915: Added scheduler hook into i915_gem_request_notify() John.C.Harrison
2016-01-11 22:14     ` Chris Wilson
2016-01-12 11:25       ` John Harrison
2016-01-11 18:42   ` [PATCH v4 13/38] drm/i915: Added deferred work handler for scheduler John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 14/38] drm/i915: Redirect execbuffer_final() via scheduler John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 15/38] drm/i915: Keep the reserved space mechanism happy John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 16/38] drm/i915: Added tracking/locking of batch buffer objects John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 17/38] drm/i915: Hook scheduler node clean up into retire requests John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 18/38] drm/i915: Added scheduler support to __wait_request() calls John.C.Harrison
2016-01-11 23:14     ` Chris Wilson
2016-01-12 11:28       ` John Harrison
2016-01-11 18:42   ` [PATCH v4 19/38] drm/i915: Added scheduler support to page fault handler John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 20/38] drm/i915: Added scheduler flush calls to ring throttle and idle functions John.C.Harrison
2016-01-11 22:20     ` Chris Wilson
2016-01-11 18:42   ` [PATCH v4 21/38] drm/i915: Added a module parameter for allowing scheduler overrides John.C.Harrison
2016-01-11 22:24     ` Chris Wilson
2016-01-12 11:34       ` John Harrison
2016-01-12 11:55         ` Chris Wilson
2016-01-11 18:42   ` [PATCH v4 22/38] drm/i915: Support for 'unflushed' ring idle John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 23/38] drm/i915: Defer seqno allocation until actual hardware submission time John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 24/38] drm/i915: Added immediate submission override to scheduler John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 25/38] drm/i915: Added trace points " John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 26/38] drm/i915: Added scheduler queue throttling by DRM file handle John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 27/38] drm/i915: Added debugfs interface to scheduler tuning parameters John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 28/38] drm/i915: Added debug state dump facilities to scheduler John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 29/38] drm/i915: Add early exit to execbuff_final() if insufficient ring space John.C.Harrison
2016-01-11 18:42   ` [PATCH v4 30/38] drm/i915: Added scheduler statistic reporting to debugfs John.C.Harrison
2016-01-11 18:43   ` [PATCH v4 31/38] drm/i915: Added seqno values to scheduler status dump John.C.Harrison
2016-01-11 18:43   ` [PATCH v4 32/38] drm/i915: Add scheduler support functions for TDR John.C.Harrison
2016-01-11 18:43   ` [PATCH v4 33/38] drm/i915: GPU priority bumping to prevent starvation John.C.Harrison
2016-01-11 18:43   ` [PATCH v4 34/38] drm/i915: Scheduler state dump via debugfs John.C.Harrison
2016-01-11 18:43   ` [PATCH v4 35/38] drm/i915: Enable GPU scheduler by default John.C.Harrison
2016-01-11 18:43   ` [PATCH v4 36/38] drm/i915: Add scheduling priority to per-context parameters John.C.Harrison
2016-01-11 18:43   ` [PATCH v4 37/38] drm/i915: Add support for retro-actively banning batch buffers John.C.Harrison
2016-01-11 18:43   ` [PATCH v4 38/38] drm/i915: Allow scheduler to manage inter-ring object synchronisation John.C.Harrison
2016-01-11 22:07     ` Chris Wilson
2016-01-12 11:38       ` John Harrison
2016-01-11 18:43   ` [PATCH] igt/gem_ctx_param_basic: Updated to support scheduler priority interface John.C.Harrison
2016-01-11 23:52   ` [PATCH v4 00/38] GPU scheduler for i915 driver Chris Wilson
2016-01-12  4:37   ` Tian, Kevin
2016-01-12 11:43     ` John Harrison
2016-01-12 13:49       ` Dave Gordon
2016-01-13  2:33         ` Tian, Kevin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.