drm/amdgpu: Enable XGMI mapping for peer device
Subsystems (2)
PATCH 1/1 drm/amdgpu: Enable XGMI mapping for peer device
Adjust vram base offset for XGMI mapping when update the PT entry so the address will fall into correct XGMI aperture for peer device
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 35 +++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +30 -5
@@ -1890,6 +1890,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,dma_addr_t *pages_addr, struct amdgpu_vm *vm, struct amdgpu_bo_va_mapping *mapping, + uint64_t vram_base_offset, uint64_t flags, struct drm_mm_node *nodes, struct dma_fence **fence)
@@ -1965,7 +1966,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, } }else if (flags &AMDGPU_PTE_VALID ) { - addr += adev->vm_manager.vram_base_offset; + addr += vram_base_offset; addr += pfn <<PAGE_SHIFT ; }
@@ -2012,6 +2013,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,struct drm_mm_node *nodes;struct dma_fence *exclusive, **last_update;uint64_t flags; +uint64_t vram_base_offset = adev->vm_manager.vram_base_offset; +struct amdgpu_device *bo_adev;int r;if (clear || !bo) {
@@ -2030,9 +2033,31 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, exclusive =reservation_object_get_excl (bo->tbo.resv); } -if (bo) +if (bo) { flags =amdgpu_ttm_tt_pte_flags (adev, bo->tbo.ttm, mem); -else + bo_adev =amdgpu_ttm_adev (bo->tbo.bdev); +if (mem && mem->mem_type ==TTM_PL_VRAM && adev != bo_adev) { +if (drm_debug &DRM_UT_DRIVER ) { +list_for_each_entry (mapping, &bo_va->invalids, list) { +DRM_DEBUG_DRIVER ("Try map VRAM va 0x%llx - 0x%llx, offset 0x%llx, from dev %s for peer GPU %s access.\n" , + mapping->start <<PAGE_SHIFT , + ((mapping->last +1 ) <<PAGE_SHIFT ) -1 , + nodes ? nodes->start <<PAGE_SHIFT :0ll , +dev_name (bo_adev->dev), +dev_name (adev->dev)); + } + } +if (adev->gmc.xgmi.hive_id && + adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id) { + vram_base_offset = bo_adev->vm_manager.vram_base_offset; +DRM_DEBUG_DRIVER ("Used XGMI mapping, vram_base_offset 0x%llx.\n" , + vram_base_offset); + }else { +DRM_DEBUG_DRIVER ("Failed to map the VRAM for other device access.\n" ); +return -EINVAL ; + } + } + }else flags =0x0 ;if (clear || (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv))
@@ -2050,8 +2075,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,list_for_each_entry (mapping, &bo_va->invalids, list) { r =amdgpu_vm_bo_split_mapping (adev, exclusive, pages_addr, vm, - mapping, flags, nodes, - last_update); + mapping, vram_base_offset, flags, + nodes, last_update);if (r)return r; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1550870874-1213-1-git-send-email-shaoyun.liu-5C7GfCeVMHo@public.gmane.org
Grodzovsky, Andrey
Acked-by Andrey GrodzovskyAndrey
Quoted 74 lines · Shaoyun
Adjust vram base offset for XGMI mapping when update the PT entry so the address will fall into correct XGMI aperture for peer device
Change-Id I78bdf244da699d2559481ef5afe9663b3e752236Signed-off-by shaoyunl <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 35 +++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +28
-3@@ -1890,6 +1890,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,dma_addr_t *pages_addr, struct amdgpu_vm *vm, struct amdgpu_bo_va_mapping *mapping, + uint64_t vram_base_offset, uint64_t flags, struct drm_mm_node *nodes, struct dma_fence **fence)@@ -1965,7 +1966,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, } }else if (flags &AMDGPU_PTE_VALID ) { - addr += adev->vm_manager.vram_base_offset; + addr += vram_base_offset; addr += pfn <<PAGE_SHIFT ; }@@ -2012,6 +2013,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,struct drm_mm_node *nodes;struct dma_fence *exclusive, **last_update;uint64_t flags; +uint64_t vram_base_offset = adev->vm_manager.vram_base_offset; +struct amdgpu_device *bo_adev;int r;if (clear || !bo) {@@ -2030,9 +2033,31 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, exclusive =reservation_object_get_excl (bo->tbo.resv); } -if (bo) +if (bo) { flags =amdgpu_ttm_tt_pte_flags (adev, bo->tbo.ttm, mem); -else + bo_adev =amdgpu_ttm_adev (bo->tbo.bdev); +if (mem && mem->mem_type ==TTM_PL_VRAM && adev != bo_adev) { +if (drm_debug &DRM_UT_DRIVER ) { +list_for_each_entry (mapping, &bo_va->invalids, list) { +DRM_DEBUG_DRIVER ("Try map VRAM va 0x%llx - 0x%llx, offset 0x%llx, from dev %s for peer GPU %s access.\n" , + mapping->start <<PAGE_SHIFT , + ((mapping->last +1 ) <<PAGE_SHIFT ) -1 , + nodes ? nodes->start <<PAGE_SHIFT :0ll , +dev_name (bo_adev->dev), +dev_name (adev->dev)); + } + } +if (adev->gmc.xgmi.hive_id && + adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id) { + vram_base_offset = bo_adev->vm_manager.vram_base_offset; +DRM_DEBUG_DRIVER ("Used XGMI mapping, vram_base_offset 0x%llx.\n" , + vram_base_offset); + }else { +DRM_DEBUG_DRIVER ("Failed to map the VRAM for other device access.\n" ); +return -EINVAL ; + } + } + }else flags =0x0 ;if (clear || (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv))
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 2082
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-2@@ -2050,8 +2075,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,list_for_each_entry (mapping, &bo_va->invalids, list) { r =amdgpu_vm_bo_split_mapping (adev, exclusive, pages_addr, vm, - mapping, flags, nodes, - last_update); + mapping, vram_base_offset, flags, + nodes, last_update);if (r)return r; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
NAKAm 22.02.19 um 22:28 schrieb Liu, Shaoyun:
Quoted 14 lines
Adjust vram base offset for XGMI mapping when update the PT entry so the address will fall into correct XGMI aperture for peer device
Change-Id I78bdf244da699d2559481ef5afe9663b3e752236Signed-off-by shaoyunl <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 35 +++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, · line 1893
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1890,6 +1890,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,dma_addr_t *pages_addr, struct amdgpu_vm *vm, struct amdgpu_bo_va_mapping *mapping, + uint64_t vram_base_offset,
NAK, please just make sure that the correct adev is used down below.
Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4
-3uint64_t flags, struct drm_mm_node *nodes, struct dma_fence **fence)@@ -1965,7 +1966,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev, } }else if (flags &AMDGPU_PTE_VALID ) { - addr += adev->vm_manager.vram_base_offset; + addr += vram_base_offset; addr += pfn <<PAGE_SHIFT ; }@@ -2012,6 +2013,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,struct drm_mm_node *nodes;struct dma_fence *exclusive, **last_update;uint64_t flags; +uint64_t vram_base_offset = adev->vm_manager.vram_base_offset; +struct amdgpu_device *bo_adev;int r;if (clear || !bo) {@@ -2030,9 +2033,31 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, exclusive =reservation_object_get_excl (bo->tbo.resv); } -if (bo) +if (bo) { flags =amdgpu_ttm_tt_pte_flags (adev, bo->tbo.ttm, mem); -else
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 2047
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +10
-0+ bo_adev =amdgpu_ttm_adev (bo->tbo.bdev); +if (mem && mem->mem_type ==TTM_PL_VRAM && adev != bo_adev) { +if (drm_debug &DRM_UT_DRIVER ) { +list_for_each_entry (mapping, &bo_va->invalids, list) { +DRM_DEBUG_DRIVER ("Try map VRAM va 0x%llx - 0x%llx, offset 0x%llx, from dev %s for peer GPU %s access.\n" , + mapping->start <<PAGE_SHIFT , + ((mapping->last +1 ) <<PAGE_SHIFT ) -1 , + nodes ? nodes->start <<PAGE_SHIFT :0ll , +dev_name (bo_adev->dev), +dev_name (adev->dev));
Big NAK as well. If you want to make that kind of debugging the please use trace points for it and not such extensive debug messages.
Regards,
Christian.
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +13
-0+ } + } +if (adev->gmc.xgmi.hive_id && + adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id) { + vram_base_offset = bo_adev->vm_manager.vram_base_offset; +DRM_DEBUG_DRIVER ("Used XGMI mapping, vram_base_offset 0x%llx.\n" , + vram_base_offset); + }else { +DRM_DEBUG_DRIVER ("Failed to map the VRAM for other device access.\n" ); +return -EINVAL ; + } + } + }else flags =0x0 ;if (clear || (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv))
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 2082
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-2@@ -2050,8 +2075,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,list_for_each_entry (mapping, &bo_va->invalids, list) { r =amdgpu_vm_bo_split_mapping (adev, exclusive, pages_addr, vm, - mapping, flags, nodes, - last_update); + mapping, vram_base_offset, flags, + nodes, last_update);if (r)return r; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 413211ff-8436-ee75-95b6-258967854026-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 11 lines · Christian König
Am 22.02.19 um 22:28 schrieb Liu, Shaoyun:
Quoted 10 lines
Adjust vram base offset for XGMI mapping when update the PT entry so the address will fall into correct XGMI aperture for peer device
Change-Id I78bdf244da699d2559481ef5afe9663b3e752236Signed-off-by shaoyunl <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 35
+++++++++++++++++++++++++++++-----1 file changed, 30 insertions(+), 5 deletions(-)
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_bo_split_mapping(struct · line 1894
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1890,6 +1890,7 @@ static int amdgpu_vm_bo_split_mapping(structamdgpu_device *adev, dma_addr_t *pages_addr, struct amdgpu_vm *vm, struct amdgpu_bo_va_mapping *mapping, + uint64_t vram_base_offset,NAK, please just make sure that the correct adev is used down below.
[shaoyun] The adev not only be used to get vram_base_offset . It's also used to for all other device specific stuff including the PTE , PDE address etc . What we want is the offset that fall into peer device FB to be programmed into local device's PT entry . I don't see a better solution than add the vram_base_offset as a parameter here .
Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0uint64_t flags, struct drm_mm_node *nodes,struct
dma_fence**fence)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1@@ -1965,7 +1966,7 @@ static int amdgpu_vm_bo_split_mapping(structamdgpu_device *adev, } } else if (flags & AMDGPU_PTE_VALID) { - addr += adev->vm_manager.vram_base_offset; + addr += vram_base_offset; addr += pfn << PAGE_SHIFT; }@@ -2012,6 +2013,8 @@ int amdgpu_vm_bo_update(struct
amdgpu_device*adev,
structdrm_mm_node*nodes;
structdma_fence*exclusive, **last_update;uint64_tflags;
+uint64_tvram_base_offset=adev->vm_manager.vram_base_offset; + structamdgpu_device*bo_adev;
int r;
if (clear || !bo) {drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6
-1@@ -2030,9 +2033,31 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, exclusive = reservation_object_get_excl(bo->tbo.resv); } - if (bo) + if (bo) { flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem); - else + bo_adev = amdgpu_ttm_adev(bo->tbo.bdev); + if (mem && mem->mem_type == TTM_PL_VRAM && adev != bo_adev) { + if (drm_debug & DRM_UT_DRIVER) { + list_for_each_entry(mapping, &bo_va->invalids, list) { + DRM_DEBUG_DRIVER("Try map VRAM va 0x%llx - 0x%llx, offset 0x%llx, from dev %s for peer GPU %s access.\n",
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 2047
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-0+ mapping->start << PAGE_SHIFT, + ((mapping->last + 1) << PAGE_SHIFT) - 1, + nodes ? nodes->start << PAGE_SHIFT : 0ll, + dev_name(bo_adev->dev), + dev_name(adev->dev));Big NAK as well. If you want to make that kind of debugging the please use trace points for it and not such extensive debug messages.
[shaoyunl] This debug message can help me debug on some VM fault during XGMI bring up . Not sure whether I can get same if I move it into trace since it may lose some sequence information especially when I need to coordinate with KFD (or even user level) print message for memory allocation and mapping . But anyway , if you strongly against this debug message , I can remove it .
Regards
shaoyun.liu
Quoted 25 lines
Regards,
Christian.Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +9
-0+ } + } + if (adev->gmc.xgmi.hive_id && + adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id) { + vram_base_offset = bo_adev->vm_manager.vram_base_offset; + DRM_DEBUG_DRIVER("Used XGMI mapping, vram_base_offset 0x%llx.\n", + vram_base_offset); + } else { + DRM_DEBUG_DRIVER("Failed to map the VRAM for otherdevice access.\n");
+ return-EINVAL;
+ }
+ }
+ } else
flags =0x0;
if (clear || (bo &&bo->tbo.resv==vm->root.base.bo->tbo.resv))drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0@@ -2050,8 +2075,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, list_for_each_entry(mapping, &bo_va->invalids, list) { r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr,
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-2vm, - mapping, flags, nodes, - last_update); + mapping, vram_base_offset, flags, + nodes, last_update); if (r) return r;}
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): dd0a6818-e430-3439-0d66-4642a4cc4628-5C7GfCeVMHo@public.gmane.org
Am 25.02.19 um 19:47 schrieb Liu, Shaoyun:
Quoted 24 lines · Christian König
Quoted 11 lines
Am 22.02.19 um 22:28 schrieb Liu, Shaoyun:
Quoted 10 lines
Adjust vram base offset for XGMI mapping when update the PT entry so the address will fall into correct XGMI aperture for peer device
Change-Id I78bdf244da699d2559481ef5afe9663b3e752236Signed-off-by shaoyunl <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 35 +++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-)Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_bo_split_mapping(struct · line 1894
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1890,6 +1890,7 @@ static int amdgpu_vm_bo_split_mapping(structamdgpu_device *adev, dma_addr_t *pages_addr, struct amdgpu_vm *vm, struct amdgpu_bo_va_mapping *mapping, + uint64_t vram_base_offset,NAK, please just make sure that the correct adev is used down below.
Quoted 5 lines
[shaoyun] The adev not only be used to get
vram_base_offset. It's also used to for all other device specific stuff including the PTE , PDE address etc . What we want is the offset that fall into peer device FB to be programmed into local device's PT entry . I don't see a better solution than add thevram_base_offsetas a parameter here .
Sounds like you didn't understood me. You should just not add the vram_base_offset as the parameter, but the adev to use.
E.g. something like bo_adev, src_adev or mem_adev or something like that.
Christian.
Quoted 83 lines
Quoted 34 lines
Quoted 34 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0uint64_t flags, struct drm_mm_node *nodes,struct
dma_fence**fence)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1@@ -1965,7 +1966,7 @@ static int amdgpu_vm_bo_split_mapping(structamdgpu_device *adev, } } else if (flags & AMDGPU_PTE_VALID) { - addr += adev->vm_manager.vram_base_offset; + addr += vram_base_offset; addr += pfn << PAGE_SHIFT; } @@ -2012,6 +2013,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device*adev,
structdrm_mm_node*nodes;
structdma_fence*exclusive, **last_update;uint64_tflags;
+uint64_tvram_base_offset=adev->vm_manager.vram_base_offset; + structamdgpu_device*bo_adev;
int r;
if (clear || !bo) {drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6
-1@@ -2030,9 +2033,31 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, exclusive = reservation_object_get_excl(bo->tbo.resv); } - if (bo) + if (bo) { flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem); - else + bo_adev = amdgpu_ttm_adev(bo->tbo.bdev); + if (mem && mem->mem_type == TTM_PL_VRAM && adev != bo_adev) { + if (drm_debug & DRM_UT_DRIVER) { + list_for_each_entry(mapping, &bo_va->invalids, list) { + DRM_DEBUG_DRIVER("Try map VRAM va 0x%llx -Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 2047
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-00x%llx, offset 0x%llx, from dev %s for peer GPU %s access.\n", + mapping->start << PAGE_SHIFT, + ((mapping->last + 1) << PAGE_SHIFT) - 1, + nodes ? nodes->start << PAGE_SHIFT : 0ll, + dev_name(bo_adev->dev), + dev_name(adev->dev));Big NAK as well. If you want to make that kind of debugging the please use trace points for it and not such extensive debug messages.
[shaoyunl] This debug message can help me debug on some VM fault during XGMI bring up . Not sure whether I can get same if I move it into trace since it may lose some sequence information especially when I need to coordinate with KFD (or even user level) print message for memory allocation and mapping . But anyway , if you strongly against this debug message , I can remove it .
Regards
shaoyun.liu
Quoted 29 lines
Regards,
Christian.Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +9
-0+ } + } + if (adev->gmc.xgmi.hive_id && + adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id) { + vram_base_offset = bo_adev->vm_manager.vram_base_offset; + DRM_DEBUG_DRIVER("Used XGMI mapping, vram_base_offset 0x%llx.\n", + vram_base_offset); + } else { + DRM_DEBUG_DRIVER("Failed to map the VRAM for otherdevice access.\n");
+ return-EINVAL;
+ }
+ }
+ } else
flags =0x0;
if (clear || (bo &&bo->tbo.resv==vm->root.base.bo->tbo.resv))drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-2@@ -2050,8 +2075,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, list_for_each_entry(mapping, &bo_va->invalids, list) { r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm, - mapping, flags, nodes, - last_update); + mapping, vram_base_offset, flags,
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0+ nodes, last_update); if (r) return r;}
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1fb9457c-c912-3fd6-18e8-99fdff91c6e5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 31 lines · Christian König
Am 25.02.19 um 19:47 schrieb Liu, Shaoyun:
Quoted 24 lines · Christian König
Quoted 11 lines
Am 22.02.19 um 22:28 schrieb Liu, Shaoyun:
Quoted 10 lines
Adjust vram base offset for XGMI mapping when update the PT entry so the address will fall into correct XGMI aperture for peer device
Change-Id I78bdf244da699d2559481ef5afe9663b3e752236Signed-off-by shaoyunl <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 35
+++++++++++++++++++++++++++++-----1 file changed, 30 insertions(+), 5 deletions(-)Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_bo_split_mapping(struct · line 1894
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1890,6 +1890,7 @@ static int amdgpu_vm_bo_split_mapping(structamdgpu_device *adev, dma_addr_t *pages_addr, struct amdgpu_vm *vm, struct amdgpu_bo_va_mapping *mapping, + uint64_t vram_base_offset,NAK, please just make sure that the correct adev is used down below.
Quoted 5 lines
[shaoyun] The adev not only be used to get
vram_base_offset. It's also used to for all other device specific stuff including the PTE , PDE address etc . What we want is the offset that fall into peer device FB to be programmed into local device's PT entry . I don't see a better solution than add thevram_base_offsetas a parameter here .
Quoted 6 lines
Sounds like you didn't understood me. You should just not add the
vram_base_offsetas the parameter, but the adev to use.E.g. something like
bo_adev,src_adevormem_adevor something like that.Christian.
[shaoyunl] Do you plan to do some extra with this adev( bo_adev as you suggested) other than get the vram_base_offset ?
Otherwise I still don't see why it's better than just pass in the offset directly .
Quoted 86 lines
Quoted 86 lines
Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0uint64_t flags, struct drm_mm_node *nodes,struct
dma_fence**fence)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1@@ -1965,7 +1966,7 @@ static int amdgpu_vm_bo_split_mapping(structamdgpu_device *adev, } } else if (flags & AMDGPU_PTE_VALID) { - addr += adev->vm_manager.vram_base_offset; + addr += vram_base_offset; addr += pfn << PAGE_SHIFT; }@@ -2012,6 +2013,8 @@ int amdgpu_vm_bo_update(struct
amdgpu_device*adev,
structdrm_mm_node*nodes;
structdma_fence*exclusive, **last_update;uint64_tflags;
+uint64_tvram_base_offset=adev->vm_manager.vram_base_offset; + structamdgpu_device*bo_adev;
int r;
if (clear || !bo) {drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6
-1@@ -2030,9 +2033,31 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, exclusive = reservation_object_get_excl(bo->tbo.resv); } - if (bo) + if (bo) { flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem); - else + bo_adev = amdgpu_ttm_adev(bo->tbo.bdev); + if (mem && mem->mem_type == TTM_PL_VRAM && adev != bo_adev) { + if (drm_debug & DRM_UT_DRIVER) { + list_for_each_entry(mapping, &bo_va->invalids, list) { + DRM_DEBUG_DRIVER("Try map VRAM va 0x%llx -Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device · line 2050
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-00x%llx, offset 0x%llx, from dev %s for peer GPU %s access.\n", + mapping->start << PAGE_SHIFT, + ((mapping->last + 1) << PAGE_SHIFT) - 1, + nodes ? nodes->start << PAGE_SHIFT : 0ll, + dev_name(bo_adev->dev), + dev_name(adev->dev));Big NAK as well. If you want to make that kind of debugging the please use trace points for it and not such extensive debug messages.
[shaoyunl] This debug message can help me debug on some VM fault during XGMI bring up . Not sure whether I can get same if I move it into trace since it may lose some sequence information especially when I need to coordinate with KFD (or even user level) print message for memory allocation and mapping . But anyway , if you strongly against this debug message , I can remove it .
Regards
shaoyun.liu
Quoted 31 lines
Regards,
Christian.Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-0+ } + } + if (adev->gmc.xgmi.hive_id && + adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id) { + vram_base_offset =
bo_adev->vm_manager.vram_base_offset;
+ DRM_DEBUG_DRIVER("Used XGMI mapping,vram_base_offset0x%llx.\n",
+vram_base_offset);
+ } else {
+DRM_DEBUG_DRIVER("Failed to map the VRAM for other device access.\n");
+ return-EINVAL;
+ }
+ }
+ } else
flags =0x0;
if (clear || (bo &&bo->tbo.resv==vm->root.base.bo->tbo.resv))drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-2@@ -2050,8 +2075,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, list_for_each_entry(mapping, &bo_va->invalids, list) { r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm, - mapping, flags, nodes, - last_update); + mapping, vram_base_offset, flags,
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0+ nodes, last_update); if (r) return r;}
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 8ff6d4f9-c2a6-9186-a906-85fe072f5974-5C7GfCeVMHo@public.gmane.org
Am 26.02.19 um 19:10 schrieb Liu, Shaoyun:
Quoted 36 lines · Christian König
Quoted 35 lines
Am 25.02.19 um 19:47 schrieb Liu, Shaoyun:
Quoted 24 lines · Christian König
Quoted 11 lines
Am 22.02.19 um 22:28 schrieb Liu, Shaoyun:
Quoted 10 lines
Adjust vram base offset for XGMI mapping when update the PT entry so the address will fall into correct XGMI aperture for peer device
Change-Id I78bdf244da699d2559481ef5afe9663b3e752236Signed-off-by shaoyunl <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 35 +++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-)Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_bo_split_mapping(struct · line 1894
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -1890,6 +1890,7 @@ static int amdgpu_vm_bo_split_mapping(structamdgpu_device *adev, dma_addr_t *pages_addr, struct amdgpu_vm *vm, struct amdgpu_bo_va_mapping *mapping, + uint64_t vram_base_offset,NAK, please just make sure that the correct adev is used down below.
Quoted 5 lines
[shaoyun] The adev not only be used to get
vram_base_offset. It's also used to for all other device specific stuff including the PTE , PDE address etc . What we want is the offset that fall into peer device FB to be programmed into local device's PT entry . I don't see a better solution than add thevram_base_offsetas a parameter here .Sounds like you didn't understood me. You should just not add the
vram_base_offsetas the parameter, but the adev to use.E.g. something like
bo_adev,src_adevormem_adevor something like that.
Quoted 7 lines
Quoted 1 line
Christian.
[shaoyunl] Do you plan to do some extra with this
adev( bo_adev as you suggested)other than get thevram_base_offset?Otherwise I still don't see why it's better than just pass in the offset directly .
Quite simple it is much more descriptive to do so.
BTW while at it please put it before to the mm nodes, because it is actually an attribute describing those.
Christian.
Quoted 95 lines
Quoted 87 lines
Quoted 87 lines
Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0uint64_t flags, struct drm_mm_node *nodes,struct
dma_fence**fence)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1@@ -1965,7 +1966,7 @@ static int amdgpu_vm_bo_split_mapping(structamdgpu_device *adev, } } else if (flags & AMDGPU_PTE_VALID) { - addr += adev->vm_manager.vram_base_offset; + addr += vram_base_offset; addr += pfn << PAGE_SHIFT; } @@ -2012,6 +2013,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device*adev,
structdrm_mm_node*nodes;
structdma_fence*exclusive, **last_update;uint64_tflags;
+uint64_tvram_base_offset=adev->vm_manager.vram_base_offset; + structamdgpu_device*bo_adev;
int r;
if (clear || !bo) {drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6
-1@@ -2030,9 +2033,31 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, exclusive = reservation_object_get_excl(bo->tbo.resv); } - if (bo) + if (bo) { flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem); - else + bo_adev = amdgpu_ttm_adev(bo->tbo.bdev); + if (mem && mem->mem_type == TTM_PL_VRAM && adev != bo_adev) { + if (drm_debug & DRM_UT_DRIVER) { + list_for_each_entry(mapping, &bo_va->invalids, list) { + DRM_DEBUG_DRIVER("Try map VRAM va 0x%llx -Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device · line 2050
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-00x%llx, offset 0x%llx, from dev %s for peer GPU %s access.\n", + mapping->start << PAGE_SHIFT, + ((mapping->last + 1) << PAGE_SHIFT) - 1, + nodes ? nodes->start << PAGE_SHIFT : 0ll, + dev_name(bo_adev->dev), + dev_name(adev->dev));Big NAK as well. If you want to make that kind of debugging the please use trace points for it and not such extensive debug messages.
[shaoyunl] This debug message can help me debug on some VM fault during XGMI bring up . Not sure whether I can get same if I move it into trace since it may lose some sequence information especially when I need to coordinate with KFD (or even user level) print message for memory allocation and mapping . But anyway , if you strongly against this debug message , I can remove it .
Regards
shaoyun.liu
Quoted 31 lines
Regards,
Christian.Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-0+ } + } + if (adev->gmc.xgmi.hive_id && + adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id) { + vram_base_offset =
bo_adev->vm_manager.vram_base_offset;
+ DRM_DEBUG_DRIVER("Used XGMI mapping,vram_base_offset0x%llx.\n",
+vram_base_offset);
+ } else {
+DRM_DEBUG_DRIVER("Failed to map the VRAM for other device access.\n");
+ return-EINVAL;
+ }
+ }
+ } else
flags =0x0;
if (clear || (bo &&bo->tbo.resv==vm->root.base.bo->tbo.resv))drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-2@@ -2050,8 +2075,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, list_for_each_entry(mapping, &bo_va->invalids, list) { r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm, - mapping, flags, nodes, - last_update); + mapping, vram_base_offset, flags,Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0+ nodes, last_update); if (r) return r;}
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx