Skip to contentSkip to conversation

drm/amdgpu: fix PRT cleanup order in the VM

PATCH In review Christian König 4 participants 7 messages Feb 13, 2017 – Feb 14, 2017 5 messages not in the archive

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

PATCH 1/2 drm/amdgpu: fix PRT cleanup order in the VM

From: Christian König <[email protected]>

We need to unmap the PRTs first and then free our scheduler entity.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
index bc32239..0b7386e 100644
@@ -1687,8 +1687,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	struct amdgpu_bo_va_mapping *mapping, *tmp;
 	int i;
 
-	amd_sched_entity_fini(vm->entity.sched, &vm->entity);
-
 	if (!RB_EMPTY_ROOT(&vm->va)) {
 		dev_err(adev->dev, "still active bo inside vm\n");
 	}
@@ -1706,6 +1704,8 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	}
 	amdgpu_vm_clear_freed(adev, vm);
 
+	amd_sched_entity_fini(vm->entity.sched, &vm->entity);
+
 	for (i = 0; i < amdgpu_vm_num_pdes(adev); i++) {
 		struct amdgpu_bo *pt = vm->page_tables[i].bo;
 
Signature · 6 lines
2.5.0

_______________________________________________
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): 1486992233-2052-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amdgpu: fix PTE defines

From: Christian König <[email protected]>

Those should be 64bit, even on a 32bit system.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +7 -7
index 4d26e9b..51fa12f 100644
@@ -53,19 +53,19 @@ struct amdgpu_bo_list_entry;
 /* LOG2 number of continuous pages for the fragment field */
 #define AMDGPU_LOG2_PAGES_PER_FRAG 4
 
-#define AMDGPU_PTE_VALID	(1 << 0)
-#define AMDGPU_PTE_SYSTEM	(1 << 1)
-#define AMDGPU_PTE_SNOOPED	(1 << 2)
+#define AMDGPU_PTE_VALID	(1ULL << 0)
+#define AMDGPU_PTE_SYSTEM	(1ULL << 1)
+#define AMDGPU_PTE_SNOOPED	(1ULL << 2)
 
 /* VI only */
-#define AMDGPU_PTE_EXECUTABLE	(1 << 4)
+#define AMDGPU_PTE_EXECUTABLE	(1ULL << 4)
 
-#define AMDGPU_PTE_READABLE	(1 << 5)
-#define AMDGPU_PTE_WRITEABLE	(1 << 6)
+#define AMDGPU_PTE_READABLE	(1ULL << 5)
+#define AMDGPU_PTE_WRITEABLE	(1ULL << 6)
 
 #define AMDGPU_PTE_FRAG(x)	((x & 0x1f) << 7)
 
-#define AMDGPU_PTE_PRT		(1UL << 63)
+#define AMDGPU_PTE_PRT		(1ULL << 63)
 
 /* How to programm VM fault handling */
 #define AMDGPU_VM_FAULT_STOP_NEVER	0
Signature · 6 lines
2.5.0

_______________________________________________
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): 1486992233-2052-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Alex Deucher
#4 lore raw

RE: [PATCH 2/2] drm/amdgpu: fix PTE defines

Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Monday, February 13, 2017 8:24 AM
To: [email protected]
Subject: [PATCH 2/2] drm/amdgpu: fix PTE defines

Quoted 5 lines

From: Christian König <[email protected]>

Those should be 64bit, even on a 32bit system.

Series is:

Quoted 39 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +7 -8
index 4d26e9b..51fa12f 100644
@@ -53,19 +53,19 @@ struct amdgpu_bo_list_entry;
 /* LOG2 number of continuous pages for the fragment field */
 #define AMDGPU_LOG2_PAGES_PER_FRAG 4
 
-#define AMDGPU_PTE_VALID	(1 << 0)
-#define AMDGPU_PTE_SYSTEM	(1 << 1)
-#define AMDGPU_PTE_SNOOPED	(1 << 2)
+#define AMDGPU_PTE_VALID	(1ULL << 0)
+#define AMDGPU_PTE_SYSTEM	(1ULL << 1)
+#define AMDGPU_PTE_SNOOPED	(1ULL << 2)
 
 /* VI only */
-#define AMDGPU_PTE_EXECUTABLE	(1 << 4)
+#define AMDGPU_PTE_EXECUTABLE	(1ULL << 4)
 
-#define AMDGPU_PTE_READABLE	(1 << 5)
-#define AMDGPU_PTE_WRITEABLE	(1 << 6)
+#define AMDGPU_PTE_READABLE	(1ULL << 5)
+#define AMDGPU_PTE_WRITEABLE	(1ULL << 6)
 
 #define AMDGPU_PTE_FRAG(x)	((x & 0x1f) << 7)
 
-#define AMDGPU_PTE_PRT		(1UL << 63)
+#define AMDGPU_PTE_PRT		(1ULL << 63)
 
 /* How to programm VM fault handling */
 #define AMDGPU_VM_FAULT_STOP_NEVER	0
--

2.5.0

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

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB165278DC90AA78297CB18BAEF7590-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by Junwei Zhang
#6 lore raw

RE: [PATCH 2/2] drm/amdgpu: fix PTE defines

Regards,
Jerry (Junwei Zhang)

Linux Base Graphics
SRDC Software Development
_____________________________________

Quoted 14 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Deucher, Alexander
Sent: Tuesday, February 14, 2017 0:24
To: 'Christian König'; [email protected]
Subject: RE: [PATCH 2/2] drm/amdgpu: fix PTE defines

Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Monday, February 13, 2017 8:24 AM
To: [email protected]
Subject: [PATCH 2/2] drm/amdgpu: fix PTE defines

Quoted 8 lines
Quoted 5 lines

From: Christian König <[email protected]>

Those should be 64bit, even on a 32bit system.

Series is:

Quoted 40 lines
Quoted 40 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0 -0
index 4d26e9b..51fa12f 100644
@@ -53,19 +53,19 @@ struct amdgpu_bo_list_entry;
 /* LOG2 number of continuous pages for the fragment field */  #define

AMDGPU_LOG2_PAGES_PER_FRAG 4

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +7 -8
-#define AMDGPU_PTE_VALID	(1 << 0)
-#define AMDGPU_PTE_SYSTEM	(1 << 1)
-#define AMDGPU_PTE_SNOOPED	(1 << 2)
+#define AMDGPU_PTE_VALID	(1ULL << 0)
+#define AMDGPU_PTE_SYSTEM	(1ULL << 1)
+#define AMDGPU_PTE_SNOOPED	(1ULL << 2)
 
 /* VI only */
-#define AMDGPU_PTE_EXECUTABLE	(1 << 4)
+#define AMDGPU_PTE_EXECUTABLE	(1ULL << 4)
 
-#define AMDGPU_PTE_READABLE	(1 << 5)
-#define AMDGPU_PTE_WRITEABLE	(1 << 6)
+#define AMDGPU_PTE_READABLE	(1ULL << 5)
+#define AMDGPU_PTE_WRITEABLE	(1ULL << 6)
 
 #define AMDGPU_PTE_FRAG(x)	((x & 0x1f) << 7)
 
-#define AMDGPU_PTE_PRT		(1UL << 63)
+#define AMDGPU_PTE_PRT		(1ULL << 63)
 
 /* How to programm VM fault handling */
 #define AMDGPU_VM_FAULT_STOP_NEVER	0
--

2.5.0

Quoted 8 lines
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

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

Reviewed-by
#7 lore raw
In reply to a message not in the archive
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

We need to unmap the PRTs first and then free our scheduler entity.

Thanks for the quick fix! Both patches are

... and I'll probably get around to testing them soon, as well.

Quoted 21 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -2
index bc32239..0b7386e 100644
@@ -1687,8 +1687,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	struct amdgpu_bo_va_mapping *mapping, *tmp;
 	int i;
 
-	amd_sched_entity_fini(vm->entity.sched, &vm->entity);
-
 	if (!RB_EMPTY_ROOT(&vm->va)) {
 		dev_err(adev->dev, "still active bo inside vm\n");
 	}

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) · line 1711

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -0
@@ -1706,6 +1704,8 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	}
 	amdgpu_vm_clear_freed(adev, vm);
 
+	amd_sched_entity_fini(vm->entity.sched, &vm->entity);
+
 	for (i = 0; i < amdgpu_vm_num_pdes(adev); i++) {
 		struct amdgpu_bo *pt = vm->page_tables[i].bo;
 

_______________________________________________
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): 675995bf-35d9-53bd-810e-72353331d653-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#9 lore raw
Quoted 10 lines · Nicolai Hähnle
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

We need to unmap the PRTs first and then free our scheduler entity.

Thanks for the quick fix! Both patches are

... and I'll probably get around to testing them soon, as well.

Hmm, I still get both the "suspicious RCU" and amdgpu_bo_gpu_offset warning.

Nicolai

Quoted 27 lines
Quoted 27 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -2
index bc32239..0b7386e 100644
@@ -1687,8 +1687,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev,
 struct amdgpu_vm *vm)
     struct amdgpu_bo_va_mapping *mapping, *tmp;
     int i;
 
-    amd_sched_entity_fini(vm->entity.sched, &vm->entity);
-
     if (!RB_EMPTY_ROOT(&vm->va)) {
         dev_err(adev->dev, "still active bo inside vm\n");
     }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
@@ -1706,6 +1704,8 @@ void amdgpu_vm_fini(struct amdgpu_device *adev,
 struct amdgpu_vm *vm)
     }
     amdgpu_vm_clear_freed(adev, vm);
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) · line 1710

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -0
+    amd_sched_entity_fini(vm->entity.sched, &vm->entity);
+
     for (i = 0; i < amdgpu_vm_num_pdes(adev); i++) {
         struct amdgpu_bo *pt = vm->page_tables[i].bo;

_______________________________________________
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): 1ae09354-6e3a-f868-6011-02f0dd9b9553-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#11 lore raw

Am 13.02.2017 um 18:32 schrieb Nicolai Hähnle:

Quoted 6 lines · Nicolai Hähnle
Quoted 5 lines · Christian König
Quoted 3 lines

From: Christian König <[email protected]>

We need to unmap the PRTs first and then free our scheduler entity.

Quoted 7 lines
Quoted 5 lines

Thanks for the quick fix! Both patches are

... and I'll probably get around to testing them soon, as well.

Hmm, I still get both the "suspicious RCU" and amdgpu_bo_gpu_offset warning.

Yeah, that's actually another issue. Going to work on that as well.

I probably should come up with a more complete solution covering both cases.

Regards,
Christian.

Quoted 38 lines

Nicolai

Quoted 34 lines
Quoted 33 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -2
index bc32239..0b7386e 100644
@@ -1687,8 +1687,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev,
 struct amdgpu_vm *vm)
     struct amdgpu_bo_va_mapping *mapping, *tmp;
     int i;
 
-    amd_sched_entity_fini(vm->entity.sched, &vm->entity);
-
     if (!RB_EMPTY_ROOT(&vm->va)) {
         dev_err(adev->dev, "still active bo inside vm\n");
     }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -0
@@ -1706,6 +1704,8 @@ void amdgpu_vm_fini(struct amdgpu_device *adev,
 struct amdgpu_vm *vm)
     }
     amdgpu_vm_clear_freed(adev, vm);
 
+    amd_sched_entity_fini(vm->entity.sched, &vm->entity);
+
     for (i = 0; i < amdgpu_vm_num_pdes(adev); i++) {
         struct amdgpu_bo *pt = vm->page_tables[i].bo;

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