dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/14] drm/amdgpu: fix wrong release of vmid owner
@ 2016-05-04 18:26 Alex Deucher
  2016-05-04 18:26 ` [PATCH 02/14] drm/amdgpu: add client id for every vm Alex Deucher
                   ` (13 more replies)
  0 siblings, 14 replies; 19+ messages in thread
From: Alex Deucher @ 2016-05-04 18:26 UTC (permalink / raw)
  To: dri-devel; +Cc: Alex Deucher

From: Chunming Zhou <David1.Zhou@amd.com>

The release of the vmid owner was not handled
correctly.  We need to take the lock and walk
the lru list.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 856116a..e06d066 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1454,6 +1454,7 @@ error_free_sched_entity:
 void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 {
 	struct amdgpu_bo_va_mapping *mapping, *tmp;
+	struct amdgpu_vm_id *id, *id_tmp;
 	int i;
 
 	amd_sched_entity_fini(vm->entity.sched, &vm->entity);
@@ -1478,14 +1479,17 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	amdgpu_bo_unref(&vm->page_directory);
 	fence_put(vm->page_directory_fence);
 
-	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
-		struct amdgpu_vm_id *id = vm->ids[i];
-
+	mutex_lock(&adev->vm_manager.lock);
+	list_for_each_entry_safe(id, id_tmp, &adev->vm_manager.ids_lru,
+				 list) {
 		if (!id)
 			continue;
-
-		atomic_long_cmpxchg(&id->owner, (long)vm, 0);
+		if (atomic_long_read(&id->owner) == (long)vm) {
+			atomic_long_set(&id->owner, 0);
+			id->pd_gpu_addr = 0;
+		}
 	}
+	mutex_unlock(&adev->vm_manager.lock);
 }
 
 /**
-- 
2.5.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2016-05-11  7:48 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04 18:26 [PATCH 01/14] drm/amdgpu: fix wrong release of vmid owner Alex Deucher
2016-05-04 18:26 ` [PATCH 02/14] drm/amdgpu: add client id for every vm Alex Deucher
2016-05-04 18:26 ` [PATCH 03/14] drm/amdgpu: make vmid owner be client_id Alex Deucher
2016-05-04 18:26 ` [PATCH 04/14] drm/amdgpu: keep vm in job instead of ib (v2) Alex Deucher
2016-05-04 18:26 ` [PATCH 05/14] drm/amdgpu: use fence_context to judge ctx switch Alex Deucher
2016-05-04 18:26 ` [PATCH 06/14] drm/amdgpu: add pipeline sync for compute job Alex Deucher
2016-05-04 18:26 ` [PATCH 07/14] drm/amd/amdgpu: Enable CG for UVD6 on Carrizo Alex Deucher
2016-05-04 18:26 ` [PATCH 08/14] drm/amdgpu: hdp flush&inval should always do Alex Deucher
2016-05-04 18:26 ` [PATCH 09/14] drm/amdgpu: two minor 80 char fixes Alex Deucher
2016-05-04 18:26 ` [PATCH 10/14] drm/amdgpu: make the VMID owner always 64bit Alex Deucher
2016-05-04 18:26 ` [PATCH 11/14] drm/amdgpu: remove owner cleanup v2 Alex Deucher
2016-05-04 18:26 ` [PATCH 12/14] drm/amdgpu: remove define for reserved client ID Alex Deucher
2016-05-04 18:26 ` [PATCH 13/14] drm/amd: cleanup remaining spaces and tabs v2 Alex Deucher
2016-05-04 18:26 ` [PATCH 14/14] drm/amdgpu: fetch cu_info once at init Alex Deucher
2016-05-09  8:17 ` [PATCH 01/14] drm/amdgpu: fix wrong release of vmid owner Daniel Vetter
2016-05-10  5:05   ` Dave Airlie
2016-05-10  8:21     ` Christian König
2016-05-11  7:46       ` Daniel Vetter
2016-05-11  7:48         ` Dave Airlie

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