All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v10 0/6] rework bo mem stats tracking
@ 2024-12-10 17:59 Yunxiang Li
  2024-12-10 17:59 ` [PATCH v10 1/6] drm: add drm_memory_stats_is_zero Yunxiang Li
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Yunxiang Li @ 2024-12-10 17:59 UTC (permalink / raw)
  To: amd-gfx, christian.koenig, tvrtko.ursulin; +Cc: Alexander.Deucher, Yunxiang Li

Right now every time the fdinfo is read, we go through the vm lists and
lock all the BOs to calcuate the statistics. This causes a lot of lock
contention when the VM is actively used. It gets worse if there is a lot
of shared BOs or if there's a lot of submissions. We have seen
submissions lock-up for seconds due to fdinfo for some workload.
Therefore, rework the implementation to track the BOs as they get moved
around.

The amd-only visible memory stat is removed to simplify implementation,
it's unclear how useful this stat is since kernel map/unmap BOs whenever
it wants to and on a modern system all of VRAM can be mapped if needed.

v5: rebase on top of the drm_print_memory_stats refactor
v6: split the drm changes into a seperate patch for drm-devel review,
fix handling of drm-total- vs drm-resident- and handle drm-purgable-.
v7: make drm-active- optional
v8: clearify documentation, minor tweaks, and some bug fixes found
during testing
v9: documentation fix as suggested, no functional change
v10: change how gem objects shared via flink is counted, and fix a race
between fdinfo read and buffer move

Yunxiang Li (6):
  drm: add drm_memory_stats_is_zero
  drm: make drm-active- stats optional
  Documentation/gpu: Clarify drm memory stats definition
  drm: consider GEM object shared when it is exported
  drm/amdgpu: remove unused function parameter
  drm/amdgpu: track bo memory stats at runtime

 Documentation/gpu/drm-usage-stats.rst       |  54 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c      |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c  |  17 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     |  10 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  | 111 ++++-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h  |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h     |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c      | 196 +++++++++++++++-----
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h      |  26 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c   |   1 +
 drivers/gpu/drm/drm_file.c                  |  23 ++-
 drivers/gpu/drm/drm_gem.c                   |   3 +
 drivers/gpu/drm/drm_prime.c                 |   3 +
 drivers/gpu/drm/i915/i915_drm_client.c      |   1 +
 drivers/gpu/drm/xe/xe_drm_client.c          |   1 +
 include/drm/drm_file.h                      |   1 +
 include/drm/drm_gem.h                       |  26 ++-
 18 files changed, 298 insertions(+), 189 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-12-12 14:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-10 17:59 [PATCH v10 0/6] rework bo mem stats tracking Yunxiang Li
2024-12-10 17:59 ` [PATCH v10 1/6] drm: add drm_memory_stats_is_zero Yunxiang Li
2024-12-10 17:59 ` [PATCH v10 2/6] drm: make drm-active- stats optional Yunxiang Li
2024-12-10 17:59 ` [PATCH v10 3/6] Documentation/gpu: Clarify drm memory stats definition Yunxiang Li
2024-12-10 17:59 ` [PATCH v10 4/6] drm: consider GEM object shared when it is exported Yunxiang Li
2024-12-11  8:15   ` Christian König
2024-12-11 14:02     ` Li, Yunxiang (Teddy)
2024-12-11 15:02       ` Christian König
2024-12-11 16:14         ` Li, Yunxiang (Teddy)
2024-12-12  9:25           ` Christian König
2024-12-12 14:04             ` Li, Yunxiang (Teddy)
2024-12-12 14:08               ` Christian König
2024-12-10 17:59 ` [PATCH v10 5/6] drm/amdgpu: remove unused function parameter Yunxiang Li
2024-12-10 17:59 ` [PATCH v10 6/6] drm/amdgpu: track bo memory stats at runtime Yunxiang Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.