Re: [PATCH v2 1/3] drm/i915: Remove the vm open count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 02, 2022 at 11:21:58AM +0100, Thomas Hellström wrote:
vms are not getting properly closed. Rather than fixing that,
Remove the vm open count and instead rely on the vm refcount.

The vm open count existed solely to break the strong references the
vmas had on the vms. Now instead make those references weak and
ensure vmas are destroyed when the vm is destroyed.

Unfortunately if the vm destructor and the object destructor both
wants to destroy a vma, that may lead to a race in that the vm
destructor just unbinds the vma and leaves the actual vma destruction
to the object destructor. However in order for the object destructor
to ensure the vma is unbound it needs to grab the vm mutex. In order
to keep the vm mutex alive until the object destructor is done with
it, somewhat hackishly grab a vm_resv refcount that is released late
in the vma destruction process, when the vm mutex is no longer needed.

v2: Address review-comments from Niranjana
- Clarify that the struct i915_address_space::skip_pte_rewrite is a hack and
 should ideally be replaced in an upcoming patch.
- Remove an unneeded continue in clear_vm_list and update comment.

Co-developed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@xxxxxxxxx>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@xxxxxxxxx>
Signed-off-by: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>
---
drivers/gpu/drm/i915/display/intel_dpt.c      |  2 +-
drivers/gpu/drm/i915/gem/i915_gem_context.c   | 29 ++-----
.../gpu/drm/i915/gem/i915_gem_execbuffer.c    |  6 ++
.../gpu/drm/i915/gem/selftests/mock_context.c |  5 +-
drivers/gpu/drm/i915/gt/gen6_ppgtt.c          |  2 +-
drivers/gpu/drm/i915/gt/intel_ggtt.c          | 30 +++----
drivers/gpu/drm/i915/gt/intel_gtt.c           | 54 ++++++++----
drivers/gpu/drm/i915/gt/intel_gtt.h           | 56 ++++--------
drivers/gpu/drm/i915/gt/selftest_execlists.c  | 86 +++++++++----------
drivers/gpu/drm/i915/i915_gem.c               |  6 +-
drivers/gpu/drm/i915/i915_vma.c               | 55 ++++++++----
drivers/gpu/drm/i915/i915_vma_resource.c      |  2 +-
drivers/gpu/drm/i915/i915_vma_resource.h      |  6 ++
drivers/gpu/drm/i915/i915_vma_types.h         |  7 ++
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  4 +-
15 files changed, 186 insertions(+), 164 deletions(-)


Looks good to me.
Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@xxxxxxxxx>




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux