drm/amdgpu: add VISIBLE info in amdgpu_bo_print_info
Subsystems (2)
PATCH 1/1 drm/amdgpu: add VISIBLE info in amdgpu_bo_print_info
This allows tools to distinguish between VRAM and visible VRAM.
Use the opportunity to fix locking before accessing bo.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 33 ++++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +21 -12
@@ -1583,18 +1583,27 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)unsigned int pin_count;u64 size; - domain =amdgpu_mem_type_to_domain (bo->tbo.resource->mem_type); -switch (domain) { -case AMDGPU_GEM_DOMAIN_VRAM : - placement ="VRAM" ; -break ; -case AMDGPU_GEM_DOMAIN_GTT : - placement =" GTT" ; -break ; -case AMDGPU_GEM_DOMAIN_CPU : -default : - placement =" CPU" ; -break ; +if (dma_resv_trylock (bo->tbo.base.resv)) { +unsigned int domain; + domain =amdgpu_mem_type_to_domain (bo->tbo.resource->mem_type); +switch (domain) { +case AMDGPU_GEM_DOMAIN_VRAM : +if (amdgpu_bo_in_cpu_visible_vram (bo)) + placement ="VRAM VISIBLE" ; +else + placement ="VRAM" ; +break ; +case AMDGPU_GEM_DOMAIN_GTT : + placement =" GTT" ; +break ; +case AMDGPU_GEM_DOMAIN_CPU : +default : + placement =" CPU" ; +break ; + } +dma_resv_unlock (bo->tbo.base.resv); + }else { + placement ="UNKNOWN" ; } size =amdgpu_bo_size (bo);
Signature · 1 line
2.40.0
Christian König
maintainerAm 21.06.23 um 16:35 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 31 lines
This allows tools to distinguish between VRAM and visible VRAM.
Use the opportunity to fix locking before accessing bo.
Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 33 ++++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-12@@ -1583,18 +1583,27 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)unsigned int pin_count;u64 size; - domain =amdgpu_mem_type_to_domain (bo->tbo.resource->mem_type); -switch (domain) { -case AMDGPU_GEM_DOMAIN_VRAM : - placement ="VRAM" ; -break ; -case AMDGPU_GEM_DOMAIN_GTT : - placement =" GTT" ; -break ; -case AMDGPU_GEM_DOMAIN_CPU : -default : - placement =" CPU" ; -break ; +if (dma_resv_trylock (bo->tbo.base.resv)) { +unsigned int domain;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m) · line 1597
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +10
-0+ domain =amdgpu_mem_type_to_domain (bo->tbo.resource->mem_type); +switch (domain) { +case AMDGPU_GEM_DOMAIN_VRAM : +if (amdgpu_bo_in_cpu_visible_vram (bo)) + placement ="VRAM VISIBLE" ; +else + placement ="VRAM" ; +break ; +case AMDGPU_GEM_DOMAIN_GTT : + placement =" GTT" ;
We can probably drop the leading blank here and
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m) · line 1601
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4
-0+break ; +case AMDGPU_GEM_DOMAIN_CPU : +default : + placement =" CPU" ;
here when we don't keep the strings at the same length anyway.
With that fixed the change is Reviewed-by: Christian König <[email protected]>
Regards,
Christian.
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5
-0+break ; + } +dma_resv_unlock (bo->tbo.base.resv); + }else { + placement ="UNKNOWN" ; } size =amdgpu_bo_size (bo);
[Public]
Thanks Christian for the review. I'll remove the leading blanks before submitting the patch.
Pierre-Eric
________________________________
From: Koenig, Christian <[email protected]>
Sent: Wednesday, June 21, 2023 5:00 PM
To: Pelloux-Prayer, Pierre-Eric <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: add VISIBLE info in amdgpu_bo_print_info
Am 21.06.23 um 16:35 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 31 lines
This allows tools to distinguish between VRAM and visible VRAM.
Use the opportunity to fix locking before accessing bo.
Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 33 ++++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-12@@ -1583,18 +1583,27 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)unsigned int pin_count;u64 size; - domain =amdgpu_mem_type_to_domain (bo->tbo.resource->mem_type); -switch (domain) { -case AMDGPU_GEM_DOMAIN_VRAM : - placement ="VRAM" ; -break ; -case AMDGPU_GEM_DOMAIN_GTT : - placement =" GTT" ; -break ; -case AMDGPU_GEM_DOMAIN_CPU : -default : - placement =" CPU" ; -break ; +if (dma_resv_trylock (bo->tbo.base.resv)) { +unsigned int domain;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m) · line 1597
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +10
-0+ domain =amdgpu_mem_type_to_domain (bo->tbo.resource->mem_type); +switch (domain) { +case AMDGPU_GEM_DOMAIN_VRAM : +if (amdgpu_bo_in_cpu_visible_vram (bo)) + placement ="VRAM VISIBLE" ; +else + placement ="VRAM" ; +break ; +case AMDGPU_GEM_DOMAIN_GTT : + placement =" GTT" ;
We can probably drop the leading blank here and
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m) · line 1601
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4
-0+break ; +case AMDGPU_GEM_DOMAIN_CPU : +default : + placement =" CPU" ;
here when we don't keep the strings at the same length anyway.
With that fixed the change is Reviewed-by: Christian König <[email protected]>
Regards,
Christian.
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5
-0+break ; + } +dma_resv_unlock (bo->tbo.base.resv); + }else { + placement ="UNKNOWN" ; } size =amdgpu_bo_size (bo);