drm/amdgpu: fix ftrace event amdgpu_bo_move always move on same heap
[ Upstream commit 94aeb4117343d072e3a35b9595bcbfc0058ee724 ] Issue: during evict or validate happened on amdgpu_bo, the 'from' and 'to' is always same in ftrace event of amdgpu_bo_move where calling the 'trace_amdgpu_bo_move', the comment says move_notify is called before move happens, but actually it is called after move happens, here the new_mem is same as bo->resource Fix: move trace_amdgpu_bo_move from move_notify to amdgpu_bo_move Signed-off-by: Wang, Beyond <Wang.Beyond@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fe7e8ec072
commit
d443fb67ca
@ -1222,19 +1222,15 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
|
|||||||
* amdgpu_bo_move_notify - notification about a memory move
|
* amdgpu_bo_move_notify - notification about a memory move
|
||||||
* @bo: pointer to a buffer object
|
* @bo: pointer to a buffer object
|
||||||
* @evict: if this move is evicting the buffer from the graphics address space
|
* @evict: if this move is evicting the buffer from the graphics address space
|
||||||
* @new_mem: new information of the bufer object
|
|
||||||
*
|
*
|
||||||
* Marks the corresponding &amdgpu_bo buffer object as invalid, also performs
|
* Marks the corresponding &amdgpu_bo buffer object as invalid, also performs
|
||||||
* bookkeeping.
|
* bookkeeping.
|
||||||
* TTM driver callback which is called when ttm moves a buffer.
|
* TTM driver callback which is called when ttm moves a buffer.
|
||||||
*/
|
*/
|
||||||
void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
|
void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict)
|
||||||
bool evict,
|
|
||||||
struct ttm_resource *new_mem)
|
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev);
|
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev);
|
||||||
struct amdgpu_bo *abo;
|
struct amdgpu_bo *abo;
|
||||||
struct ttm_resource *old_mem = bo->resource;
|
|
||||||
|
|
||||||
if (!amdgpu_bo_is_amdgpu_bo(bo))
|
if (!amdgpu_bo_is_amdgpu_bo(bo))
|
||||||
return;
|
return;
|
||||||
@ -1251,13 +1247,6 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
|
|||||||
/* remember the eviction */
|
/* remember the eviction */
|
||||||
if (evict)
|
if (evict)
|
||||||
atomic64_inc(&adev->num_evictions);
|
atomic64_inc(&adev->num_evictions);
|
||||||
|
|
||||||
/* update statistics */
|
|
||||||
if (!new_mem)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* move_notify is called before move happens */
|
|
||||||
trace_amdgpu_bo_move(abo, new_mem->mem_type, old_mem->mem_type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void amdgpu_bo_get_memory(struct amdgpu_bo *bo, uint64_t *vram_mem,
|
void amdgpu_bo_get_memory(struct amdgpu_bo *bo, uint64_t *vram_mem,
|
||||||
|
@ -312,9 +312,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
|
|||||||
int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
|
int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
|
||||||
size_t buffer_size, uint32_t *metadata_size,
|
size_t buffer_size, uint32_t *metadata_size,
|
||||||
uint64_t *flags);
|
uint64_t *flags);
|
||||||
void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
|
void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict);
|
||||||
bool evict,
|
|
||||||
struct ttm_resource *new_mem);
|
|
||||||
void amdgpu_bo_release_notify(struct ttm_buffer_object *bo);
|
void amdgpu_bo_release_notify(struct ttm_buffer_object *bo);
|
||||||
vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
|
vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
|
||||||
void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
|
void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
|
||||||
|
@ -555,10 +555,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace_amdgpu_bo_move(abo, new_mem->mem_type, old_mem->mem_type);
|
||||||
out:
|
out:
|
||||||
/* update statistics */
|
/* update statistics */
|
||||||
atomic64_add(bo->base.size, &adev->num_bytes_moved);
|
atomic64_add(bo->base.size, &adev->num_bytes_moved);
|
||||||
amdgpu_bo_move_notify(bo, evict, new_mem);
|
amdgpu_bo_move_notify(bo, evict);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1503,7 +1504,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo,
|
|||||||
static void
|
static void
|
||||||
amdgpu_bo_delete_mem_notify(struct ttm_buffer_object *bo)
|
amdgpu_bo_delete_mem_notify(struct ttm_buffer_object *bo)
|
||||||
{
|
{
|
||||||
amdgpu_bo_move_notify(bo, false, NULL);
|
amdgpu_bo_move_notify(bo, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ttm_device_funcs amdgpu_bo_driver = {
|
static struct ttm_device_funcs amdgpu_bo_driver = {
|
||||||
|
Loading…
Reference in New Issue
Block a user