Skip to contentSkip to conversation

drm/amdgpu: Real return value can be over-written when clean up

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

Subsystems (2)
lore
Share & tools
lore

Alex Xie

author
#0 lore raw

PATCH 1/2 drm/amdgpu: Real return value can be over-written when clean up

Change-Id Ib69f035eeb213a1aec5025e0a9f4515065706118
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +5 -4
index 3453052..76be2d2 100644
@@ -117,6 +117,11 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
 	}
 
 out_cleanup:
+	/* Check error value now. The value can be overwritten when clean up.*/
+	if (r) {
+		DRM_ERROR("Error while benchmarking BO move.\n");
+	}
+
 	if (sobj) {
 		r = amdgpu_bo_reserve(sobj, false);
 		if (likely(r == 0)) {
@@ -133,10 +138,6 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
 		}
 		amdgpu_bo_unref(&dobj);
 	}
-
-	if (r) {
-		DRM_ERROR("Error while benchmarking BO move.\n");
-	}
 }
 
 void amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
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): 1493062478-12753-1-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/2 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. When signal interrupt happens, unpin is not called. As a result, inside AMDGPU, the statistic of pin size will be wrong.

Change-Id I6889a4d9dd2703bcf5d448d18f6af51c496a93c9
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +2 -2
index 76be2d2..75bd76f 100644
@@ -123,7 +123,7 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
 	}
 
 	if (sobj) {
-		r = amdgpu_bo_reserve(sobj, false);
+		r = amdgpu_bo_reserve(sobj, true);
 		if (likely(r == 0)) {
 			amdgpu_bo_unpin(sobj);
 			amdgpu_bo_unreserve(sobj);
@@ -131,7 +131,7 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
 		amdgpu_bo_unref(&sobj);
 	}
 	if (dobj) {
-		r = amdgpu_bo_reserve(dobj, false);
+		r = amdgpu_bo_reserve(dobj, true);
 		if (likely(r == 0)) {
 			amdgpu_bo_unpin(dobj);
 			amdgpu_bo_unreserve(dobj);
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): 1493062478-12753-2-git-send-email-AlexBin.Xie-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] 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. When signal interrupt happens, unpin is not called. As a result, inside AMDGPU, the statistic of pin size will be wrong.

You somehow messed up the commit message. Everything got mangled into the subject line while sending the mails.

Apart from that the change looks good to me and with the commit message fixed is Reviewed-by: Christian König <[email protected]>

Regards,
Christian.

Am 24.04.2017 um 21:34 schrieb Alex Xie:

Quoted 20 lines
Change-Id I6889a4d9dd2703bcf5d448d18f6af51c496a93c9
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +1 -1
index 76be2d2..75bd76f 100644
@@ -123,7 +123,7 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
  	}
 
  	if (sobj) {
-		r = amdgpu_bo_reserve(sobj, false);
+		r = amdgpu_bo_reserve(sobj, true);
  		if (likely(r == 0)) {
  			amdgpu_bo_unpin(sobj);
  			amdgpu_bo_unreserve(sobj);

drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size, · line 137

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +1 -1
@@ -131,7 +131,7 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
  		amdgpu_bo_unref(&sobj);
  	}
  	if (dobj) {
-		r = amdgpu_bo_reserve(dobj, false);
+		r = amdgpu_bo_reserve(dobj, true);
  		if (likely(r == 0)) {
  			amdgpu_bo_unpin(dobj);
  			amdgpu_bo_unreserve(dobj);

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

Reviewed-by
#5 lore raw
In reply to a message not in the archive

Am 24.04.2017 um 21:34 schrieb Alex Xie:

Quoted 2 lines
Change-Id Ib69f035eeb213a1aec5025e0a9f4515065706118
Quoted 21 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +5 -0
index 3453052..76be2d2 100644
@@ -117,6 +117,11 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
  	}
 
  out_cleanup:
+	/* Check error value now. The value can be overwritten when clean up.*/
+	if (r) {
+		DRM_ERROR("Error while benchmarking BO move.\n");
+	}
+
  	if (sobj) {
  		r = amdgpu_bo_reserve(sobj, false);
  		if (likely(r == 0)) {

drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size, · line 143

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +0 -4
@@ -133,10 +138,6 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
  		}
  		amdgpu_bo_unref(&dobj);
  	}
-
-	if (r) {
-		DRM_ERROR("Error while benchmarking BO move.\n");
-	}
  }
 
  void amdgpu_benchmark(struct amdgpu_device *adev, int test_number)

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