Skip to content

rework bo mem stats tracking

Yunxiang Li amd-gfx dri-devel intel-gfx 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v11 Latest5 patches 1 replyIn review
  2. v106 patches 7 repliesSuperseded
  3. v95 patches 6 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v85 patches7 repliesSuperseded
v74 patches17 repliesSuperseded
v65 patches10 repliesSuperseded
v54 patches22 repliesSuperseded

Patches in v11 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5drm: add drm_memory_stats_is_zerodrivers/gpu/drm/drm_file.c include/drm/drm_file.h+11 -00 replies
2/5drm: make drm-active- stats optionaldrivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c drivers/gpu/drm/drm_file.c drivers/gpu/drm/i915/i915_drm_client.c +2 more+18 -120 replies
3/5Documentation/gpu: Clarify drm memory stats definitionDocumentation/gpu/drm-usage-stats.rst+27 -270 replies
4/5drm/amdgpu: remove unused function parameterdrivers/gpu/drm/amd/amdgpu/amdgpu_cs.c drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 more+7 -120 replies
5/5drm/amdgpu: track bo memory stats at runtimedrivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5 more+228 -1395 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchChristian KönigTvrtko Ursulin
1/5R-b
2/5R-b
3/5R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v11 thread

Cover letter [PATCH v11 0/5] rework bo mem stats tracking

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 separate 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
v11: drop the v10 flink changes and instead hook into gem open/close

Yunxiang Li (5):
drm: add drm_memory_stats_is_zero
drm: make drm-active- stats optional Documentation/gpu: Clarify drm memory stats definition 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     |   6 +-
 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      | 208 +++++++++++++++-----
 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/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                       |  14 +-
 16 files changed, 289 insertions(+), 188 deletions(-)
Signature · 1 line
2.47.0