drm/i915: Coordinate i915_active with its own mutex
Forgo the struct_mutex serialisation for i915_active, and interpose its own mutex handling for active/retire. This is a multi-layered sleight-of-hand. First, we had to ensure that no active/retire callbacks accidentally inverted the mutex ordering rules, nor assumed that they were themselves serialised by struct_mutex. More challenging though, is the rule over updating elements of the active rbtree. Instead of the whole i915_active now being serialised by struct_mutex, allocations/rotations of the tree are serialised by the i915_active.mutex and individual nodes are serialised by the caller using the i915_timeline.mutex (we need to use nested spinlocks to interact with the dma_fence callback lists). The pain point here is that instead of a single mutex around execbuf, we now have to take a mutex for active tracker (one for each vma, context, etc) and a couple of spinlocks for each fence update. The improvement in fine grained locking allowing for multiple concurrent clients (eventually!) should be worth it in typical loads. v2: Add some comments that barely elucidate anything :( Signed-off-by:Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by:
Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191004134015.13204-6-chris@chris-wilson.co.uk
Showing
- drivers/gpu/drm/i915/display/intel_frontbuffer.c 1 addition, 1 deletiondrivers/gpu/drm/i915/display/intel_frontbuffer.c
- drivers/gpu/drm/i915/display/intel_overlay.c 1 addition, 2 deletionsdrivers/gpu/drm/i915/display/intel_overlay.c
- drivers/gpu/drm/i915/gem/i915_gem_context.c 1 addition, 3 deletionsdrivers/gpu/drm/i915/gem/i915_gem_context.c
- drivers/gpu/drm/i915/gem/i915_gem_object_types.h 1 addition, 0 deletionsdrivers/gpu/drm/i915/gem/i915_gem_object_types.h
- drivers/gpu/drm/i915/gem/i915_gem_pm.c 3 additions, 6 deletionsdrivers/gpu/drm/i915/gem/i915_gem_pm.c
- drivers/gpu/drm/i915/gt/intel_context.c 2 additions, 2 deletionsdrivers/gpu/drm/i915/gt/intel_context.c
- drivers/gpu/drm/i915/gt/intel_engine_pool.c 1 addition, 1 deletiondrivers/gpu/drm/i915/gt/intel_engine_pool.c
- drivers/gpu/drm/i915/gt/intel_reset.c 5 additions, 5 deletionsdrivers/gpu/drm/i915/gt/intel_reset.c
- drivers/gpu/drm/i915/gt/intel_timeline.c 3 additions, 4 deletionsdrivers/gpu/drm/i915/gt/intel_timeline.c
- drivers/gpu/drm/i915/gt/intel_timeline_types.h 5 additions, 4 deletionsdrivers/gpu/drm/i915/gt/intel_timeline_types.h
- drivers/gpu/drm/i915/gt/selftest_context.c 6 additions, 10 deletionsdrivers/gpu/drm/i915/gt/selftest_context.c
- drivers/gpu/drm/i915/gt/selftest_lrc.c 7 additions, 3 deletionsdrivers/gpu/drm/i915/gt/selftest_lrc.c
- drivers/gpu/drm/i915/gt/selftests/mock_timeline.c 1 addition, 1 deletiondrivers/gpu/drm/i915/gt/selftests/mock_timeline.c
- drivers/gpu/drm/i915/gvt/scheduler.c 0 additions, 3 deletionsdrivers/gpu/drm/i915/gvt/scheduler.c
- drivers/gpu/drm/i915/i915_active.c 156 additions, 166 deletionsdrivers/gpu/drm/i915/i915_active.c
- drivers/gpu/drm/i915/i915_active.h 58 additions, 261 deletionsdrivers/gpu/drm/i915/i915_active.h
- drivers/gpu/drm/i915/i915_active_types.h 6 additions, 17 deletionsdrivers/gpu/drm/i915/i915_active_types.h
- drivers/gpu/drm/i915/i915_gem.c 26 additions, 16 deletionsdrivers/gpu/drm/i915/i915_gem.c
- drivers/gpu/drm/i915/i915_gem_gtt.c 1 addition, 2 deletionsdrivers/gpu/drm/i915/i915_gem_gtt.c
- drivers/gpu/drm/i915/i915_gpu_error.c 2 additions, 2 deletionsdrivers/gpu/drm/i915/i915_gpu_error.c
Loading
Please register or sign in to comment