drm/amdgpu: Checkpoint and Restore VRAM BOs without VA
Subsystems (3)
PATCH v2 1/1 drm/amdgpu: Checkpoint and Restore VRAM BOs without VA
Extend checkpoint logic to allow inclusion of VRAM BOs that do not have a VA attached
Signed-off-by Ramesh Errabolu <[email protected]>
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +7 -2
@@ -1845,7 +1845,8 @@ static uint32_t get_process_num_bos(struct kfd_process *p)idr_for_each_entry (&pdd->alloc_idr, mem, id) {struct kgd_mem *kgd_mem = (struct kgd_mem *)mem; -if ((uint64_t )kgd_mem->va > pdd->gpuvm_base) +if (((uint64_t )kgd_mem->va > pdd->gpuvm_base) || + !kgd_mem->va) num_of_bos++; } }
@@ -1917,7 +1918,11 @@ static int criu_checkpoint_bos(struct kfd_process *p, kgd_mem = (struct kgd_mem *)mem; dumper_bo = kgd_mem->bo; -if ((uint64_t )kgd_mem->va <= pdd->gpuvm_base) +/* Skip checkpointing BOs that are used for Trap handler +* code and state. Currently, these BOs have a VA that +* is less GPUVM Base +*/ +if (((uint64_t )kgd_mem->va <= pdd->gpuvm_base) && kgd_mem->va)continue ; bo_bucket = &bo_buckets[bo_index];
Signature · 1 line
2.25.1
Am 2023-07-25 um 17:11 schrieb Ramesh Errabolu:
Quoted 13 lines
Extend checkpoint logic to allow inclusion of VRAM BOs that do not have a VA attached
Signed-off-by Ramesh Errabolu <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static uint32_t get_process_num_bos(struct kfd_process *p) · line 1848
Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +1
-1@@ -1845,7 +1845,8 @@ static uint32_t get_process_num_bos(struct kfd_process *p)idr_for_each_entry (&pdd->alloc_idr, mem, id) {struct kgd_mem *kgd_mem = (struct kgd_mem *)mem; -if ((uint64_t )kgd_mem->va > pdd->gpuvm_base) + if (((uint64_t)kgd_mem->va > pdd->gpuvm_base) ||
Unnecessary parentheses around (a > b).
Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +1
-0+ !kgd_mem->va) num_of_bos++; } }
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int criu_checkpoint_bos(struct kfd_process *p, · line 1925
Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +5
-1@@ -1917,7 +1918,11 @@ static int criu_checkpoint_bos(struct kfd_process *p, kgd_mem = (struct kgd_mem *)mem; dumper_bo = kgd_mem->bo; -if ((uint64_t )kgd_mem->va <= pdd->gpuvm_base) +/* Skip checkpointing BOs that are used for Trap handler +* code and state. Currently, these BOs have a VA that +* is less GPUVM Base +*/ +if (((uint64_t )kgd_mem->va <= pdd->gpuvm_base) && kgd_mem->va)
Unnecessary parentheses around (a <= b). In this condition I'd also prefer to put kgd_mem->va first, because it short-circuits execution for the case that va is NULL.
With that fixed, the patch is
Reviewed-by Felix Kuehling <[email protected]>
Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0
-0continue ; bo_bucket = &bo_buckets[bo_index];