AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm//amdgpu: Add job fence to resv conditionally
@ 2020-03-13 11:53 xinhui pan
  2020-03-13 11:53 ` [PATCH 2/2] drm/amdgpu: unref the bo after job submit xinhui pan
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: xinhui pan @ 2020-03-13 11:53 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, Felix Kuehling, xinhui pan, Christian König

If a job need sync the bo resv, it is likely that bo need the job fence
to sync with others.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h      | 5 +++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index b5705fcfc935..ca6021b4200b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -226,6 +226,11 @@ struct amdgpu_vm_update_params {
 	 * @num_dw_left: number of dw left for the IB
 	 */
 	unsigned int num_dw_left;
+
+	/**
+	 * @resv: sync the resv and add job fence to it conditionally.
+	 */
+	struct dma_resv *resv;
 };
 
 struct amdgpu_vm_update_funcs {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
index 4cc7881f438c..0cfac59bff36 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
@@ -70,6 +70,8 @@ static int amdgpu_vm_sdma_prepare(struct amdgpu_vm_update_params *p,
 
 	p->num_dw_left = ndw;
 
+	p->resv = resv;
+
 	if (!resv)
 		return 0;
 
@@ -111,6 +113,13 @@ static int amdgpu_vm_sdma_commit(struct amdgpu_vm_update_params *p,
 		swap(p->vm->last_delayed, tmp);
 	dma_fence_put(tmp);
 
+	/* add job fence to resv.
+	 * MM notifier path is an exception as we can not grab the
+	 * resv lock.
+	 */
+	if (!p->direct && p->resv)
+		dma_resv_add_shared_fence(p->resv, f);
+
 	if (fence && !p->direct)
 		swap(*fence, f);
 	dma_fence_put(f);
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH 0/2] fix gmc page fault on navi1X
@ 2020-03-13  7:43 xinhui pan
  2020-03-13  7:43 ` [PATCH 2/2] drm/amdgpu: unref the bo after job submit xinhui pan
  0 siblings, 1 reply; 9+ messages in thread
From: xinhui pan @ 2020-03-13  7:43 UTC (permalink / raw)
  To: amd-gfx; +Cc: xinhui pan

We hit gmc page fault on navi1X.
UMR tells that the physical address of pte is bad.
Two issues:
1) we did not sync job schedule fence while update mapping.
we sync resv, but the last fence is not there. So any wait on the resv
finished before job completed. say, bo has been released while job
running.
2) we might unref page table bo during update ptes, at the same time, there
is job pending on bo. and submit a job in commit after free bo.
We need free the bo after adding all fence to bo.

xinhui pan (2):
  drm//amdgpu: Always sync fence before unlock eviction_lock
  drm/amdgpu: unref the bo after job submit

 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 46 +++++++++++++++++++-------
 1 file changed, 34 insertions(+), 12 deletions(-)

-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-03-13 13:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-13 11:53 [PATCH 1/2] drm//amdgpu: Add job fence to resv conditionally xinhui pan
2020-03-13 11:53 ` [PATCH 2/2] drm/amdgpu: unref the bo after job submit xinhui pan
2020-03-13 12:20 ` [PATCH 1/2] drm//amdgpu: Add job fence to resv conditionally Pan, Xinhui
2020-03-13 13:34 ` Christian König
2020-03-13 13:43   ` Pan, Xinhui
2020-03-13 13:46     ` Christian König
2020-03-13 13:52       ` Pan, Xinhui
2020-03-13 13:43   ` Pan, Xinhui
  -- strict thread matches above, loose matches on Subject: below --
2020-03-13  7:43 [PATCH 0/2] fix gmc page fault on navi1X xinhui pan
2020-03-13  7:43 ` [PATCH 2/2] drm/amdgpu: unref the bo after job submit xinhui pan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox