<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=gb2312">
<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 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:΢ź;
        panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
        {font-family:"\@";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@΢ź";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.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]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Fixed and pushed. Thanks.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<br>
Hawking<o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> Yuan, Xiaojie <Xiaojie.Yuan@amd.com> <br>
<b>Sent:</b> 2018<span lang="ZH-CN" style="font-family:"΢ź",sans-serif"></span>11<span lang="ZH-CN" style="font-family:"΢ź",sans-serif"></span>7<span lang="ZH-CN" style="font-family:"΢ź",sans-serif"></span> 11:51<br>
<b>To:</b> Zhang, Hawking <Hawking.Zhang@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: fix frame size of amdgpu_xgmi_add_devices excceed 1024 bytes<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div id="divtagdefaultwrapper">
<p><span style="font-size:12.0pt;color:black">Would be better to add a is-null check for 'tmp_topology' after kzalloc(). With that fixed, patch is<o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">Reviewed-by: Xiaojie Yuan <<a href="mailto:xiaojie.yuan@amd.com">xiaojie.yuan@amd.com</a>><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
<p><span style="font-size:12.0pt;color:black">Regards,<o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">Xiaojie<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt;color:black">
<hr size="2" width="98%" align="center">
</span></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">amd-gfx-bounces@lists.freedesktop.org</a>> on behalf of Hawking Zhang <<a href="mailto:Hawking.Zhang@amd.com">Hawking.Zhang@amd.com</a>><br>
<b>Sent:</b> Wednesday, November 7, 2018 11:29 AM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<b>Cc:</b> Zhang, Hawking<br>
<b>Subject:</b> [PATCH] drm/amdgpu: fix frame size of amdgpu_xgmi_add_devices excceed 1024 bytes</span><span style="font-size:12.0pt;color:black">
<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="color:black">Instead of stack-allocated psp_xgmi_topology_info in function<br>
amdgpu_xgmi_add_device, dynamically allocated this structure to<br>
avoid the frame size of this function excceed 1024 bytes.<br>
<br>
Signed-off-by: Hawking Zhang <<a href="mailto:Hawking.Zhang@amd.com">Hawking.Zhang@amd.com</a>><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 11 ++++++-----<br>
 1 file changed, 6 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c<br>
index e92b454..1c0ed13 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c<br>
@@ -63,7 +63,7 @@ static struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)<br>
 <br>
 int amdgpu_xgmi_add_device(struct amdgpu_device *adev)<br>
 {<br>
-       struct psp_xgmi_topology_info tmp_topology;<br>
+       struct psp_xgmi_topology_info *tmp_topology;<br>
         struct amdgpu_hive_info *hive;<br>
         struct amdgpu_xgmi      *entry;<br>
         struct amdgpu_device     *tmp_adev;<br>
@@ -76,7 +76,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)<br>
         adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp);<br>
         adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp);<br>
 <br>
-       memset(&tmp_topology, 0, sizeof(tmp_topology));<br>
+       tmp_topology = kzalloc(sizeof(struct psp_xgmi_topology_info), GFP_KERNEL);<br>
         mutex_lock(&xgmi_mutex);<br>
         hive = amdgpu_get_xgmi_hive(adev);<br>
         if (!hive)<br>
@@ -84,9 +84,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)<br>
 <br>
         list_add_tail(&adev->gmc.xgmi.head, &hive->device_list);<br>
         list_for_each_entry(entry, &hive->device_list, head)<br>
-               tmp_topology.nodes[count++].node_id = entry->node_id;<br>
+               tmp_topology->nodes[count++].node_id = entry->node_id;<br>
 <br>
-       ret = psp_xgmi_get_topology_info(&adev->psp, count, &tmp_topology);<br>
+       ret = psp_xgmi_get_topology_info(&adev->psp, count, tmp_topology);<br>
         if (ret) {<br>
                 dev_err(adev->dev,<br>
                         "XGMI: Get topology failure on device %llx, hive %llx, ret %d",<br>
@@ -96,7 +96,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)<br>
         }<br>
         /* Each psp need to set the latest topology */<br>
         list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {<br>
-               ret = psp_xgmi_set_topology_info(&tmp_adev->psp, count, &tmp_topology);<br>
+               ret = psp_xgmi_set_topology_info(&tmp_adev->psp, count, tmp_topology);<br>
                 if (ret) {<br>
                         dev_err(tmp_adev->dev,<br>
                                 "XGMI: Set topology failure on device %llx, hive %llx, ret %d",<br>
@@ -113,5 +113,6 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)<br>
 <br>
 exit:<br>
         mutex_unlock(&xgmi_mutex);<br>
+       kfree(tmp_topology);<br>
         return ret;<br>
 }<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>