<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>What will the situation result in?<br>
Before step3, the step2 must have completed. step4 is expected from step3.<br>
<br>
Regards,<br>
David Zhou<br>
<br>
Sent from my Huawei Mobile<br>
<br>
-------- 原始邮件 --------<br>
主题:[PATCH 1/3] drm/amdgpu: use one client id per ring again<br>
发件人:Christian K鰊ig <br>
收件人:amd-gfx@lists.freedesktop.org<br>
抄送:<br>
<br>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">From: Christian König <christian.koenig@amd.com><br>
<br>
Otherwise we can run into the following situation:<br>
<br>
1. Process A grabs ID 1 for ring 0.<br>
2. Process B grabs ID 1 for ring 0.<br>
3. Process A grabs ID 1 for ring 1.<br>
4. Process A tries to reuse ID1 for ring 0 but things he doesn't need to flush.<br>
<br>
Signed-off-by: Christian König <christian.koenig@amd.com><br>
Cc: stable@vger.kernel.org<br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 ++++---<br>
1 file changed, 4 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
index f8615a4..7ac79d2 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
@@ -256,7 +256,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,<br>
if (amdgpu_vm_is_gpu_reset(adev, id))<br>
continue;<br>
<br>
- if (atomic64_read(&id->owner) != vm->client_id)<br>
+ if (atomic64_read(&id->owner) != (vm->client_id + i))<br>
continue;<br>
<br>
if (job->vm_pd_addr != id->pd_gpu_addr)<br>
@@ -310,7 +310,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,<br>
id->pd_gpu_addr = job->vm_pd_addr;<br>
id->current_gpu_reset_count = atomic_read(&adev->gpu_reset_counter);<br>
list_move_tail(&id->list, &adev->vm_manager.ids_lru);<br>
- atomic64_set(&id->owner, vm->client_id);<br>
+ atomic64_set(&id->owner, vm->client_id + ring->idx);<br>
vm->ids[ring->idx] = id;<br>
<br>
job->vm_id = id - adev->vm_manager.ids;<br>
@@ -1496,7 +1496,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)<br>
for (i = 0; i < AMDGPU_MAX_RINGS; ++i)<br>
vm->ids[i] = NULL;<br>
vm->va = RB_ROOT;<br>
- vm->client_id = atomic64_inc_return(&adev->vm_manager.client_counter);<br>
+ vm->client_id = atomic64_add_return(AMDGPU_MAX_RINGS,<br>
+ &adev->vm_manager.client_counter);<br>
spin_lock_init(&vm->status_lock);<br>
INIT_LIST_HEAD(&vm->invalidated);<br>
INIT_LIST_HEAD(&vm->cleared);<br>
-- <br>
2.5.0<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font>
</body>
</html>