drm/amdkfd: pages_addr offset must be 0 for system range
Subsystems (3)
PATCH 1/1 drm/amdkfd: pages_addr offset must be 0 for system range
prange->offset is for VRAM range mm_nodes, if multiple ranges share same mm_nodes, migrate range back to VRAM will reuse the VRAM at offset of the same mm_nodes. For system memory pages_addr array, the offset is always 0, otherwise, update GPU mapping will use incorrect system memory page, and cause system memory corruption.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -1
@@ -1153,7 +1153,7 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm, prange->mapping.start = prange->start; prange->mapping.last = prange->last; - prange->mapping.offset = prange->offset; + prange->mapping.offset = prange->ttm_res ? prange->offset :0 ; pte_flags =svm_range_get_pte_flags (adev, prange); r = amdgpu_vm_bo_update_mapping(adev, bo_adev, vm, false, false, NULL,
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 2021-06-04 um 7:10 p.m. schrieb Philip Yang:
Quoted 7 lines
prange->offsetis for VRAM rangemm_nodes, if multiple ranges share samemm_nodes, migrate range back to VRAM will reuse the VRAM at offset of the samemm_nodes. For system memorypages_addrarray, the offset is always 0, otherwise, update GPU mapping will use incorrect system memory page, and cause system memory corruption.Signed-off-by Philip Yang <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_svm.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_svm.c svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm, · line 1159
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1
-1@@ -1153,7 +1153,7 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm, prange->mapping.start = prange->start; prange->mapping.last = prange->last; - prange->mapping.offset = prange->offset; + prange->mapping.offset = prange->ttm_res ? prange->offset :0 ; pte_flags =svm_range_get_pte_flags (adev, prange); r = amdgpu_vm_bo_update_mapping(adev, bo_adev, vm, false, false, NULL,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 05.06.21 um 01:10 schrieb Philip Yang:
Quoted 5 lines
prange->offsetis for VRAM rangemm_nodes, if multiple ranges share samemm_nodes, migrate range back to VRAM will reuse the VRAM at offset of the samemm_nodes. For system memorypages_addrarray, the offset is always 0, otherwise, update GPU mapping will use incorrect system memory page, and cause system memory corruption.
Nirmoy and I also stumbled over a similar problem which we are going to fix inside the VM code instead.
Christian.
Quoted 11 lines
Signed-off-by Philip Yang <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_svm.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_svm.c svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm, · line 1159
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1
-1@@ -1153,7 +1153,7 @@ svm_range_map_to_gpu(struct amdgpu_device *adev, struct amdgpu_vm *vm, prange->mapping.start = prange->start; prange->mapping.last = prange->last; - prange->mapping.offset = prange->offset; + prange->mapping.offset = prange->ttm_res ? prange->offset :0 ; pte_flags =svm_range_get_pte_flags (adev, prange); r = amdgpu_vm_bo_update_mapping(adev, bo_adev, vm, false, false, NULL,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx