<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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:Aptos;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Consolas",serif;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Arial",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
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]-->
</head>
<body lang="EN-US" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<p style="font-family:Calibri;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - AMD Internal Distribution Only]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Koenig, Christian <Christian.Koenig@amd.com>
<br>
<b>Sent:</b> Wednesday, March 12, 2025 4:39 PM<br>
<b>To:</b> Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Kim, Jonathan <Jonathan.Kim@amd.com>; Zhu, Jiadong <Jiadong.Zhu@amd.com><br>
<b>Subject:</b> Re: [PATCH 1/7] drm/amd/amdgpu: Simplify SDMA reset mechanism by removing dynamic callbacks<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Am 12.03.25 um 09:15 schrieb Zhang, Jesse(Jie):<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">[SNIP9 <o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>-<o:p></o:p></pre>
<pre>+ gfx_ring->funcs->stop_queue(adev, instance_id);<o:p></o:p></pre>
</blockquote>
<pre><o:p> </o:p></pre>
<pre>Yeah that starts to look good. Question here is who is calling amdgpu_sdma_reset_engine()?<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>If this call comes from engine specific code we might not need the start/stop_queue callbacks all together.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre> Kfd and sdma v4/v5/v5_2 will call amdgpu_sdma_reset_engine, and start/stop_queue callbacks are only implemented in sdmav4/sdmav5/sdma5_2.<o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><br>
Why would the KFD call this as well? Because it detects an issue with a SDMA user queue If yes I would rather suggest that the KFD calls the reset function of the paging queue.<br>
<br>
Since this reset function is specific to the SDMA HW generation anyway you don't need those extra functions to abstract starting and stopping of the queue for each HW generation.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">kfd can't call reset function directly, unless we add a parameter src to distinguish kfd and kgd in reset function, like this:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">int (*reset)(struct amdgpu_ring *ring, unsigned int vmid,
<b><i>int src</i></b> );<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">As Alex said in another thread,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">We need to distinguish kfd and kgd in reset.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">If kfd triggers a reset, kgd must save healthy jobs and recover jobs after reset.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">If kgd triggers a reset, kgd must abandon bad jobs after reset.(and perhaps kfd needs to save its healthy jobs for recovery).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">If we can add a parameter, I am ok for that solution too.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">Additionally:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">For sdma6/7, when a queue reset fails, we may need to fall back to an engine reset for a attempt.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">Thanks<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif">Jesse<o:p></o:p></span></p>
<p class="MsoNormal"><br>
Regards,<br>
Christian.<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Thanks<o:p></o:p></pre>
<pre>Jesse<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Regards,<o:p></o:p></pre>
<pre>Christian.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre> /* Perform the SDMA reset for the specified instance */<o:p></o:p></pre>
<pre> ret = amdgpu_dpm_reset_sdma(adev, 1 << instance_id);<o:p></o:p></pre>
<pre> if (ret) {<o:p></o:p></pre>
<pre>@@ -591,18 +573,7 @@ int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id, b<o:p></o:p></pre>
<pre> goto exit;<o:p></o:p></pre>
<pre> }<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>- /* Invoke all registered post_reset callbacks */<o:p></o:p></pre>
<pre>- list_for_each_entry(funcs, &adev->sdma.reset_callback_list, list) {<o:p></o:p></pre>
<pre>- if (funcs->post_reset) {<o:p></o:p></pre>
<pre>- ret = funcs->post_reset(adev, instance_id);<o:p></o:p></pre>
<pre>- if (ret) {<o:p></o:p></pre>
<pre>- dev_err(adev->dev,<o:p></o:p></pre>
<pre>- "afterReset callback failed for instance %u: %d\n",<o:p></o:p></pre>
<pre>- instance_id, ret);<o:p></o:p></pre>
<pre>- goto exit;<o:p></o:p></pre>
<pre>- }<o:p></o:p></pre>
<pre>- }<o:p></o:p></pre>
<pre>- }<o:p></o:p></pre>
<pre>+ gfx_ring->funcs->start_queue(adev, instance_id);<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre> exit:<o:p></o:p></pre>
<pre> /* Restart the scheduler's work queue for the GFX and page rings<o:p></o:p></pre>
<pre>diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c<o:p></o:p></pre>
<pre>b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c<o:p></o:p></pre>
<pre>index fd34dc138081..c1f7ccff9c4e 100644<o:p></o:p></pre>
<pre>--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c<o:p></o:p></pre>
<pre>+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c<o:p></o:p></pre>
<pre>@@ -2132,6 +2132,8 @@ static const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = {<o:p></o:p></pre>
<pre> .emit_reg_wait = sdma_v4_4_2_ring_emit_reg_wait,<o:p></o:p></pre>
<pre> .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper,<o:p></o:p></pre>
<pre> .reset = sdma_v4_4_2_reset_queue,<o:p></o:p></pre>
<pre>+ .stop_queue = sdma_v4_4_2_stop_queue,<o:p></o:p></pre>
<pre>+ .start_queue = sdma_v4_4_2_restore_queue,<o:p></o:p></pre>
<pre> .is_guilty = sdma_v4_4_2_ring_is_guilty, };<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
</blockquote>
<pre><o:p> </o:p></pre>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>