Skip to contentSkip to conversation

drm/amdkfd: avoid svm dump when dynamic debug disabled

PATCH In review Alex Sierra 2 participants 2 messages Jul 19, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: avoid svm dump when dynamic debug disabled

Set dynamic_svm_range_dump macro to avoid iterating over SVM lists from svm_range_debug_dump when dynamic debug is disabled. Otherwise, it could drop performance, specially with big number of SVM ranges. Make sure both svm_range_set_attr and svm_range_debug_dump functions are dynamically enabled to print svm_range_debug_dump debug traces.

---
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_svm.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -1
index 479c4f66afa7..0687f27f506c 100644
@@ -3563,7 +3563,7 @@ svm_range_set_attr(struct kfd_process *p, struct mm_struct *mm,
 			break;
 	}
 
-	svm_range_debug_dump(svms);
+	dynamic_svm_range_dump(svms);
 
 	mutex_unlock(&svms->lock);
 	mmap_read_unlock(mm);
drivers/gpu/drm/amd/amdkfd/kfd_svm.h +3 -0
index 21b14510882b..ed4cd501fafe 100644
@@ -39,6 +39,9 @@
 #define SVM_ADEV_PGMAP_OWNER(adev)\
 			((adev)->hive ? (void *)(adev)->hive : (void *)(adev))
 
+#define dynamic_svm_range_dump(svms) \
+	_dynamic_func_call_no_desc("svm_range_dump", svm_range_debug_dump, svms)
+
 struct svm_range_bo {
 	struct amdgpu_bo		*bo;
 	struct kref			kref;
Signature · 1 line
2.32.0
maintainer
#1 lore raw

Am 2023-07-19 um 14:03 schrieb Alex Sierra:

Quoted 33 lines

Set dynamic_svm_range_dump macro to avoid iterating over SVM lists from svm_range_debug_dump when dynamic debug is disabled. Otherwise, it could drop performance, specially with big number of SVM ranges. Make sure both svm_range_set_attr and svm_range_debug_dump functions are dynamically enabled to print svm_range_debug_dump debug traces.

---
  drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +-
  drivers/gpu/drm/amd/amdkfd/kfd_svm.h | 3 +++
  2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -1
index 479c4f66afa7..0687f27f506c 100644
@@ -3563,7 +3563,7 @@ svm_range_set_attr(struct kfd_process *p, struct mm_struct *mm,
  			break;
  	}
 
-	svm_range_debug_dump(svms);
+	dynamic_svm_range_dump(svms);
 
  	mutex_unlock(&svms->lock);
  	mmap_read_unlock(mm);
drivers/gpu/drm/amd/amdkfd/kfd_svm.h +0 -0
index 21b14510882b..ed4cd501fafe 100644

drivers/gpu/drm/amd/amdkfd/kfd_svm.h line 44

Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_svm.h +3 -0
@@ -39,6 +39,9 @@
  #define SVM_ADEV_PGMAP_OWNER(adev)\
  			((adev)->hive ? (void *)(adev)->hive : (void *)(adev))
 
+#define dynamic_svm_range_dump(svms) \
+	_dynamic_func_call_no_desc("svm_range_dump", svm_range_debug_dump, svms)
+

This should be in kfd_svm.c. The function svm_range_debug_dump is a static function in that file. This macro is not useful outside of it.

Regards,
  Felix

Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_svm.h +0 -0
  struct svm_range_bo {
  	struct amdgpu_bo		*bo;
  	struct kref			kref;