diff options
author | Christian König <christian.koenig@amd.com> | 2017-09-01 08:46:19 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-09-01 12:50:35 -0400 |
commit | 481c2e94897eb74abcfb4a3cdb87f5f89499b93f (patch) | |
tree | 9e61f509f721c64d066d567803958d16a5461a42 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | f5830465967799de0334340d1888f7d2c0bc17f5 (diff) |
drm/amdgpu: fix moved list handling in the VM
Only move BOs to the moved/relocated list when they aren't already on a list.
This prevents accidential removal from the evicted list.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index b83e0fa1f269..c9223a5184de 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1178,7 +1178,8 @@ static void amdgpu_vm_invalidate_level(struct amdgpu_vm *vm, | |||
1178 | 1178 | ||
1179 | entry->addr = ~0ULL; | 1179 | entry->addr = ~0ULL; |
1180 | spin_lock(&vm->status_lock); | 1180 | spin_lock(&vm->status_lock); |
1181 | list_move(&entry->base.vm_status, &vm->relocated); | 1181 | if (list_empty(&entry->base.vm_status)) |
1182 | list_add(&entry->base.vm_status, &vm->relocated); | ||
1182 | spin_unlock(&vm->status_lock); | 1183 | spin_unlock(&vm->status_lock); |
1183 | amdgpu_vm_invalidate_level(vm, entry); | 1184 | amdgpu_vm_invalidate_level(vm, entry); |
1184 | } | 1185 | } |
@@ -2091,7 +2092,8 @@ static void amdgpu_vm_bo_insert_map(struct amdgpu_device *adev, | |||
2091 | 2092 | ||
2092 | if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) { | 2093 | if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) { |
2093 | spin_lock(&vm->status_lock); | 2094 | spin_lock(&vm->status_lock); |
2094 | list_move(&bo_va->base.vm_status, &vm->moved); | 2095 | if (list_empty(&bo_va->base.vm_status)) |
2096 | list_add(&bo_va->base.vm_status, &vm->moved); | ||
2095 | spin_unlock(&vm->status_lock); | 2097 | spin_unlock(&vm->status_lock); |
2096 | } | 2098 | } |
2097 | trace_amdgpu_vm_bo_map(bo_va, mapping); | 2099 | trace_amdgpu_vm_bo_map(bo_va, mapping); |
@@ -2446,7 +2448,8 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev, | |||
2446 | } | 2448 | } |
2447 | 2449 | ||
2448 | spin_lock(&bo_base->vm->status_lock); | 2450 | spin_lock(&bo_base->vm->status_lock); |
2449 | list_move(&bo_base->vm_status, &bo_base->vm->moved); | 2451 | if (list_empty(&bo_base->vm_status)) |
2452 | list_add(&bo_base->vm_status, &vm->moved); | ||
2450 | spin_unlock(&bo_base->vm->status_lock); | 2453 | spin_unlock(&bo_base->vm->status_lock); |
2451 | } | 2454 | } |
2452 | } | 2455 | } |