<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" 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%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Alex Deucher <alexdeucher@gmail.com><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="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Thu, Mar 22, 2018 at 7:40 AM, Rex Zhu <Rex.Zhu@amd.com> wrote:<br>
> Change-Id: Ib02cd71593bee9606822a466a56f2d01ac2e04cc<br>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><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/amd_powerplay.c | 28 +++++++++++++--------------<br>
> 1 file changed, 14 insertions(+), 14 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
> index 5d7d9ec..1ae4905 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
> +++ b/drivers/gpu/drm/amd/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>
> AMD_PP_TASK_COMPLETE_INIT, NULL);<br>
> -<br>
> + mutex_unlock(&hwmgr->smu_lock);<br>
> + }<br>
> return 0;<br>
> }<br>
<br>
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="PlainText"><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="PlainText"> <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>
> hwmgr->soft_pp_table_size,<br>
> GFP_KERNEL);<br>
> - if (!hwmgr->hardcode_pp_table) {<br>
> - mutex_unlock(&hwmgr->smu_lock);<br>
> - return -ENOMEM;<br>
> - }<br>
> + if (!hwmgr->hardcode_pp_table)<br>
> + goto err;<br>
> }<br>
><br>
> memcpy(hwmgr->hardcode_pp_table, buf, size);<br>
><br>
> hwmgr->soft_pp_table = hwmgr->hardcode_pp_table;<br>
> - mutex_unlock(&hwmgr->smu_lock);<br>
><br>
> ret = amd_powerplay_reset(handle);<br>
> if (ret)<br>
> - return ret;<br>
> + goto err;<br>
><br>
> if (hwmgr->hwmgr_func->avfs_control) {<br>
> ret = hwmgr->hwmgr_func->avfs_control(hwmgr, false);<br>
> if (ret)<br>
> - return ret;<br>
> + goto err;<br>
> }<br>
> -<br>
> + mutex_unlock(&hwmgr->smu_lock);<br>
> return 0;<br>
> +err:<br>
> + mutex_unlock(&hwmgr->smu_lock);<br>
> + return ret;<br>
> }<br>
<br>
<br>
Rex: unlock mutex until set pp table complete to avoid other pp functions were called <a target="_blank" hidefocus="true" 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="LPlnk788007" previewremoved="true">simultaneously</a>.</div>
<div class="PlainText"><br>
<br>
> static int pp_dpm_force_clock_level(void *handle,<br>
> --<br>
> 1.9.1<br>
><br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> amd-gfx@lists.freedesktop.org.<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="LPlnk522444" previewremoved="true">
https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
<div id="LPBorder_GT_15217258717160.7688091820158907" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15217258717130.22908408943618563" role="presentation" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; 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);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_15217258717140.47403618146898485" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_15217258717140.3350244639142821"></div>
<div id="LPTitle_15217258717140.3623822377742081" style="top: 0px; 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="LPUrlAnchor_15217258717150.7344540130325998" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" target="_blank" style="text-decoration: none;">amd-gfx Info Page - freedesktop.org</a></div>
<div id="LPMetadata_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;">
lists.freedesktop.org</div>
<div id="LPDescription_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 freedesktop.org lists is subject to our Code of ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
</div>
</span></font></div>
</div>
</div>
</div>
</body>
</html>