Skip to contentSkip to conversation

drm/amdgpu: clean up bo in vce and vcn test

PATCH Superseded Nirmoy Das 4 participants 7 messages Dec 8, 2020 – Dec 18, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/1 drm/amdgpu: clean up bo in vce and vcn test

BO created with amdgpu_bo_create_reserved wasn't clean properly before which causes:

[   21.056218] WARNING: CPU: 0 PID: 7 at drivers/gpu/drm/ttm/ttm_bo.c:518 ttm_bo_release+0x2bf/0x310 [ttm]
<snip>
[   21.056430] Call Trace:
[   21.056525]  amdgpu_bo_unref+0x1a/0x30 [amdgpu]
[   21.056635]  amdgpu_vcn_dec_send_msg+0x1b2/0x270 [amdgpu]
[   21.056740]  amdgpu_vcn_dec_get_create_msg.constprop.0+0xd8/0x100 [amdgpu]
[   21.056843]  amdgpu_vcn_dec_ring_test_ib+0x27/0x180 [amdgpu]
[   21.056936]  amdgpu_ib_ring_tests+0xf1/0x150 [amdgpu]
[   21.057024]  amdgpu_device_delayed_init_work_handler+0x11/0x30 [amdgpu]
[   21.057030]  process_one_work+0x1df/0x370
[   21.057033]  worker_thread+0x46/0x340
[   21.057034]  ? process_one_work+0x370/0x370
[   21.057037]  kthread+0x11b/0x140
[   21.057039]  ? __kthread_bind_mask+0x60/0x60
[   21.057043]  ret_from_fork+0x22/0x30
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 16 ++++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index ecaa2d7483b2..78a4dd9bf11f 100644
@@ -1151,6 +1151,6 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 error:
 	dma_fence_put(fence);
 	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, NULL);
 	return r;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +10 -6
index 7e19a6656715..dfcdd38ff9c2 100644
@@ -491,8 +491,6 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
 		goto err_free;
 
 	amdgpu_bo_fence(bo, f, false);
-	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
 
 	if (fence)
 		*fence = dma_fence_get(f);
@@ -504,8 +502,6 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
 	amdgpu_job_free(job);
 
 err:
-	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
 	return r;
 }
 
@@ -540,7 +536,11 @@ static int amdgpu_vcn_dec_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
 	for (i = 14; i < 1024; ++i)
 		msg[i] = cpu_to_le32(0x0);
 
-	return amdgpu_vcn_dec_send_msg(ring, bo, fence);
+	r = amdgpu_vcn_dec_send_msg(ring, bo, fence);
+	amdgpu_bo_unreserve(bo);
+	amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
+
+	return r;
 }
 
 static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
@@ -566,7 +566,11 @@ static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
 	for (i = 6; i < 1024; ++i)
 		msg[i] = cpu_to_le32(0x0);
 
-	return amdgpu_vcn_dec_send_msg(ring, bo, fence);
+	r = amdgpu_vcn_dec_send_msg(ring, bo, fence);
+	amdgpu_bo_unreserve(bo);
+	amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
+
+	return r;
 }
 
 int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout)
Signature · 6 lines
2.29.2

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

Am 08.12.20 um 16:55 schrieb Nirmoy Das:

Quoted 2 lines

BO created with amdgpu_bo_create_reserved wasn't clean properly before which causes:

I would rather like to keep the code as it is and just replace the amdgpu_bo_unref() with amdgpu_bo_free_kernel().

But apart from that I think we can stick with this.

Christian.

Quoted 73 lines
[   21.056218] WARNING: CPU: 0 PID: 7 at drivers/gpu/drm/ttm/ttm_bo.c:518 ttm_bo_release+0x2bf/0x310 [ttm]
<snip>
[   21.056430] Call Trace:
[   21.056525]  amdgpu_bo_unref+0x1a/0x30 [amdgpu]
[   21.056635]  amdgpu_vcn_dec_send_msg+0x1b2/0x270 [amdgpu]
[   21.056740]  amdgpu_vcn_dec_get_create_msg.constprop.0+0xd8/0x100 [amdgpu]
[   21.056843]  amdgpu_vcn_dec_ring_test_ib+0x27/0x180 [amdgpu]
[   21.056936]  amdgpu_ib_ring_tests+0xf1/0x150 [amdgpu]
[   21.057024]  amdgpu_device_delayed_init_work_handler+0x11/0x30 [amdgpu]
[   21.057030]  process_one_work+0x1df/0x370
[   21.057033]  worker_thread+0x46/0x340
[   21.057034]  ? process_one_work+0x370/0x370
[   21.057037]  kthread+0x11b/0x140
[   21.057039]  ? __kthread_bind_mask+0x60/0x60
[   21.057043]  ret_from_fork+0x22/0x30
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 16 ++++++++++------
  2 files changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index ecaa2d7483b2..78a4dd9bf11f 100644
@@ -1151,6 +1151,6 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout)
  error:
  	dma_fence_put(fence);
  	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, NULL);
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +5 -5
index 7e19a6656715..dfcdd38ff9c2 100644
@@ -491,8 +491,6 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
  		goto err_free;
 
  	amdgpu_bo_fence(bo, f, false);
-	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
 
  	if (fence)
  		*fence = dma_fence_get(f);
@@ -504,8 +502,6 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
  	amdgpu_job_free(job);
 
  err:
-	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
  	return r;
  }
 
@@ -540,7 +536,11 @@ static int amdgpu_vcn_dec_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
  	for (i = 14; i < 1024; ++i)
  		msg[i] = cpu_to_le32(0x0);
 
-	return amdgpu_vcn_dec_send_msg(ring, bo, fence);
+	r = amdgpu_vcn_dec_send_msg(ring, bo, fence);
+	amdgpu_bo_unreserve(bo);
+	amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
+
+	return r;
  }
 
  static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
@@ -566,7 +566,11 @@ static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
  	for (i = 6; i < 1024; ++i)
  		msg[i] = cpu_to_le32(0x0);

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han · line 576

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +5 -1
 
-	return amdgpu_vcn_dec_send_msg(ring, bo, fence);
+	r = amdgpu_vcn_dec_send_msg(ring, bo, fence);
+	amdgpu_bo_unreserve(bo);
+	amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
+
+	return r;
  }
 
  int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout)

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

author
#2 lore raw

PATCH v2 1/1 drm/amdgpu: clean up bo in vce and vcn test

BO created with amdgpu_bo_create_reserved() wasn't clean properly before, which causes:

[   21.056218] WARNING: CPU: 0 PID: 7 at drivers/gpu/drm/ttm/ttm_bo.c:518 ttm_bo_release+0x2bf/0x310 [ttm]
<snip>
[   21.056430] Call Trace:
[   21.056525]  amdgpu_bo_unref+0x1a/0x30 [amdgpu]
[   21.056635]  amdgpu_vcn_dec_send_msg+0x1b2/0x270 [amdgpu]
[   21.056740]  amdgpu_vcn_dec_get_create_msg.constprop.0+0xd8/0x100 [amdgpu]
[   21.056843]  amdgpu_vcn_dec_ring_test_ib+0x27/0x180 [amdgpu]
[   21.056936]  amdgpu_ib_ring_tests+0xf1/0x150 [amdgpu]
[   21.057024]  amdgpu_device_delayed_init_work_handler+0x11/0x30 [amdgpu]
[   21.057030]  process_one_work+0x1df/0x370
[   21.057033]  worker_thread+0x46/0x340
[   21.057034]  ? process_one_work+0x370/0x370
[   21.057037]  kthread+0x11b/0x140
[   21.057039]  ? __kthread_bind_mask+0x60/0x60
[   21.057043]  ret_from_fork+0x22/0x30
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index ecaa2d7483b2..78a4dd9bf11f 100644
@@ -1151,6 +1151,6 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 error:
 	dma_fence_put(fence);
 	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, NULL);
 	return r;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +6 -3
index 7e19a6656715..921b81054c1b 100644
@@ -465,6 +465,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
 	struct amdgpu_job *job;
 	struct amdgpu_ib *ib;
 	uint64_t addr;
+	void *msg = NULL;
 	int i, r;
 
 	r = amdgpu_job_alloc_with_ib(adev, 64,
@@ -474,6 +475,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
 
 	ib = &job->ibs[0];
 	addr = amdgpu_bo_gpu_offset(bo);
+	msg = amdgpu_bo_kptr(bo);
 	ib->ptr[0] = PACKET0(adev->vcn.internal.data0, 0);
 	ib->ptr[1] = addr;
 	ib->ptr[2] = PACKET0(adev->vcn.internal.data1, 0);
@@ -492,7 +494,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
 
 	amdgpu_bo_fence(bo, f, false);
 	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
 
 	if (fence)
 		*fence = dma_fence_get(f);
@@ -505,7 +507,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
 
 err:
 	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
 	return r;
 }
 
@@ -761,6 +763,7 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 error:
 	dma_fence_put(fence);
 	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, NULL);
+
 	return r;
 }
Signature · 6 lines
2.29.2

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

Am 08.12.20 um 19:59 schrieb Nirmoy Das:

Quoted 19 lines

BO created with amdgpu_bo_create_reserved() wasn't clean properly before, which causes:

[   21.056218] WARNING: CPU: 0 PID: 7 at drivers/gpu/drm/ttm/ttm_bo.c:518 ttm_bo_release+0x2bf/0x310 [ttm]
<snip>
[   21.056430] Call Trace:
[   21.056525]  amdgpu_bo_unref+0x1a/0x30 [amdgpu]
[   21.056635]  amdgpu_vcn_dec_send_msg+0x1b2/0x270 [amdgpu]
[   21.056740]  amdgpu_vcn_dec_get_create_msg.constprop.0+0xd8/0x100 [amdgpu]
[   21.056843]  amdgpu_vcn_dec_ring_test_ib+0x27/0x180 [amdgpu]
[   21.056936]  amdgpu_ib_ring_tests+0xf1/0x150 [amdgpu]
[   21.057024]  amdgpu_device_delayed_init_work_handler+0x11/0x30 [amdgpu]
[   21.057030]  process_one_work+0x1df/0x370
[   21.057033]  worker_thread+0x46/0x340
[   21.057034]  ? process_one_work+0x370/0x370
[   21.057037]  kthread+0x11b/0x140
[   21.057039]  ? __kthread_bind_mask+0x60/0x60
[   21.057043]  ret_from_fork+0x22/0x30
Quoted 1 line

At some point we should probably switch to using an SA BO and stop this mess here.

But for now the patch is Reviewed-by: Christian König <[email protected]>

Quoted 56 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 9 ++++++---
  2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +1 -1
index ecaa2d7483b2..78a4dd9bf11f 100644
@@ -1151,6 +1151,6 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout)
  error:
  	dma_fence_put(fence);
  	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, NULL);
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -2
index 7e19a6656715..921b81054c1b 100644
@@ -465,6 +465,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
  	struct amdgpu_job *job;
  	struct amdgpu_ib *ib;
  	uint64_t addr;
+	void *msg = NULL;
  	int i, r;
 
  	r = amdgpu_job_alloc_with_ib(adev, 64,
@@ -474,6 +475,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
 
  	ib = &job->ibs[0];
  	addr = amdgpu_bo_gpu_offset(bo);
+	msg = amdgpu_bo_kptr(bo);
  	ib->ptr[0] = PACKET0(adev->vcn.internal.data0, 0);
  	ib->ptr[1] = addr;
  	ib->ptr[2] = PACKET0(adev->vcn.internal.data1, 0);
@@ -492,7 +494,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
 
  	amdgpu_bo_fence(bo, f, false);
  	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
 
  	if (fence)
  		*fence = dma_fence_get(f);
@@ -505,7 +507,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
 
  err:
  	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
  	return r;
  }
 

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) · line 769

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -1
@@ -761,6 +763,7 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
  error:
  	dma_fence_put(fence);
  	amdgpu_bo_unreserve(bo);
-	amdgpu_bo_unref(&bo);
+	amdgpu_bo_free_kernel(&bo, NULL, NULL);
+
  	return r;
  }

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

#4 lore raw
Quoted 20 lines · Christian König

Am 08.12.20 um 19:59 schrieb Nirmoy Das:

Quoted 19 lines

BO created with amdgpu_bo_create_reserved() wasn't clean properly before, which causes:

[   21.056218] WARNING: CPU: 0 PID: 7 at drivers/gpu/drm/ttm/ttm_bo.c:518 ttm_bo_release+0x2bf/0x310 [ttm] <snip>
[   21.056430] Call Trace:
[   21.056525]  amdgpu_bo_unref+0x1a/0x30 [amdgpu]
[   21.056635]  amdgpu_vcn_dec_send_msg+0x1b2/0x270 [amdgpu]
[   21.056740] amdgpu_vcn_dec_get_create_msg.constprop.0+0xd8/0x100 [amdgpu]
[   21.056843]  amdgpu_vcn_dec_ring_test_ib+0x27/0x180 [amdgpu]
[   21.056936]  amdgpu_ib_ring_tests+0xf1/0x150 [amdgpu]
[   21.057024] amdgpu_device_delayed_init_work_handler+0x11/0x30 [amdgpu]
[   21.057030]  process_one_work+0x1df/0x370
[   21.057033]  worker_thread+0x46/0x340
[   21.057034]  ? process_one_work+0x370/0x370
[   21.057037]  kthread+0x11b/0x140
[   21.057039]  ? __kthread_bind_mask+0x60/0x60
[   21.057043]  ret_from_fork+0x22/0x30

Quoted 3 lines
Quoted 1 line

At some point we should probably switch to using an SA BO and stop this mess here.

I will look into this.

Quoted 2 lines

But for now the patch is Reviewed-by: Christian König <[email protected]>

Thanks,

Nirmoy

Quoted 56 lines
Quoted 56 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 9 ++++++---

  2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +0 -0
index ecaa2d7483b2..78a4dd9bf11f 100644
@@ -1151,6 +1151,6 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring 
 *ring, long timeout)

  error:
      dma_fence_put(fence);
      amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, NULL);
      return r;
  }

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -1
index 7e19a6656715..921b81054c1b 100644
@@ -465,6 +465,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,
       struct amdgpu_job *job;
       struct amdgpu_ib *ib;
       uint64_t addr;
+    void *msg = NULL;
       int i, r;
         r = amdgpu_job_alloc_with_ib(adev, 64,
@@ -474,6 +475,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,
         ib = &job->ibs[0];
       addr = amdgpu_bo_gpu_offset(bo);
+    msg = amdgpu_bo_kptr(bo);
       ib->ptr[0] = PACKET0(adev->vcn.internal.data0, 0);
       ib->ptr[1] = addr;
       ib->ptr[2] = PACKET0(adev->vcn.internal.data1, 0);
@@ -492,7 +494,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,
         amdgpu_bo_fence(bo, f, false);
       amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
         if (fence)
           *fence = dma_fence_get(f);
@@ -505,7 +507,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,

    err:
      amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
      return r;
  }
  @@ -761,6 +763,7 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)

Quoted 9 lines
Quoted 8 lines

  error:
      dma_fence_put(fence);
      amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, NULL);
+
      return r;
  }

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

#5 lore raw

Am 08.12.20 um 20:39 schrieb Nirmoy:

Quoted 22 lines · Christian König
Quoted 20 lines

Am 08.12.20 um 19:59 schrieb Nirmoy Das:

Quoted 19 lines

BO created with amdgpu_bo_create_reserved() wasn't clean properly before, which causes:

[   21.056218] WARNING: CPU: 0 PID: 7 at drivers/gpu/drm/ttm/ttm_bo.c:518 ttm_bo_release+0x2bf/0x310 [ttm] <snip>
[   21.056430] Call Trace:
[   21.056525]  amdgpu_bo_unref+0x1a/0x30 [amdgpu]
[   21.056635]  amdgpu_vcn_dec_send_msg+0x1b2/0x270 [amdgpu]
[   21.056740] amdgpu_vcn_dec_get_create_msg.constprop.0+0xd8/0x100 [amdgpu]
[   21.056843]  amdgpu_vcn_dec_ring_test_ib+0x27/0x180 [amdgpu]
[   21.056936]  amdgpu_ib_ring_tests+0xf1/0x150 [amdgpu]
[   21.057024] amdgpu_device_delayed_init_work_handler+0x11/0x30 [amdgpu]
[   21.057030]  process_one_work+0x1df/0x370
[   21.057033]  worker_thread+0x46/0x340
[   21.057034]  ? process_one_work+0x370/0x370
[   21.057037]  kthread+0x11b/0x140
[   21.057039]  ? __kthread_bind_mask+0x60/0x60
[   21.057043]  ret_from_fork+0x22/0x30

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

At some point we should probably switch to using an SA BO and stop this mess here.

I will look into this.

Please leave me a note when you can do this since we stumbled into problems with that.

Thanks,
Christian.

Quoted 71 lines
Quoted 1 line

But for now the patch is Reviewed-by: Christian König <[email protected]>

Thanks,

Nirmoy

Quoted 56 lines
Quoted 56 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 9 ++++++---

  2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +0 -0
index ecaa2d7483b2..78a4dd9bf11f 100644
@@ -1151,6 +1151,6 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring 
 *ring, long timeout)

  error:
      dma_fence_put(fence);
      amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, NULL);
      return r;
  }

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -1
index 7e19a6656715..921b81054c1b 100644
@@ -465,6 +465,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,
       struct amdgpu_job *job;
       struct amdgpu_ib *ib;
       uint64_t addr;
+    void *msg = NULL;
       int i, r;
         r = amdgpu_job_alloc_with_ib(adev, 64,
@@ -474,6 +475,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,
         ib = &job->ibs[0];
       addr = amdgpu_bo_gpu_offset(bo);
+    msg = amdgpu_bo_kptr(bo);
       ib->ptr[0] = PACKET0(adev->vcn.internal.data0, 0);
       ib->ptr[1] = addr;
       ib->ptr[2] = PACKET0(adev->vcn.internal.data1, 0);
@@ -492,7 +494,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,
         amdgpu_bo_fence(bo, f, false);
       amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
         if (fence)
           *fence = dma_fence_get(f);
@@ -505,7 +507,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,

    err:
      amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
      return r;
  }
  @@ -761,6 +763,7 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)

Quoted 9 lines
Quoted 8 lines

  error:
      dma_fence_put(fence);
      amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, NULL);
+
      return r;
  }

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

#6 lore raw

Hi Christian,

Quoted 23 lines · Christian König

Am 08.12.20 um 20:39 schrieb Nirmoy:

Quoted 22 lines · Christian König
Quoted 20 lines

Am 08.12.20 um 19:59 schrieb Nirmoy Das:

Quoted 19 lines

BO created with amdgpu_bo_create_reserved() wasn't clean properly before, which causes:

[   21.056218] WARNING: CPU: 0 PID: 7 at drivers/gpu/drm/ttm/ttm_bo.c:518 ttm_bo_release+0x2bf/0x310 [ttm] <snip>
[   21.056430] Call Trace:
[   21.056525]  amdgpu_bo_unref+0x1a/0x30 [amdgpu]
[   21.056635]  amdgpu_vcn_dec_send_msg+0x1b2/0x270 [amdgpu]
[   21.056740] amdgpu_vcn_dec_get_create_msg.constprop.0+0xd8/0x100 [amdgpu]
[   21.056843]  amdgpu_vcn_dec_ring_test_ib+0x27/0x180 [amdgpu]
[   21.056936]  amdgpu_ib_ring_tests+0xf1/0x150 [amdgpu]
[   21.057024] amdgpu_device_delayed_init_work_handler+0x11/0x30 [amdgpu]
[   21.057030]  process_one_work+0x1df/0x370
[   21.057033]  worker_thread+0x46/0x340
[   21.057034]  ? process_one_work+0x370/0x370
[   21.057037]  kthread+0x11b/0x140
[   21.057039]  ? __kthread_bind_mask+0x60/0x60
[   21.057043]  ret_from_fork+0x22/0x30

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

At some point we should probably switch to using an SA BO and stop this mess here.

I will look into this.

Please leave me a note when you can do this since we stumbled into problems with that.

I should have a patch ready by today.

Regards,

Nirmoy

Quoted 81 lines

Thanks,
Christian.

Quoted 76 lines
Quoted 1 line

But for now the patch is Reviewed-by: Christian König <[email protected]>

Thanks,

Nirmoy

Quoted 56 lines
Quoted 56 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 9 ++++++---

  2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +0 -0
index ecaa2d7483b2..78a4dd9bf11f 100644
@@ -1151,6 +1151,6 @@ int amdgpu_vce_ring_test_ib(struct 
 amdgpu_ring *ring, long timeout)

  error:
      dma_fence_put(fence);
      amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, NULL);
      return r;
  }

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -1
index 7e19a6656715..921b81054c1b 100644
@@ -465,6 +465,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,
       struct amdgpu_job *job;
       struct amdgpu_ib *ib;
       uint64_t addr;
+    void *msg = NULL;
       int i, r;
         r = amdgpu_job_alloc_with_ib(adev, 64,
@@ -474,6 +475,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,
         ib = &job->ibs[0];
       addr = amdgpu_bo_gpu_offset(bo);
+    msg = amdgpu_bo_kptr(bo);
       ib->ptr[0] = PACKET0(adev->vcn.internal.data0, 0);
       ib->ptr[1] = addr;
       ib->ptr[2] = PACKET0(adev->vcn.internal.data1, 0);
@@ -492,7 +494,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,
         amdgpu_bo_fence(bo, f, false);
       amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
         if (fence)
           *fence = dma_fence_get(f);
@@ -505,7 +507,7 @@ static int amdgpu_vcn_dec_send_msg(struct 
 amdgpu_ring *ring,

    err:
      amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg);
      return r;
  }
  @@ -761,6 +763,7 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)

Quoted 9 lines
Quoted 8 lines

  error:
      dma_fence_put(fence);
      amdgpu_bo_unreserve(bo);
-    amdgpu_bo_unref(&bo);
+    amdgpu_bo_free_kernel(&bo, NULL, NULL);
+
      return r;
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CNirmoy.Das%40amd.com%7Ce0c007c753584ec9271f08d8a2978c2c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637438119068272629%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=3wAWBMd5vHn2UoEBdhtO6CvlI0hrdg7HsFnqAbg3Jng%3D&amp;reserved=0

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