<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 2022-03-28 9:14 a.m., Christian
König wrote:<br>
</div>
<blockquote type="cite" cite="mid:9d0cc505-0e31-12b9-6d3e-4cd1d4c54646@amd.com">Am
28.03.22 um 15:06 schrieb Philip Yang:
<br>
<blockquote type="cite">To fix two issues with unlocked update
fence:
<br>
<br>
1. vm->last_unlocked store the latest fence without taking
refcount.
<br>
2. amdgpu_vm_bo_update_mapping returns old fence, not the latest
fence.
<br>
</blockquote>
<br>
NAK, that code here is perfectly correct.
<br>
<br>
vm->last_unlocked gets a reference to the last unlocked
operation.
<br>
<br>
Otherwise the last locked operation is added directly to the root
resv object.
<br>
<br>
Regards,
<br>
Christian.
<br>
<br>
<blockquote type="cite">
<br>
Signed-off-by: Philip Yang <a class="moz-txt-link-rfc2396E" href="mailto:Philip.Yang@amd.com"><Philip.Yang@amd.com></a>
<br>
---
<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 2 +-
<br>
1 file changed, 1 insertion(+), 1 deletion(-)
<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
<br>
index dbb551762805..69fba68ff88e 100644
<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
<br>
@@ -109,7 +109,7 @@ static int amdgpu_vm_sdma_commit(struct
amdgpu_vm_update_params *p,
<br>
if (p->unlocked) {
<br>
struct dma_fence *tmp = dma_fence_get(f);
<br>
- swap(p->vm->last_unlocked, f);
<br>
+ swap(p->vm->last_unlocked, tmp);
<br>
</blockquote>
</blockquote>
<p> dma_fence_put(tmp); <br>
</p>
<p>tmp is the new unlock fence, so this drop the new fence refcount,
fix is to move the old fence to tmp, drop the old fence refcount,
take the new fence reference.</p>
<p> f is return fence, because f swap to old fence, so old fence is
returned, not new fence, fix will not change f.</p>
<p>Regards,</p>
<p>Philip<br>
</p>
<blockquote type="cite" cite="mid:9d0cc505-0e31-12b9-6d3e-4cd1d4c54646@amd.com">
<blockquote type="cite"> } else {
<br>
amdgpu_bo_fence(p->vm->root.bo, f, true);
<br>
</blockquote>
<br>
</blockquote>
</body>
</html>