Skip to contentSkip to conversation

drm/amdkfd: fix ttm size refactor fallout

PATCH Applied Daniel Vetter 5 participants 6 messages Dec 14, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: fix ttm size refactor fallout

I guess Christian didn't compile test amdkfd.

Fixes e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
Cc Christian König <[email protected]>
Cc Huang Rui <[email protected]> (v1)
Cc Daniel Vetter <[email protected]>
Cc Felix Kuehling <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +4 -4
index 7791d074bd32..a9647e7f98a8 100644
@@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem,
 	struct amdgpu_bo *bo = mem->bo;
 	uint64_t va = mem->va;
 	struct list_head *list_bo_va = &mem->bo_va_list;
-	unsigned long bo_size = bo->tbo.mem.size;
+	unsigned long bo_size = bo->tbo.base.size;
 
 	if (!va) {
 		pr_err("Invalid VA when adding BO to VM\n");
@@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
 		struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
 {
 	struct amdkfd_process_info *process_info = mem->process_info;
-	unsigned long bo_size = mem->bo->tbo.mem.size;
+	unsigned long bo_size = mem->bo->tbo.base.size;
 	struct kfd_bo_va_list *entry, *tmp;
 	struct bo_vm_reservation_context ctx;
 	struct ttm_validate_buffer *bo_list_entry;
@@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
 	mutex_lock(&mem->lock);
 
 	domain = mem->domain;
-	bo_size = bo->tbo.mem.size;
+	bo_size = bo->tbo.base.size;
 
 	pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
 			mem->va,
@@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
 	struct amdgpu_device *adev = get_amdgpu_device(kgd);
 	struct amdkfd_process_info *process_info =
 		((struct amdgpu_vm *)vm)->process_info;
-	unsigned long bo_size = mem->bo->tbo.mem.size;
+	unsigned long bo_size = mem->bo->tbo.base.size;
 	struct kfd_bo_va_list *entry;
 	struct bo_vm_reservation_context ctx;
 	int ret;
Signature · 6 lines
2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Daniel Vetter

I guess Christian didn't compile test amdkfd.

Fixes e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
Cc Christian König <[email protected]>
Cc Huang Rui <[email protected]> (v1)
Cc Daniel Vetter <[email protected]>
Cc Felix Kuehling <[email protected]>
Quoted 47 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +4 -5
index 7791d074bd32..a9647e7f98a8 100644
@@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem,
        struct amdgpu_bo *bo = mem->bo;
        uint64_t va = mem->va;
        struct list_head *list_bo_va = &mem->bo_va_list;
-       unsigned long bo_size = bo->tbo.mem.size;
+       unsigned long bo_size = bo->tbo.base.size;
 
        if (!va) {
                pr_err("Invalid VA when adding BO to VM\n");
@@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
                struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
 {
        struct amdkfd_process_info *process_info = mem->process_info;
-       unsigned long bo_size = mem->bo->tbo.mem.size;
+       unsigned long bo_size = mem->bo->tbo.base.size;
        struct kfd_bo_va_list *entry, *tmp;
        struct bo_vm_reservation_context ctx;
        struct ttm_validate_buffer *bo_list_entry;
@@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
        mutex_lock(&mem->lock);
 
        domain = mem->domain;
-       bo_size = bo->tbo.mem.size;
+       bo_size = bo->tbo.base.size;
 
        pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
                        mem->va,
@@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
        struct amdgpu_device *adev = get_amdgpu_device(kgd);
        struct amdkfd_process_info *process_info =
                ((struct amdgpu_vm *)vm)->process_info;
-       unsigned long bo_size = mem->bo->tbo.mem.size;
+       unsigned long bo_size = mem->bo->tbo.base.size;
        struct kfd_bo_va_list *entry;
        struct bo_vm_reservation_context ctx;
        int ret;
--

2.29.2

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

#2 lore raw
Quoted 12 lines · Alex Deucher
Quoted 10 lines · Daniel Vetter

I guess Christian didn't compile test amdkfd.

Fixes e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
Cc Christian König <[email protected]>
Cc Huang Rui <[email protected]> (v1)
Cc Daniel Vetter <[email protected]>
Cc Felix Kuehling <[email protected]>
Quoted 1 line

Pushed to drm-misc-next, thanks for review and all. -Daniel

Quoted 52 lines
Quoted 52 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +4 -5
index 7791d074bd32..a9647e7f98a8 100644
@@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem,
        struct amdgpu_bo *bo = mem->bo;
        uint64_t va = mem->va;
        struct list_head *list_bo_va = &mem->bo_va_list;
-       unsigned long bo_size = bo->tbo.mem.size;
+       unsigned long bo_size = bo->tbo.base.size;
 
        if (!va) {
                pr_err("Invalid VA when adding BO to VM\n");
@@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
                struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
 {
        struct amdkfd_process_info *process_info = mem->process_info;
-       unsigned long bo_size = mem->bo->tbo.mem.size;
+       unsigned long bo_size = mem->bo->tbo.base.size;
        struct kfd_bo_va_list *entry, *tmp;
        struct bo_vm_reservation_context ctx;
        struct ttm_validate_buffer *bo_list_entry;
@@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
        mutex_lock(&mem->lock);
 
        domain = mem->domain;
-       bo_size = bo->tbo.mem.size;
+       bo_size = bo->tbo.base.size;
 
        pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
                        mem->va,
@@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
        struct amdgpu_device *adev = get_amdgpu_device(kgd);
        struct amdkfd_process_info *process_info =
                ((struct amdgpu_vm *)vm)->process_info;
-       unsigned long bo_size = mem->bo->tbo.mem.size;
+       unsigned long bo_size = mem->bo->tbo.base.size;
        struct kfd_bo_va_list *entry;
        struct bo_vm_reservation_context ctx;
        int ret;
--

2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Daniel Vetter

Am 2020-12-14 um 2:17 p.m. schrieb Daniel Vetter:

Quoted 9 lines

I guess Christian didn't compile test amdkfd.

Fixes e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
Cc Christian König <[email protected]>
Cc Huang Rui <[email protected]> (v1)
Cc Daniel Vetter <[email protected]>
Cc Felix Kuehling <[email protected]>

Thanks.

Quoted 36 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +3 -3
index 7791d074bd32..a9647e7f98a8 100644
@@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem,
 	struct amdgpu_bo *bo = mem->bo;
 	uint64_t va = mem->va;
 	struct list_head *list_bo_va = &mem->bo_va_list;
-	unsigned long bo_size = bo->tbo.mem.size;
+	unsigned long bo_size = bo->tbo.base.size;
 
 	if (!va) {
 		pr_err("Invalid VA when adding BO to VM\n");
@@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
 		struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
 {
 	struct amdkfd_process_info *process_info = mem->process_info;
-	unsigned long bo_size = mem->bo->tbo.mem.size;
+	unsigned long bo_size = mem->bo->tbo.base.size;
 	struct kfd_bo_va_list *entry, *tmp;
 	struct bo_vm_reservation_context ctx;
 	struct ttm_validate_buffer *bo_list_entry;
@@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
 	mutex_lock(&mem->lock);
 
 	domain = mem->domain;
-	bo_size = bo->tbo.mem.size;
+	bo_size = bo->tbo.base.size;
 
 	pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
 			mem->va,

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu( · line 1512

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +1 -1
@@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
 	struct amdgpu_device *adev = get_amdgpu_device(kgd);
 	struct amdkfd_process_info *process_info =
 		((struct amdgpu_vm *)vm)->process_info;
-	unsigned long bo_size = mem->bo->tbo.mem.size;
+	unsigned long bo_size = mem->bo->tbo.base.size;
 	struct kfd_bo_va_list *entry;
 	struct bo_vm_reservation_context ctx;
 	int ret;

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer Reviewed-by on v1 1/1
#4 lore raw
In reply to Daniel Vetter

Am 14.12.20 um 20:17 schrieb Daniel Vetter:

Quoted 1 line

I guess Christian didn't compile test amdkfd.

Scratching my head what has happened here. When I tested everything was at least building fine.

Quoted 8 lines
Fixes e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
Cc Christian König <[email protected]>
Cc Huang Rui <[email protected]> (v1)
Cc Daniel Vetter <[email protected]>
Cc Felix Kuehling <[email protected]>
Quoted 36 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +3 -3
index 7791d074bd32..a9647e7f98a8 100644
@@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem,
  	struct amdgpu_bo *bo = mem->bo;
  	uint64_t va = mem->va;
  	struct list_head *list_bo_va = &mem->bo_va_list;
-	unsigned long bo_size = bo->tbo.mem.size;
+	unsigned long bo_size = bo->tbo.base.size;
 
  	if (!va) {
  		pr_err("Invalid VA when adding BO to VM\n");
@@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
  		struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
  {
  	struct amdkfd_process_info *process_info = mem->process_info;
-	unsigned long bo_size = mem->bo->tbo.mem.size;
+	unsigned long bo_size = mem->bo->tbo.base.size;
  	struct kfd_bo_va_list *entry, *tmp;
  	struct bo_vm_reservation_context ctx;
  	struct ttm_validate_buffer *bo_list_entry;
@@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
  	mutex_lock(&mem->lock);
 
  	domain = mem->domain;
-	bo_size = bo->tbo.mem.size;
+	bo_size = bo->tbo.base.size;
 
  	pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
  			mem->va,

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu( · line 1512

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +1 -1
@@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
  	struct amdgpu_device *adev = get_amdgpu_device(kgd);
  	struct amdkfd_process_info *process_info =
  		((struct amdgpu_vm *)vm)->process_info;
-	unsigned long bo_size = mem->bo->tbo.mem.size;
+	unsigned long bo_size = mem->bo->tbo.base.size;
  	struct kfd_bo_va_list *entry;
  	struct bo_vm_reservation_context ctx;
  	int ret;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

maintainer
#5 lore raw

Am 2020-12-14 um 3:27 p.m. schrieb Christian König:

Quoted 5 lines

Am 14.12.20 um 20:17 schrieb Daniel Vetter:

Quoted 1 line

I guess Christian didn't compile test amdkfd.

Scratching my head what has happened here. When I tested everything was at least building fine.

Looks like you were missing CONFIG_HSA_AMD in your .config for some reason.

Regards,
  Felix

Quoted 47 lines
Quoted 9 lines
Fixes e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
Cc Christian König <[email protected]>
Cc Huang Rui <[email protected]> (v1)
Cc Daniel Vetter <[email protected]>
Cc Felix Kuehling <[email protected]>
Quoted 35 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++++----

  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +3 -3
index 7791d074bd32..a9647e7f98a8 100644
@@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device
 *adev, struct kgd_mem *mem,
       struct amdgpu_bo *bo = mem->bo;
       uint64_t va = mem->va;
       struct list_head *list_bo_va = &mem->bo_va_list;
-    unsigned long bo_size = bo->tbo.mem.size;
+    unsigned long bo_size = bo->tbo.base.size;
         if (!va) {
           pr_err("Invalid VA when adding BO to VM\n");
@@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
           struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
   {
       struct amdkfd_process_info *process_info = mem->process_info;
-    unsigned long bo_size = mem->bo->tbo.mem.size;
+    unsigned long bo_size = mem->bo->tbo.base.size;
       struct kfd_bo_va_list *entry, *tmp;
       struct bo_vm_reservation_context ctx;
       struct ttm_validate_buffer *bo_list_entry;
@@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
       mutex_lock(&mem->lock);
         domain = mem->domain;
-    bo_size = bo->tbo.mem.size;
+    bo_size = bo->tbo.base.size;
         pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
               mem->va,
@@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +0 -0
       struct amdgpu_device *adev = get_amdgpu_device(kgd);

      struct amdkfd_process_info *process_info = ((struct amdgpu_vm *)vm)->process_info; -    unsigned long bo_size = mem->bo->tbo.mem.size; +    unsigned long bo_size = mem->bo->tbo.base.size; struct kfd_bo_va_list *entry;
      struct bo_vm_reservation_context ctx; int ret;

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel