drm/amdkfd: avoid svm dump when dynamic debug disabled
Subsystems (3)
PATCH 1/1 drm/amdkfd: avoid svm dump when dynamic debug disabled
svm_range_debug_dump should not be called at all when dynamic debug is disabled to avoid iterating over SVM lists. This could drop performance, specially with big number of SVM ranges.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +4 -2
@@ -821,7 +821,7 @@ svm_range_is_same_attrs(struct kfd_process *p, struct svm_range *prange,* * Context: The caller must hold svms->lock */ -static void svm_range_debug_dump (struct svm_range_list *svms) +static int svm_range_debug_dump (struct svm_range_list *svms) {struct interval_tree_node *node;struct svm_range *prange;
@@ -847,6 +847,8 @@ static void svm_range_debug_dump(struct svm_range_list *svms) prange->actual_loc); node =interval_tree_iter_next (node,0 , ~0ULL ); } + +return 0 ; } static int
@@ -3563,7 +3565,7 @@ svm_range_set_attr(struct kfd_process *p, struct mm_struct *mm,break ; } -svm_range_debug_dump (svms); +pr_debug ("%d" ,svm_range_debug_dump (svms));mutex_unlock (&svms->lock);mmap_read_unlock (mm);
Signature · 1 line
2.32.0
Felix Kuehling
maintainerAm 2023-07-08 um 12:57 schrieb Alex Sierra:
Quoted 33 lines
svm_range_debug_dumpshould not be called at all when dynamic debug is disabled to avoid iterating over SVM lists. This could drop performance, specially with big number of SVM ranges.Signed-off-by Alex Sierra <[email protected]>Signed-off-by Philip Yang <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_svm.c +3
-1@@ -821,7 +821,7 @@ svm_range_is_same_attrs(struct kfd_process *p, struct svm_range *prange,* * Context: The caller must hold svms->lock */ -static void svm_range_debug_dump (struct svm_range_list *svms) +static int svm_range_debug_dump (struct svm_range_list *svms) {struct interval_tree_node *node;struct svm_range *prange;@@ -847,6 +847,8 @@ static void svm_range_debug_dump(struct svm_range_list *svms) prange->actual_loc); node =interval_tree_iter_next (node,0 , ~0ULL ); } + +return 0 ; } static int
drivers/gpu/drm/amd/amdkfd/kfd_svm.c svm_range_set_attr(struct kfd_process *p, struct mm_struct *mm, · line 3568
Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1
-1@@ -3563,7 +3565,7 @@ svm_range_set_attr(struct kfd_process *p, struct mm_struct *mm,break ; } -svm_range_debug_dump (svms); +pr_debug ("%d" ,svm_range_debug_dump (svms));
This is a bit hacky. I would use the way dynamic_hex_dump is defined as an example for how to do this without the dummy pr_debug and without returning a dummy result from svm_range_debug_dump:
#define dynamic_svm_range_dump(svms) \
_dynamic_func_call_no_desc("svm_range_dump", svm_range_debug_dump, svms)
Then instead of calling svm_range_debug_dump directly, call dynamic_svm_range_dump(svms).
Regards,
Felix
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +0
-0mutex_unlock (&svms->lock);mmap_read_unlock (mm);