[Intel-gfx] [PATCH v3 00/63] drm/i915: Remove obj->mm.lock!

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Oct 15 11:25:24 UTC 2020


Finally there, just needs a lot of fixes!

A lot of places were calling certain calls without any object lock held,
with the removal of mm.lock we can no longer do this, and have to fix it.

Phys page handling has to be redone, as nothing protects obj->ops structure,
we have to remove swapping it, and move HAS_STRUCT_PAGE to obj->flags instead.

Userpointer locking is inverted, which we tried to get around with a workqueue.
We correct the lock ordering and try to acquire userptr pages first before taking
any ww locks. This is more compatible with the locking hierarchy, as we may need
to acquire mmap_sem.

The previous versione broke gem_exec_schedule at pi-shared/distinct-iova, but
now that we only unbind when required, this is now fixed.

We also have to fix some dma-work, the command parser and clflush are slightly
reworked to put all memory allocations and pinning in the preparation,
so the work could pass fence annotations.

In a few places like igt_spinner and execlists, we move some part of init to the
first pin, because we need to have the ww lock held and it makes it easier that way.

Finally we convert all selftests, and then remove obj->mm.lock!

Previous version had some issues with hwsp, those are now fixed. A memset was
missing, and has been re-added.

Some issues with userptr double lock popped up. Userptr notifier_lock
is now a spinlock as it should only be held for very short amounts of time
and sleeping is not allowed, and now correctly unlocked when invalidating.

This should fix the remaining test issues.

Test-with: 160251050446.31911.17220822522975733973 at emeril.freedesktop.org

Maarten Lankhorst (62):
  drm/i915: Move cmd parser pinning to execbuffer
  drm/i915: Add missing -EDEADLK handling to execbuf pinning
  drm/i915: Do not share hwsp across contexts any more, v3.
  drm/i915: Pin timeline map after first timeline pin, v3.
  drm/i915: Ensure we hold the object mutex in pin correctly.
  drm/i915: Add gem object locking to madvise.
  drm/i915: Move HAS_STRUCT_PAGE to obj->flags
  drm/i915: Rework struct phys attachment handling
  drm/i915: Convert i915_gem_object_attach_phys() to ww locking
  drm/i915: make lockdep slightly happier about execbuf.
  drm/i915: Disable userptr pread/pwrite support.
  drm/i915: No longer allow exporting userptr through dma-buf
  drm/i915: Reject more ioctls for userptr
  drm/i915: Reject UNSYNCHRONIZED for userptr
  drm/i915: Fix userptr so we do not have to worry about obj->mm.lock,
    v3.
  drm/i915: Flatten obj->mm.lock
  drm/i915: Populate logical context during first pin.
  drm/i915: Make ring submission compatible with obj->mm.lock removal,
    v2.
  drm/i915: Handle ww locking in init_status_page
  drm/i915: Rework clflush to work correctly without obj->mm.lock.
  drm/i915: Pass ww ctx to intel_pin_to_display_plane
  drm/i915: Add object locking to vm_fault_cpu
  drm/i915: Move pinning to inside engine_wa_list_verify()
  drm/i915: Take reservation lock around i915_vma_pin.
  drm/i915: Make intel_init_workaround_bb more compatible with ww
    locking.
  drm/i915: Make __engine_unpark() compatible with ww locking.
  drm/i915: Take obj lock around set_domain ioctl
  drm/i915: Defer pin calls in buffer pool until first use by caller.
  drm/i915: Fix pread/pwrite to work with new locking rules.
  drm/i915: Fix workarounds selftest, part 1
  drm/i915: Add igt_spinner_pin() to allow for ww locking around
    spinner.
  drm/i915: Add ww locking around vm_access()
  drm/i915: Increase ww locking for perf.
  drm/i915: Lock ww in ucode objects correctly
  drm/i915: Add ww locking to dma-buf ops.
  drm/i915: Add missing ww lock in intel_dsb_prepare.
  drm/i915: Fix ww locking in shmem_create_from_object
  drm/i915: Use a single page table lock for each gtt.
  drm/i915/selftests: Prepare huge_pages testcases for obj->mm.lock
    removal.
  drm/i915/selftests: Prepare client blit for obj->mm.lock removal.
  drm/i915/selftests: Prepare coherency tests for obj->mm.lock removal.
  drm/i915/selftests: Prepare context tests for obj->mm.lock removal.
  drm/i915/selftests: Prepare dma-buf tests for obj->mm.lock removal.
  drm/i915/selftests: Prepare execbuf tests for obj->mm.lock removal.
  drm/i915/selftests: Prepare mman testcases for obj->mm.lock removal.
  drm/i915/selftests: Prepare object tests for obj->mm.lock removal.
  drm/i915/selftests: Prepare object blit tests for obj->mm.lock
    removal.
  drm/i915/selftests: Prepare igt_gem_utils for obj->mm.lock removal
  drm/i915/selftests: Prepare context selftest for obj->mm.lock removal
  drm/i915/selftests: Prepare hangcheck for obj->mm.lock removal
  drm/i915/selftests: Prepare execlists for obj->mm.lock removal
  drm/i915/selftests: Prepare mocs tests for obj->mm.lock removal
  drm/i915/selftests: Prepare ring submission for obj->mm.lock removal
  drm/i915/selftests: Prepare timeline tests for obj->mm.lock removal
  drm/i915/selftests: Prepare i915_request tests for obj->mm.lock
    removal
  drm/i915/selftests: Prepare memory region tests for obj->mm.lock
    removal
  drm/i915/selftests: Prepare cs engine tests for obj->mm.lock removal
  drm/i915/selftests: Prepare gtt tests for obj->mm.lock removal
  drm/i915: Finally remove obj->mm.lock.
  drm/i915: Keep userpointer bindings if seqcount is unchanged, v2.
  drm/i915: Idea to implement eviction locking
  drm/i915: Keep lazy reference to userptr pages

Thomas Hellström (1):
  drm/i915: Prepare for obj->mm.lock removal

 drivers/gpu/drm/i915/Makefile                 |   1 -
 drivers/gpu/drm/i915/display/intel_display.c  |  71 +-
 drivers/gpu/drm/i915/display/intel_display.h  |   2 +-
 drivers/gpu/drm/i915/display/intel_dsb.c      |   2 +-
 drivers/gpu/drm/i915/display/intel_fbdev.c    |   2 +-
 drivers/gpu/drm/i915/display/intel_overlay.c  |  34 +-
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |  15 +-
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  62 +-
 drivers/gpu/drm/i915/gem/i915_gem_domain.c    |  51 +-
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 209 ++++-
 drivers/gpu/drm/i915/gem/i915_gem_fence.c     |  95 --
 drivers/gpu/drm/i915/gem/i915_gem_internal.c  |   6 +-
 drivers/gpu/drm/i915/gem/i915_gem_lmem.c      |   4 +-
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      |  35 +-
 drivers/gpu/drm/i915/gem/i915_gem_object.c    |  10 +-
 drivers/gpu/drm/i915/gem/i915_gem_object.h    | 126 ++-
 .../gpu/drm/i915/gem/i915_gem_object_blt.c    |   6 +
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  23 +-
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     | 104 ++-
 drivers/gpu/drm/i915/gem/i915_gem_phys.c      |  95 +-
 drivers/gpu/drm/i915/gem/i915_gem_region.c    |   4 +-
 drivers/gpu/drm/i915/gem/i915_gem_region.h    |   3 +-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     |  18 +-
 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c  |  47 +-
 drivers/gpu/drm/i915/gem/i915_gem_shrinker.h  |   4 +-
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c    |  14 +-
 drivers/gpu/drm/i915/gem/i915_gem_tiling.c    |   2 -
 drivers/gpu/drm/i915/gem/i915_gem_userptr.c   | 875 ++++++------------
 .../drm/i915/gem/selftests/huge_gem_object.c  |   4 +-
 .../gpu/drm/i915/gem/selftests/huge_pages.c   |  38 +-
 .../i915/gem/selftests/i915_gem_client_blt.c  |   8 +-
 .../i915/gem/selftests/i915_gem_coherency.c   |  18 +-
 .../drm/i915/gem/selftests/i915_gem_context.c |  10 +-
 .../drm/i915/gem/selftests/i915_gem_dmabuf.c  |   2 +-
 .../i915/gem/selftests/i915_gem_execbuffer.c  |   2 +-
 .../drm/i915/gem/selftests/i915_gem_mman.c    |  21 +-
 .../drm/i915/gem/selftests/i915_gem_object.c  |   2 +-
 .../i915/gem/selftests/i915_gem_object_blt.c  |   6 +-
 .../drm/i915/gem/selftests/i915_gem_phys.c    |  10 +-
 .../drm/i915/gem/selftests/igt_gem_utils.c    |   2 +-
 drivers/gpu/drm/i915/gt/intel_context_types.h |  13 +-
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     |  37 +-
 drivers/gpu/drm/i915/gt/intel_engine_pm.c     |   4 +-
 drivers/gpu/drm/i915/gt/intel_ggtt.c          |  10 +-
 .../gpu/drm/i915/gt/intel_gt_buffer_pool.c    |  47 +-
 .../gpu/drm/i915/gt/intel_gt_buffer_pool.h    |   5 +
 .../drm/i915/gt/intel_gt_buffer_pool_types.h  |   1 +
 drivers/gpu/drm/i915/gt/intel_gt_types.h      |   4 -
 drivers/gpu/drm/i915/gt/intel_gtt.c           |  38 +-
 drivers/gpu/drm/i915/gt/intel_gtt.h           |   5 +
 drivers/gpu/drm/i915/gt/intel_lrc.c           | 150 +--
 drivers/gpu/drm/i915/gt/intel_ppgtt.c         |   3 +-
 drivers/gpu/drm/i915/gt/intel_renderstate.c   |   2 +-
 .../gpu/drm/i915/gt/intel_ring_submission.c   | 184 ++--
 drivers/gpu/drm/i915/gt/intel_timeline.c      | 392 ++------
 drivers/gpu/drm/i915/gt/intel_timeline.h      |   2 +
 .../gpu/drm/i915/gt/intel_timeline_types.h    |  15 +-
 drivers/gpu/drm/i915/gt/intel_workarounds.c   |  24 +-
 drivers/gpu/drm/i915/gt/mock_engine.c         |  22 +-
 drivers/gpu/drm/i915/gt/selftest_context.c    |   4 +-
 drivers/gpu/drm/i915/gt/selftest_engine_cs.c  |   4 +-
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  |   8 +-
 drivers/gpu/drm/i915/gt/selftest_lrc.c        |  34 +-
 drivers/gpu/drm/i915/gt/selftest_mocs.c       |   2 +-
 .../drm/i915/gt/selftest_ring_submission.c    |   4 +-
 drivers/gpu/drm/i915/gt/selftest_timeline.c   |  98 +-
 .../gpu/drm/i915/gt/selftest_workarounds.c    | 101 +-
 drivers/gpu/drm/i915/gt/shmem_utils.c         |   2 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc.c        |   2 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_log.c    |   4 +-
 drivers/gpu/drm/i915/gt/uc/intel_huc.c        |   2 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c      |   2 +-
 drivers/gpu/drm/i915/gvt/dmabuf.c             |   2 +-
 drivers/gpu/drm/i915/i915_active.c            |  20 +-
 drivers/gpu/drm/i915/i915_cmd_parser.c        | 104 +--
 drivers/gpu/drm/i915/i915_debugfs.c           |   4 +-
 drivers/gpu/drm/i915/i915_drv.h               |  18 +-
 drivers/gpu/drm/i915/i915_gem.c               | 298 +++---
 drivers/gpu/drm/i915/i915_gem.h               |   5 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c           |   2 +-
 drivers/gpu/drm/i915/i915_memcpy.c            |   2 +-
 drivers/gpu/drm/i915/i915_memcpy.h            |   2 +-
 drivers/gpu/drm/i915/i915_perf.c              |  56 +-
 drivers/gpu/drm/i915/i915_request.c           |   4 -
 drivers/gpu/drm/i915/i915_request.h           |  10 -
 drivers/gpu/drm/i915/i915_selftest.h          |   2 +
 drivers/gpu/drm/i915/i915_vma.c               |  26 +-
 drivers/gpu/drm/i915/i915_vma.h               |  20 +-
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  94 +-
 drivers/gpu/drm/i915/selftests/i915_request.c |  10 +-
 drivers/gpu/drm/i915/selftests/igt_spinner.c  | 136 ++-
 drivers/gpu/drm/i915/selftests/igt_spinner.h  |   5 +
 .../drm/i915/selftests/intel_memory_region.c  |  18 +-
 drivers/gpu/drm/i915/selftests/mock_region.c  |   4 +-
 94 files changed, 2094 insertions(+), 2016 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/gem/i915_gem_fence.c


base-commit: 114b3ff35870623fbd7b7aa580e4b43c690edace
-- 
2.28.0


More information about the Intel-gfx mailing list