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

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Tue Jan 5 15:34:54 UTC 2021


Rebased on top of latest drm-tip.

The userptr changes have been tested against beignet's selftests, and
intel-compute-runtime with piglit. I added a few ERRs to check if the
changed paths were hit, but didn't get any returned, and no new test
failures, so no regressions.

IGT needs fixes, as it still uses some of the deprecated calls.

Test-with: 20201215084825.101358-1-maarten.lankhorst at linux.intel.com

---

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!

Compared to last version, I moved gt_revoke slightly to fix a lockdep splat with
reset mutex vs mmu notifier.

Maarten Lankhorst (62):
  drm/i915: Do not share hwsp across contexts any more, v6
  drm/i915: Pin timeline map after first timeline pin, v3.
  drm/i915: Move cmd parser pinning to execbuffer
  drm/i915: Add missing -EDEADLK handling to execbuf pinning, v2.
  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, v2.
  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, v2.
  drm/i915: Make compilation of userptr code depend on MMU_NOTIFIER.
  drm/i915: Fix userptr so we do not have to worry about obj->mm.lock,
    v5.
  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 lrc_init_wa_ctx 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 and lrc selftests 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: Move gt_revoke() slightly

Thomas Hellström (2):
  drm/i915: Prepare for obj->mm.lock removal
  drm/i915: Avoid some false positives in assert_object_held()

 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    |  52 +-
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 228 ++++-
 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    | 102 +-
 .../gpu/drm/i915/gem/i915_gem_object_blt.c    |   6 +
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  21 +-
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     | 109 ++-
 drivers/gpu/drm/i915/gem/i915_gem_phys.c      | 110 +--
 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     |  39 +-
 drivers/gpu/drm/i915/gem/i915_gem_shrinker.c  |  39 +-
 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   | 871 ++++++------------
 .../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/gen2_engine_cs.c      |   2 +-
 drivers/gpu/drm/i915/gt/gen6_engine_cs.c      |   8 +-
 drivers/gpu/drm/i915/gt/gen8_engine_cs.c      |  12 +-
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     |  38 +-
 drivers/gpu/drm/i915/gt/intel_engine_pm.c     |   4 +
 .../drm/i915/gt/intel_execlists_submission.c  |  26 +-
 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           |  52 +-
 drivers/gpu/drm/i915/gt/intel_gtt.h           |   8 +
 drivers/gpu/drm/i915/gt/intel_lrc.c           |  32 +-
 drivers/gpu/drm/i915/gt/intel_ppgtt.c         |   3 +-
 drivers/gpu/drm/i915/gt/intel_renderstate.c   |   2 +-
 drivers/gpu/drm/i915/gt/intel_reset.c         |   5 +-
 .../gpu/drm/i915/gt/intel_ring_submission.c   | 184 ++--
 drivers/gpu/drm/i915/gt/intel_timeline.c      | 426 ++-------
 drivers/gpu/drm/i915/gt/intel_timeline.h      |   2 +
 .../gpu/drm/i915/gt/intel_timeline_types.h    |  17 +-
 drivers/gpu/drm/i915/gt/intel_workarounds.c   |  10 +-
 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  |   9 +-
 drivers/gpu/drm/i915/gt/selftest_execlists.c  |  23 +-
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  |   8 +-
 drivers/gpu/drm/i915/gt/selftest_lrc.c        |  18 +-
 drivers/gpu/drm/i915/gt/selftest_mocs.c       |   5 +-
 .../drm/i915/gt/selftest_ring_submission.c    |   4 +-
 drivers/gpu/drm/i915/gt/selftest_timeline.c   | 174 ++--
 .../gpu/drm/i915/gt/selftest_workarounds.c    |  82 +-
 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               | 246 ++---
 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           |  17 +-
 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 +-
 98 files changed, 2107 insertions(+), 2010 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/gem/i915_gem_fence.c

-- 
2.30.0.rc1



More information about the Intel-gfx mailing list