Skip to contentSkip to conversation

drm/amdgpu: Fix potential issue if reserve function is interrupted If amdgpu_bo_reserve function is interrupted by signal, amdgpu_bo_kunmap function is not called.

PATCH In review Alex Xie 2 participants 5 messages Apr 24, 2017 – Apr 25, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Alex Xie

author
#0 lore raw

PATCH 1/4 drm/amdgpu: Fix potential issue if reserve function is interrupted If amdgpu_bo_reserve function is interrupted by signal, amdgpu_bo_kunmap function is not called.

Change-Id Ide2b3be6549b3afb8d6116094b5fff495b18addf
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index a09ad3cf..051696d 100644
@@ -350,7 +350,7 @@ static void amdgpu_vram_scratch_fini(struct amdgpu_device *adev)
 	if (adev->vram_scratch.robj == NULL) {
 		return;
 	}
-	r = amdgpu_bo_reserve(adev->vram_scratch.robj, false);
+	r = amdgpu_bo_reserve(adev->vram_scratch.robj, true);
 	if (likely(r == 0)) {
 		amdgpu_bo_kunmap(adev->vram_scratch.robj);
 		amdgpu_bo_unpin(adev->vram_scratch.robj);
Signature · 6 lines
1.9.1

_______________________________________________
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): 1493058545-9733-1-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/4 drm/amdgpu: Fix use of interruptible waiting 1. The signal interrupt can affect the expected behaviour. 2. There is no mechanism to handle the corresponding error.

Change-Id I43f3b0b420833a02ad5ece3ddeef04c6512667e9
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -3
index 051696d..4d04af9 100644
@@ -2181,7 +2181,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
 
 		if (amdgpu_crtc->cursor_bo) {
 			struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
-			r = amdgpu_bo_reserve(aobj, false);
+			r = amdgpu_bo_reserve(aobj, true);
 			if (r == 0) {
 				amdgpu_bo_unpin(aobj);
 				amdgpu_bo_unreserve(aobj);
@@ -2194,7 +2194,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
 		robj = gem_to_amdgpu_bo(rfb->obj);
 		/* don't unpin kernel fb objects */
 		if (!amdgpu_fbdev_robj_is_fb(adev, robj)) {
-			r = amdgpu_bo_reserve(robj, false);
+			r = amdgpu_bo_reserve(robj, true);
 			if (r == 0) {
 				amdgpu_bo_unpin(robj);
 				amdgpu_bo_unreserve(robj);
@@ -2301,7 +2301,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 
 		if (amdgpu_crtc->cursor_bo) {
 			struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
-			r = amdgpu_bo_reserve(aobj, false);
+			r = amdgpu_bo_reserve(aobj, true);
 			if (r == 0) {
 				r = amdgpu_bo_pin(aobj,
 						  AMDGPU_GEM_DOMAIN_VRAM,
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 3/4 drm/amdgpu: Fix use of interruptible waiting 1. The signal interrupt can affect the expected behaviour. 2. There is no good mechanism to handle the corresponding error.

In reply to a message not in the archive
Change-Id I43f3b0b420833a02ad5ece3ddeef04c6512667e9
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index 4d04af9..2ef4759 100644
@@ -2479,7 +2479,7 @@ static int amdgpu_recover_vram_from_shadow(struct amdgpu_device *adev,
        if (!bo->shadow)
                return 0;
 
-       r = amdgpu_bo_reserve(bo, false);
+       r = amdgpu_bo_reserve(bo, true);
        if (r)
                return r;
        domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#4 lore raw

PATCH 4/4 drm/amdgpu: Fix use of interruptible waiting 1. The signal interrupt can affect the expected behaviour. 2. There is no good mechanism to handle the corresponding error.

In reply to a message not in the archive
Change-Id I504cc9c280c70fa832cb64e6a1e0f8b4a1f3cbfd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
index 8f5db2d..e4a6a40 100644
@@ -295,7 +295,7 @@ void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr,
 	if (*bo == NULL)
 		return;
 
-	if (likely(amdgpu_bo_reserve(*bo, false) == 0)) {
+	if (likely(amdgpu_bo_reserve(*bo, true) == 0)) {
 		if (cpu_addr)
 			amdgpu_bo_kunmap(*bo);
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw
In reply to a message not in the archive

All commit messages got mangled into the subject line.

You probably forgot the empty line between subject and commit message while creating the commit.

With that fixed the whole series is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

Am 24.04.2017 um 20:29 schrieb Alex Xie:

Quoted 11 lines
Change-Id Ide2b3be6549b3afb8d6116094b5fff495b18addf
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index a09ad3cf..051696d 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_vram_scratch_fini(struct amdgpu_device *adev) · line 356

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -350,7 +350,7 @@ static void amdgpu_vram_scratch_fini(struct amdgpu_device *adev)
  	if (adev->vram_scratch.robj == NULL) {
  		return;
  	}
-	r = amdgpu_bo_reserve(adev->vram_scratch.robj, false);
+	r = amdgpu_bo_reserve(adev->vram_scratch.robj, true);
  	if (likely(r == 0)) {
  		amdgpu_bo_kunmap(adev->vram_scratch.robj);
  		amdgpu_bo_unpin(adev->vram_scratch.robj);

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