<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 22, 2018 at 9:44 AM, Zhu, Rex <span dir="ltr"><<a href="mailto:Rex.Zhu@amd.com" target="_blank">Rex.Zhu@amd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_-3969800545744392271divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Please see inline.</p>
<br>
Best Regards
<div>Rex<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="m_-3969800545744392271divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Alex Deucher <<a href="mailto:alexdeucher@gmail.com" target="_blank">alexdeucher@gmail.com</a>><br>
<b>Sent:</b> Thursday, March 22, 2018 9:17 PM<br>
<b>To:</b> Zhu, Rex<br>
<b>Cc:</b> amd-gfx list<br>
<b>Subject:</b> Re: [PATCH 3/6] drm/amd/pp: Lock powerplay when reset pp table</font>
<div> </div>
</div>
<div class="m_-3969800545744392271BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="m_-3969800545744392271PlainText"><div><div class="h5">On Thu, Mar 22, 2018 at 7:40 AM, Rex Zhu <<a href="mailto:Rex.Zhu@amd.com" target="_blank">Rex.Zhu@amd.com</a>> wrote:<br>
> Change-Id: Ib02cd71593bee9606822a466a56f2<wbr>d01ac2e04cc<br>
> Signed-off-by: Rex Zhu <<a href="mailto:Rex.Zhu@amd.com" target="_blank">Rex.Zhu@amd.com</a>><br>
<br>
Please include a commit description.  It's not clear to me what's<br>
happening here.<br>
<br>
Alex<br>
<br>
> ---<br>
>  drivers/gpu/drm/amd/powerplay/<wbr>amd_powerplay.c | 28 +++++++++++++--------------<br>
>  1 file changed, 14 insertions(+), 14 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/<wbr>powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/<wbr>powerplay/amd_powerplay.c<br>
> index 5d7d9ec..1ae4905 100644<br>
> --- a/drivers/gpu/drm/amd/<wbr>powerplay/amd_powerplay.c<br>
> +++ b/drivers/gpu/drm/amd/<wbr>powerplay/amd_powerplay.c<br>
> @@ -31,8 +31,6 @@<br>
>  #include "amdgpu.h"<br>
>  #include "hwmgr.h"<br>
><br>
> -static int pp_dpm_dispatch_tasks(void *handle, enum amd_pp_task task_id,<br>
> -               enum amd_pm_state_type *user_state);<br>
><br>
>  static const struct amd_pm_funcs pp_dpm_funcs;<br>
><br>
> @@ -146,10 +144,12 @@ static int pp_late_init(void *handle)<br>
>         struct amdgpu_device *adev = handle;<br>
>         struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;<br>
><br>
> -       if (hwmgr && hwmgr->pm_en)<br>
> -               pp_dpm_dispatch_tasks(hwmgr,<br>
> +       if (hwmgr && hwmgr->pm_en) {<br>
> +               mutex_lock(&hwmgr->smu_lock);<br>
> +               hwmgr_handle_task(hwmgr,<br>
>                             <wbr>            AMD_PP_TASK_COMPLETE_INIT, NULL);<br>
> -<br>
> +               mutex_unlock(&hwmgr->smu_lock)<wbr>;<br>
> +       }<br>
>         return 0;<br>
>  }<br>
<br></div></div>
Rex : use <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:14.6667px">hwmgr_handle_task instand of  <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:14.6667px">pp_dpm_dispatch_tasks.
 because i think it is not make sense that call </span></span></div>
<div class="m_-3969800545744392271PlainText"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:14.6667px"><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:14.6667px">pp_function
 in ip_function. </span></span></div>
<div class="m_-3969800545744392271PlainText"><div><div class="h5"> <br>
> @@ -620,7 +620,7 @@ static int amd_powerplay_reset(void *handle)<br>
>  static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)<br>
>  {<br>
>         struct pp_hwmgr *hwmgr = handle;<br>
> -       int ret = 0;<br>
> +       int ret = -ENOMEM;<br>
><br>
>         if (!hwmgr || !hwmgr->pm_en)<br>
>                 return -EINVAL;<br>
> @@ -630,28 +630,28 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)<br>
>                 hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table,<br>
>                             <wbr>                       hwmgr->soft_pp_table_size,<br>
>                             <wbr>                       GFP_KERNEL);<br>
> -               if (!hwmgr->hardcode_pp_table) {<br>
> -                       mutex_unlock(&hwmgr->smu_lock)<wbr>;<br>
> -                       return -ENOMEM;<br>
> -               }<br>
> +               if (!hwmgr->hardcode_pp_table)<br>
> +                       goto err;<br>
>         }<br>
><br>
>         memcpy(hwmgr->hardcode_pp_<wbr>table, buf, size);<br>
><br>
>         hwmgr->soft_pp_table = hwmgr->hardcode_pp_table;<br>
> -       mutex_unlock(&hwmgr->smu_lock)<wbr>;<br>
><br>
>         ret = amd_powerplay_reset(handle);<br>
>         if (ret)<br>
> -               return ret;<br>
> +               goto err;<br>
><br>
>         if (hwmgr->hwmgr_func->avfs_<wbr>control) {<br>
>                 ret = hwmgr->hwmgr_func->avfs_<wbr>control(hwmgr, false);<br>
>                 if (ret)<br>
> -                       return ret;<br>
> +                       goto err;<br>
>         }<br>
> -<br>
> +       mutex_unlock(&hwmgr->smu_lock)<wbr>;<br>
>         return 0;<br>
> +err:<br>
> +       mutex_unlock(&hwmgr->smu_lock)<wbr>;<br>
> +       return ret;<br>
>  }<br>
<br>
<br></div></div>
Rex: unlock mutex until  set pp table complete to avoid other pp functions were called <a href="http://www.baidu.com/link?url=8RpXVOm53HQyZI9h-ZIs8Ipio9NEDj98vxJiiM0Wx4hbUUpanLuj7jZHEnm0Javd7_rpySIGVAwaxX_ICV-y2nDz_TZqF8mzUGZT8RPrw2WCcNsGFsoAh9nirArCSm9s" style="color:rgb(51,51,51);text-decoration:none;font-size:13px;font-family:arial" id="m_-3969800545744392271LPlnk788007" target="_blank">simultaneously</a>.</div></span></font></div></div></div></div></div></blockquote><div><br></div><div>Thanks.  Please include these comments in the patch description.  With that fixed:<br>Reviewed-by: Alex Deucher <<a href="mailto:alexander.deucher@amd.com">alexander.deucher@amd.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div id="m_-3969800545744392271divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr"><div><div style="color:rgb(0,0,0)"><div class="m_-3969800545744392271BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="m_-3969800545744392271PlainText"><span class=""><br>
<br>
>  static int pp_dpm_force_clock_level(void *handle,<br>
> --<br>
> 1.9.1<br>
><br>
> ______________________________<wbr>_________________<br>
> amd-gfx mailing list<br></span>
> <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a>.<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="m_-3969800545744392271LPlnk522444" target="_blank">
https://lists.freedesktop.org/<wbr>mailman/listinfo/amd-gfx</a>
<div id="m_-3969800545744392271LPBorder_GT_15217258717160.7688091820158907" style="margin-bottom:20px;overflow:auto;width:100%;text-indent:0px">
<table id="m_-3969800545744392271LPContainer_15217258717130.22908408943618563" style="width:90%;background-color:rgb(255,255,255);overflow:auto;padding-top:20px;padding-bottom:20px;margin-top:20px;border-top:1px dotted rgb(200,200,200);border-bottom:1px dotted rgb(200,200,200)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td id="m_-3969800545744392271TextCell_15217258717140.47403618146898485" colspan="2" style="vertical-align:top;padding:0px;display:table-cell">
<div id="m_-3969800545744392271LPRemovePreviewContainer_15217258717140.3350244639142821"></div>
<div id="m_-3969800545744392271LPTitle_15217258717140.3623822377742081" style="color:rgb(0,120,215);font-weight:normal;font-size:21px;font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;line-height:21px">
<a id="m_-3969800545744392271LPUrlAnchor_15217258717150.7344540130325998" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" style="text-decoration:none" target="_blank">amd-gfx Info Page - freedesktop.org</a></div>
<div id="m_-3969800545744392271LPMetadata_15217258717150.5144749743928732" style="margin:10px 0px 16px;color:rgb(102,102,102);font-weight:normal;font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:14px">
<a href="http://lists.freedesktop.org" target="_blank">lists.freedesktop.org</a></div>
<div id="m_-3969800545744392271LPDescription_15217258717150.4169471652740233" style="display:block;color:rgb(102,102,102);font-weight:normal;font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:20px;max-height:100px;overflow:hidden">
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all <a href="http://freedesktop.org" target="_blank">freedesktop.org</a> lists is subject to our Code of ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
</div>
</span></font></div>
</div>
</div>
</div>
</div>

</blockquote></div><br></div></div>