Skip to contentSkip to conversation

drm/amdgpu: fix amdgpu_vm_clear_freed

PATCH In review Christian König 3 participants 4 messages Apr 19, 2017 – Apr 20, 2017 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: fix amdgpu_vm_clear_freed

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

Use amdgpu_vm_bo_update_mapping() instead of amdgpu_vm_bo_split_mapping() here.

We don't want any flags set in the cleared areas and splitting should be unnecessary.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -2
index 9017b51..27af436 100644
@@ -1631,8 +1631,9 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
 			struct amdgpu_bo_va_mapping, list);
 		list_del(&mapping->list);
 
-		r = amdgpu_vm_bo_split_mapping(adev, NULL, 0, NULL, vm, mapping,
-					       0, 0, &f);
+		r = amdgpu_vm_bo_update_mapping(adev, NULL, 0, NULL, vm,
+						mapping->start, mapping->last,
+						0, 0, &f);
 		amdgpu_vm_free_mapping(adev, vm, mapping, f);
 		if (r) {
 			fence_put(f);
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): 1492610826-1874-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Alex Deucher
#2 lore raw
Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Wednesday, April 19, 2017 10:07 AM
To: [email protected]
Subject: [PATCH] drm/amdgpu: fix amdgpu_vm_clear_freed

Quoted 7 lines

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

Use amdgpu_vm_bo_update_mapping() instead of
amdgpu_vm_bo_split_mapping() here.

We don't want any flags set in the cleared areas and splitting should be unnecessary.

I think you mean "shouldn't"? With that fixed:

Quoted 30 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
index 9017b51..27af436 100644
@@ -1631,8 +1631,9 @@ int amdgpu_vm_clear_freed(struct
 amdgpu_device *adev,
 			struct amdgpu_bo_va_mapping, list);
 		list_del(&mapping->list);
 
-		r = amdgpu_vm_bo_split_mapping(adev, NULL, 0, NULL, vm,
 mapping,
-					       0, 0, &f);
+		r = amdgpu_vm_bo_update_mapping(adev, NULL, 0, NULL,
 vm,
+						mapping->start, mapping-
Quoted 1 line

last,

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
+						0, 0, &f);
 		amdgpu_vm_free_mapping(adev, vm, mapping, f);
 		if (r) {
 			fence_put(f);
--

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

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

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

Use amdgpu_vm_bo_update_mapping() instead of amdgpu_vm_bo_split_mapping() here.

We don't want any flags set in the cleared areas and splitting should be unnecessary.

Yeah, the mappings in the freed list are split already, I think.

Quoted 11 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index 9017b51..27af436 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_clear_freed(struct amdgpu_device *adev, · line 1636

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -2
@@ -1631,8 +1631,9 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
  			struct amdgpu_bo_va_mapping, list);
  		list_del(&mapping->list);
 
-		r = amdgpu_vm_bo_split_mapping(adev, NULL, 0, NULL, vm, mapping,
-					       0, 0, &f);
+		r = amdgpu_vm_bo_update_mapping(adev, NULL, 0, NULL, vm,
+						mapping->start, mapping->last,
+						0, 0, &f);

We may also pass the offset for updating.
+ r = amdgpu_vm_bo_update_mapping(adev, NULL, 0, NULL, vm,
+ mapping->start, mapping->last,
+ 0, mapping->offset, &f);

Jerry

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_clear_freed(struct amdgpu_device *adev, · line 1639

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
  		amdgpu_vm_free_mapping(adev, vm, mapping, f);
  		if (r) {
  			fence_put(f);

_______________________________________________
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): [email protected]

Reviewed-by Junwei Zhang
#5 lore raw
Quoted 32 lines · Jerry (Junwei)
Quoted 6 lines · Christian König

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

Use amdgpu_vm_bo_update_mapping() instead of amdgpu_vm_bo_split_mapping() here.

We don't want any flags set in the cleared areas and splitting should be unnecessary.

Yeah, the mappings in the freed list are split already, I think.

Quoted 12 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index 9017b51..27af436 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_clear_freed(struct amdgpu_device *adev, · line 1636

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -2
@@ -1631,8 +1631,9 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
              struct amdgpu_bo_va_mapping, list);
          list_del(&mapping->list);
 
-        r = amdgpu_vm_bo_split_mapping(adev, NULL, 0, NULL, vm, mapping,
-                           0, 0, &f);
+        r = amdgpu_vm_bo_update_mapping(adev, NULL, 0, NULL, vm,
+                        mapping->start, mapping->last,
+                        0, 0, &f);

We may also pass the offset for updating.

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_clear_freed(struct amdgpu_device *adev,

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -0
+        r = amdgpu_vm_bo_update_mapping(adev, NULL, 0, NULL, vm,
+                        mapping->start, mapping->last,
+                        0, mapping->offset, &f);

Checking it more, the offset is not key value for clear op, as it's invalid then regardless of the address bit inside the PTE.

So,

Quoted 11 lines

Jerry

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_clear_freed(struct amdgpu_device *adev, · line 1639

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
          amdgpu_vm_free_mapping(adev, vm, mapping, f);
          if (r) {
              fence_put(f);

_______________________________________________
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