mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 14:02:06 -04:00
drm/amdgpu: Add debugfs entry for printing VM info
Create new debugfs entry to print memory info using VM buffer
objects.
V2: Added Common function for printing BO info.
Dump more VM lists for evicted, moved, relocated, invalidated.
Removed dumping VM mapped BOs.
V3: Fixed coding style comments, renamed print API and variables.
V4: Fixed coding style comments.
Signed-off-by: Mihir Bhogilal Patel <Mihir.Patel@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
ded08454e5
commit
ff72bc4031
@@ -3392,3 +3392,86 @@ error_unref:
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
/**
|
||||
* amdgpu_debugfs_vm_bo_info - print BO info for the VM
|
||||
*
|
||||
* @vm: Requested VM for printing BO info
|
||||
* @m: debugfs file
|
||||
*
|
||||
* Print BO information in debugfs file for the VM
|
||||
*/
|
||||
void amdgpu_debugfs_vm_bo_info(struct amdgpu_vm *vm, struct seq_file *m)
|
||||
{
|
||||
struct amdgpu_bo_va *bo_va, *tmp;
|
||||
u64 total_idle = 0;
|
||||
u64 total_evicted = 0;
|
||||
u64 total_relocated = 0;
|
||||
u64 total_moved = 0;
|
||||
u64 total_invalidated = 0;
|
||||
unsigned int total_idle_objs = 0;
|
||||
unsigned int total_evicted_objs = 0;
|
||||
unsigned int total_relocated_objs = 0;
|
||||
unsigned int total_moved_objs = 0;
|
||||
unsigned int total_invalidated_objs = 0;
|
||||
unsigned int id = 0;
|
||||
|
||||
seq_puts(m, "\tIdle BOs:\n");
|
||||
list_for_each_entry_safe(bo_va, tmp, &vm->idle, base.vm_status) {
|
||||
if (!bo_va->base.bo)
|
||||
continue;
|
||||
total_idle += amdgpu_bo_print_info(id++, bo_va->base.bo, m);
|
||||
}
|
||||
total_idle_objs = id;
|
||||
id = 0;
|
||||
|
||||
seq_puts(m, "\tEvicted BOs:\n");
|
||||
list_for_each_entry_safe(bo_va, tmp, &vm->evicted, base.vm_status) {
|
||||
if (!bo_va->base.bo)
|
||||
continue;
|
||||
total_evicted += amdgpu_bo_print_info(id++, bo_va->base.bo, m);
|
||||
}
|
||||
total_evicted_objs = id;
|
||||
id = 0;
|
||||
|
||||
seq_puts(m, "\tRelocated BOs:\n");
|
||||
list_for_each_entry_safe(bo_va, tmp, &vm->relocated, base.vm_status) {
|
||||
if (!bo_va->base.bo)
|
||||
continue;
|
||||
total_relocated += amdgpu_bo_print_info(id++, bo_va->base.bo, m);
|
||||
}
|
||||
total_relocated_objs = id;
|
||||
id = 0;
|
||||
|
||||
seq_puts(m, "\tMoved BOs:\n");
|
||||
list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
|
||||
if (!bo_va->base.bo)
|
||||
continue;
|
||||
total_moved += amdgpu_bo_print_info(id++, bo_va->base.bo, m);
|
||||
}
|
||||
total_moved_objs = id;
|
||||
id = 0;
|
||||
|
||||
seq_puts(m, "\tInvalidated BOs:\n");
|
||||
spin_lock(&vm->invalidated_lock);
|
||||
list_for_each_entry_safe(bo_va, tmp, &vm->invalidated, base.vm_status) {
|
||||
if (!bo_va->base.bo)
|
||||
continue;
|
||||
total_invalidated += amdgpu_bo_print_info(id++, bo_va->base.bo, m);
|
||||
}
|
||||
spin_unlock(&vm->invalidated_lock);
|
||||
total_invalidated_objs = id;
|
||||
|
||||
seq_printf(m, "\tTotal idle size: %12lld\tobjs:\t%d\n", total_idle,
|
||||
total_idle_objs);
|
||||
seq_printf(m, "\tTotal evicted size: %12lld\tobjs:\t%d\n", total_evicted,
|
||||
total_evicted_objs);
|
||||
seq_printf(m, "\tTotal relocated size: %12lld\tobjs:\t%d\n", total_relocated,
|
||||
total_relocated_objs);
|
||||
seq_printf(m, "\tTotal moved size: %12lld\tobjs:\t%d\n", total_moved,
|
||||
total_moved_objs);
|
||||
seq_printf(m, "\tTotal invalidated size: %12lld\tobjs:\t%d\n", total_invalidated,
|
||||
total_invalidated_objs);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user