<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Christian König <ckoenig.leichtzumerken@gmail.com><br>
<b>Sent:</b> Friday, February 4, 2022 3:52 AM<br>
<b>To:</b> Bhardwaj, Rajneesh <Rajneesh.Bhardwaj@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> [PATCH] drm/amdgpu: move lockdep assert to the right place.</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Since newly added BOs don't have any mappings it's ok to add them<br>
without holding the VM lock. Only when we add per VM BOs the lock is<br>
mandatory.<br>
<br>
Signed-off-by: Christian König <christian.koenig@amd.com><br>
Reported-by: Bhardwaj, Rajneesh <Rajneesh.Bhardwaj@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--<br>
 1 file changed, 2 insertions(+), 2 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 fdc6a1fd74af..dcc80d6e099e 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
@@ -375,6 +375,8 @@ static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base,<br>
         if (bo->tbo.base.resv != vm->root.bo->tbo.base.resv)<br>
                 return;<br>
 <br>
+       dma_resv_assert_held(vm->root.bo->tbo.base.resv);<br>
+<br>
         vm->bulk_moveable = false;<br>
         if (bo->tbo.type == ttm_bo_type_kernel && bo->parent)<br>
                 amdgpu_vm_bo_relocated(base);<br>
@@ -2260,8 +2262,6 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,<br>
 {<br>
         struct amdgpu_bo_va *bo_va;<br>
 <br>
-       dma_resv_assert_held(vm->root.bo->tbo.base.resv);<br>
-<br>
         bo_va = kzalloc(sizeof(struct amdgpu_bo_va), GFP_KERNEL);<br>
         if (bo_va == NULL) {<br>
                 return NULL;<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>