aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Mao <david.mao@amd.com>2016-06-07 05:48:52 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-07-07 14:51:29 -0400
commit15da301d88c8c9669a1d8ef44d729a505617abeb (patch)
treebbf9a22974daba593ef36123f21b5a78cb53e3ea /drivers
parent42ffb5822bfa6f21e5c3738776accac49d511b98 (diff)
drm/amd/amdgpu : adding new tracepoints to track memory information.
- adding amdgpu_cs_bo_status to track total size and total entry count of bo for each submission. - adding amdgpu_ttm_bo_move to track the bo eviction including the size of bo and the location before/after the move Signed-off-by: David Mao <David.Mao@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h37
3 files changed, 43 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
index 823bf5e0b0c8..651115dcce12 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
@@ -94,6 +94,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
94 unsigned last_entry = 0, first_userptr = num_entries; 94 unsigned last_entry = 0, first_userptr = num_entries;
95 unsigned i; 95 unsigned i;
96 int r; 96 int r;
97 unsigned long total_size = 0;
97 98
98 array = drm_malloc_ab(num_entries, sizeof(struct amdgpu_bo_list_entry)); 99 array = drm_malloc_ab(num_entries, sizeof(struct amdgpu_bo_list_entry));
99 if (!array) 100 if (!array)
@@ -140,6 +141,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
140 if (entry->robj->prefered_domains == AMDGPU_GEM_DOMAIN_OA) 141 if (entry->robj->prefered_domains == AMDGPU_GEM_DOMAIN_OA)
141 oa_obj = entry->robj; 142 oa_obj = entry->robj;
142 143
144 total_size += amdgpu_bo_size(entry->robj);
143 trace_amdgpu_bo_list_set(list, entry->robj); 145 trace_amdgpu_bo_list_set(list, entry->robj);
144 } 146 }
145 147
@@ -155,6 +157,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
155 list->array = array; 157 list->array = array;
156 list->num_entries = num_entries; 158 list->num_entries = num_entries;
157 159
160 trace_amdgpu_cs_bo_status(list->num_entries, total_size);
158 return 0; 161 return 0;
159 162
160error_free: 163error_free:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 7ecea83ce453..6f0873c75a25 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -589,6 +589,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
589 struct ttm_mem_reg *new_mem) 589 struct ttm_mem_reg *new_mem)
590{ 590{
591 struct amdgpu_bo *rbo; 591 struct amdgpu_bo *rbo;
592 struct ttm_mem_reg *old_mem = &bo->mem;
592 593
593 if (!amdgpu_ttm_bo_is_amdgpu_bo(bo)) 594 if (!amdgpu_ttm_bo_is_amdgpu_bo(bo))
594 return; 595 return;
@@ -602,6 +603,8 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
602 603
603 /* move_notify is called before move happens */ 604 /* move_notify is called before move happens */
604 amdgpu_update_memory_usage(rbo->adev, &bo->mem, new_mem); 605 amdgpu_update_memory_usage(rbo->adev, &bo->mem, new_mem);
606
607 trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
605} 608}
606 609
607int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo) 610int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
index e4992210e587..499803f3ce3a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
@@ -307,6 +307,43 @@ TRACE_EVENT(amdgpu_bo_list_set,
307 __entry->bo_size) 307 __entry->bo_size)
308); 308);
309 309
310TRACE_EVENT(amdgpu_cs_bo_status,
311 TP_PROTO(uint64_t total_bo, uint64_t total_size),
312 TP_ARGS(total_bo, total_size),
313 TP_STRUCT__entry(
314 __field(u64, total_bo)
315 __field(u64, total_size)
316 ),
317
318 TP_fast_assign(
319 __entry->total_bo = total_bo;
320 __entry->total_size = total_size;
321 ),
322 TP_printk("total bo size = %Ld, total bo count = %Ld",
323 __entry->total_bo, __entry->total_size)
324);
325
326TRACE_EVENT(amdgpu_ttm_bo_move,
327 TP_PROTO(struct amdgpu_bo* bo, uint32_t new_placement, uint32_t old_placement),
328 TP_ARGS(bo, new_placement, old_placement),
329 TP_STRUCT__entry(
330 __field(struct amdgpu_bo *, bo)
331 __field(u64, bo_size)
332 __field(u32, new_placement)
333 __field(u32, old_placement)
334 ),
335
336 TP_fast_assign(
337 __entry->bo = bo;
338 __entry->bo_size = amdgpu_bo_size(bo);
339 __entry->new_placement = new_placement;
340 __entry->old_placement = old_placement;
341 ),
342 TP_printk("bo=%p from:%d to %d with size = %Ld",
343 __entry->bo, __entry->old_placement,
344 __entry->new_placement, __entry->bo_size)
345);
346
310#endif 347#endif
311 348
312/* This part must be outside protection */ 349/* This part must be outside protection */