<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div>
<div>
<div dir="ltr">
<div dir="ltr">Yes it helps avoid the unbalanced lock messages seen during criu restore failures for events. Looks good to me.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Reviewed-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com></div>
</div>
</div>
<div id="ms-outlook-mobile-signature">
<div><br>
</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
Regards,</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
Rajneesh</div>
</div>
</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 Felix Kuehling <Felix.Kuehling@amd.com><br>
<b>Sent:</b> Thursday, November 3, 2022 7:13:09 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> [PATCH] drm/amdkfd: Fix error handling in kfd_criu_restore_events</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">mutex_unlock before the exit label because all the error code paths that<br>
jump there didn't take that lock. This fixes unbalanced locking errors<br>
in case of restore errors.<br>
<br>
Fixes: 40e8a766a761 ("drm/amdkfd: CRIU checkpoint and restore events")<br>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdkfd/kfd_events.c | 3 +--<br>
 1 file changed, 1 insertion(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c<br>
index 83e3ce9f6049..729d26d648af 100644<br>
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c<br>
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c<br>
@@ -506,6 +506,7 @@ int kfd_criu_restore_event(struct file *devkfd,<br>
                 ret = create_other_event(p, ev, &ev_priv->event_id);<br>
                 break;<br>
         }<br>
+       mutex_unlock(&p->event_mutex);<br>
 <br>
 exit:<br>
         if (ret)<br>
@@ -513,8 +514,6 @@ int kfd_criu_restore_event(struct file *devkfd,<br>
 <br>
         kfree(ev_priv);<br>
 <br>
-       mutex_unlock(&p->event_mutex);<br>
-<br>
         return ret;<br>
 }<br>
 <br>
-- <br>
2.32.0<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>