<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
No, as I wrote in the comment that is not an error and should just
be ignored.<br>
<br>
Regards,<br>
Christian.<br>
<br>
<div class="moz-cite-prefix">Am 23.02.22 um 16:18 schrieb Chen,
Guchun:<br>
</div>
<blockquote type="cite"
cite="mid:DM5PR12MB24698390D11135CF1347D9ADF13C9@DM5PR12MB2469.namprd12.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<p
style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;"
align="Left">
[Public]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="MsoNormal">Shall we add a print to aware user when
failing to install a new ctx entity?<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Guchun<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> amd-gfx
<a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a>
<b>On Behalf Of </b>Deucher, Alexander<br>
<b>Sent:</b> Wednesday, February 23, 2022 11:06 PM<br>
<b>To:</b> Christian König
<a class="moz-txt-link-rfc2396E" href="mailto:ckoenig.leichtzumerken@gmail.com"><ckoenig.leichtzumerken@gmail.com></a>;
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<b>Cc:</b> Koenig, Christian
<a class="moz-txt-link-rfc2396E" href="mailto:Christian.Koenig@amd.com"><Christian.Koenig@amd.com></a>; Xue, Ken
<a class="moz-txt-link-rfc2396E" href="mailto:Ken.Xue@amd.com"><Ken.Xue@amd.com></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: install ctx
entities with cmpxchg<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:15.0pt"><span
style="font-size:10.0pt;font-family:"Arial",sans-serif;color:green">[Public]<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p style="margin:15.0pt"><span
style="font-size:10.0pt;font-family:"Arial",sans-serif;color:green">[Public]<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt;color:black">Acked-by: Alex
Deucher <<a
href="mailto:alexander.deucher@amd.com"
moz-do-not-send="true"
class="moz-txt-link-freetext">alexander.deucher@amd.com</a>><o:p></o:p></span></p>
</div>
<div class="MsoNormal" style="text-align:center"
align="center">
<hr width="98%" size="2" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span
style="color:black"> amd-gfx <<a
href="mailto:amd-gfx-bounces@lists.freedesktop.org"
moz-do-not-send="true"
class="moz-txt-link-freetext">amd-gfx-bounces@lists.freedesktop.org</a>>
on behalf of Christian König <<a
href="mailto:ckoenig.leichtzumerken@gmail.com"
moz-do-not-send="true"
class="moz-txt-link-freetext">ckoenig.leichtzumerken@gmail.com</a>><br>
<b>Sent:</b> Wednesday, February 23, 2022 8:38 AM<br>
<b>To:</b> <a
href="mailto:amd-gfx@lists.freedesktop.org"
moz-do-not-send="true"
class="moz-txt-link-freetext">amd-gfx@lists.freedesktop.org</a>
<<a href="mailto:amd-gfx@lists.freedesktop.org"
moz-do-not-send="true"
class="moz-txt-link-freetext">amd-gfx@lists.freedesktop.org</a>><br>
<b>Cc:</b> Koenig, Christian <<a
href="mailto:Christian.Koenig@amd.com"
moz-do-not-send="true"
class="moz-txt-link-freetext">Christian.Koenig@amd.com</a>>;
Xue, Ken <<a href="mailto:Ken.Xue@amd.com"
moz-do-not-send="true"
class="moz-txt-link-freetext">Ken.Xue@amd.com</a>><br>
<b>Subject:</b> [PATCH] drm/amdgpu: install ctx
entities with cmpxchg</span> <o:p>
</o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Since
we removed the context lock we need to make sure
that not two threads<br>
are trying to install an entity at the same time.<br>
<br>
Signed-off-by: Christian König <<a
href="mailto:christian.koenig@amd.com"
moz-do-not-send="true"
class="moz-txt-link-freetext">christian.koenig@amd.com</a>><br>
Fixes: e68efb27647f ("drm/amdgpu: remove
ctx->lock")<br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8
+++++++-<br>
1 file changed, 7 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c<br>
index f522b52725e4..16eb1ee600ed 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c<br>
@@ -204,9 +204,15 @@ static int
amdgpu_ctx_init_entity(struct amdgpu_ctx *ctx, u32
hw_ip,<br>
if (r)<br>
goto error_free_entity;<br>
<br>
- ctx->entities[hw_ip][ring] = entity;<br>
+ /* It's not an error if we fail to install
the new entity */<br>
+ if
(cmpxchg(&ctx->entities[hw_ip][ring], NULL,
entity))<br>
+ goto cleanup_entity;<br>
+<br>
return 0;<br>
<br>
+cleanup_entity:<br>
+
drm_sched_entity_fini(&entity->entity);<br>
+<br>
error_free_entity:<br>
kfree(entity);<br>
<br>
-- <br>
2.25.1<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>