All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdkfd: pages_addr offset must be 0 for system range
@ 2021-06-04 23:10 Philip Yang
  2021-06-04 23:16 ` Felix Kuehling
  2021-06-05 10:49 ` Christian König
  0 siblings, 2 replies; 3+ messages in thread
From: Philip Yang @ 2021-06-04 23:10 UTC (permalink / raw)
  To: amd-gfx, Felix.Kuehling; +Cc: Philip Yang

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.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index f2901e7a993e..0f18bd0dc64e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -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,
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdkfd: pages_addr offset must be 0 for system range
  2021-06-04 23:10 [PATCH] drm/amdkfd: pages_addr offset must be 0 for system range Philip Yang
@ 2021-06-04 23:16 ` Felix Kuehling
  2021-06-05 10:49 ` Christian König
  1 sibling, 0 replies; 3+ messages in thread
From: Felix Kuehling @ 2021-06-04 23:16 UTC (permalink / raw)
  To: Philip Yang, amd-gfx

Am 2021-06-04 um 7:10 p.m. schrieb Philip Yang:
> 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.
>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index f2901e7a993e..0f18bd0dc64e 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdkfd: pages_addr offset must be 0 for system range
  2021-06-04 23:10 [PATCH] drm/amdkfd: pages_addr offset must be 0 for system range Philip Yang
  2021-06-04 23:16 ` Felix Kuehling
@ 2021-06-05 10:49 ` Christian König
  1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2021-06-05 10:49 UTC (permalink / raw)
  To: Philip Yang, amd-gfx, Felix.Kuehling

Am 05.06.21 um 01:10 schrieb Philip Yang:
> 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.

Nirmoy and I also stumbled over a similar problem which we are going to 
fix inside the VM code instead.

Christian.

>
> Signed-off-by: Philip Yang <Philip.Yang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index f2901e7a993e..0f18bd0dc64e 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-05 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 23:10 [PATCH] drm/amdkfd: pages_addr offset must be 0 for system range Philip Yang
2021-06-04 23:16 ` Felix Kuehling
2021-06-05 10:49 ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.