drm/i915: Update error capture code to avoid using the current vma state
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Mon, 29 Nov 2021 20:22:45 +0000 (21:22 +0100)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Wed, 1 Dec 2021 15:53:22 +0000 (16:53 +0100)
commitff20afc4cee7b65f752b1da6d5da4c0bea1431b9
tree680b6da2c53baf47e8f146d27e1ed1ae19f53fce
parent49a8bf50caa2fb0fb2eb1c89923ea61192227c32
drm/i915: Update error capture code to avoid using the current vma state

With asynchronous migrations, the vma state may be several migrations
ahead of the state that matches the request we're capturing.
Address that by introducing an i915_vma_snapshot structure that
can be used to snapshot relevant state at request submission.
In order to make sure we access the correct memory, the snapshots take
references on relevant sg-tables and memory regions.

Also move the capture list allocation out of the fence signaling
critical path and use the CONFIG_DRM_I915_CAPTURE_ERROR define to
avoid compiling in members and functions used for error capture
when they're not used.

Finally, Introduce lockdep annotation.

v4:
- Break out the capture allocation mode change to a separate patch.
v5:
- Fix compilation error in the !CONFIG_DRM_I915_CAPTURE_ERROR case
  (kernel test robot)
v6:
- Use #if IS_ENABLED() instead of #ifdef to match driver style.
- Move yet another change of allocation mode to the separate patch.
- Commit message rework due to patch reordering.
v7:
- Adjust for removal of region refcounting.

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211129202245.472043-1-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/i915/Makefile
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
drivers/gpu/drm/i915/gt/intel_engine_cs.c
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/i915_request.c
drivers/gpu/drm/i915/i915_request.h
drivers/gpu/drm/i915/i915_vma_snapshot.c [new file with mode: 0644]
drivers/gpu/drm/i915/i915_vma_snapshot.h [new file with mode: 0644]