linux/drivers/gpu/drm/i915/gt
Chris Wilson ce476c80b8 drm/i915: Keep contexts pinned until after the next kernel context switch
We need to keep the context image pinned in memory until after the GPU
has finished writing into it. Since it continues to write as we signal
the final breadcrumb, we need to keep it pinned until the request after
it is complete. Currently we know the order in which requests execute on
each engine, and so to remove that presumption we need to identify a
request/context-switch we know must occur after our completion. Any
request queued after the signal must imply a context switch, for
simplicity we use a fresh request from the kernel context.

The sequence of operations for keeping the context pinned until saved is:

 - On context activation, we preallocate a node for each physical engine
   the context may operate on. This is to avoid allocations during
   unpinning, which may be from inside FS_RECLAIM context (aka the
   shrinker)

 - On context deactivation on retirement of the last active request (which
   is before we know the context has been saved), we add the
   preallocated node onto a barrier list on each engine

 - On engine idling, we emit a switch to kernel context. When this
   switch completes, we know that all previous contexts must have been
   saved, and so on retiring this request we can finally unpin all the
   contexts that were marked as deactivated prior to the switch.

We can enhance this in future by flushing all the idle contexts on a
regular heartbeat pulse of a switch to kernel context, which will also
be used to check for hung engines.

v2: intel_context_active_acquire/_release

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190614164606.15633-1-chris@chris-wilson.co.uk
2019-06-14 19:03:32 +01:00
..
intel_breadcrumbs.c drm/i915: Seal races between async GPU cancellation, retirement and signaling 2019-05-08 16:02:41 +01:00
intel_context_types.h drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
intel_context.c drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
intel_context.h drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
intel_engine_cs.c drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
intel_engine_pm.c drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
intel_engine_pm.h drm/i915/execlists: Flush the tasklet on parking 2019-05-03 11:35:31 +01:00
intel_engine_types.h drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
intel_engine.h drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
intel_gpu_commands.h drm/i915: add in-kernel blitter client 2019-05-30 12:01:44 +01:00
intel_gt_pm.c drm/i915: make intel_wakeref work on the rpm struct 2019-06-14 15:58:33 +01:00
intel_gt_pm.h drm/i915: Invert the GEM wakeref hierarchy 2019-04-24 22:26:49 +01:00
intel_hangcheck.c drm/i915: update rpm_get/put to use the rpm structure 2019-06-14 15:58:33 +01:00
intel_lrc_reg.h
intel_lrc.c drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
intel_lrc.h drm/i915: Move more GEM objects under gem/ 2019-05-28 12:45:29 +01:00
intel_mocs.c
intel_mocs.h
intel_reset.c drm/i915: update with_intel_runtime_pm to use the rpm structure 2019-06-14 15:58:33 +01:00
intel_reset.h drm/i915: Move i915_check_and_clear_faults to intel_reset.c 2019-06-10 09:09:26 +01:00
intel_ringbuffer.c drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
intel_sseu.c Revert "drm/i915: Expand subslice mask" 2019-05-29 17:18:18 +03:00
intel_sseu.h Revert "drm/i915: Expand subslice mask" 2019-05-29 17:18:18 +03:00
intel_workarounds_types.h
intel_workarounds.c Revert "drm/i915: Expand subslice mask" 2019-05-29 17:18:18 +03:00
intel_workarounds.h
Makefile
Makefile.header-test
mock_engine.c drm/i915: Keep contexts pinned until after the next kernel context switch 2019-06-14 19:03:32 +01:00
mock_engine.h drm/i915: Split engine setup/init into two phases 2019-04-26 18:32:07 +01:00
selftest_engine_cs.c
selftest_hangcheck.c drm/i915: update rpm_get/put to use the rpm structure 2019-06-14 15:58:33 +01:00
selftest_lrc.c drm/i915: update rpm_get/put to use the rpm structure 2019-06-14 15:58:33 +01:00
selftest_reset.c drm/i915: update with_intel_runtime_pm to use the rpm structure 2019-06-14 15:58:33 +01:00
selftest_workarounds.c drm/i915: update with_intel_runtime_pm to use the rpm structure 2019-06-14 15:58:33 +01:00