<div dir="ltr">Hi! <div><br></div><div>Thanx for helping, but I have tried those methods and they didn't work on Ryzen 2400G.</div><div><br></div><div>--</div><div>Lauri</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 26, 2019 at 2:57 PM Russell, Kent <<a href="mailto:Kent.Russell@amd.com">Kent.Russell@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US">
<div class="gmail-m_-2496531401980789461WordSection1">
<p class="MsoNormal">Hi Lauri,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">There’s a more efficient method using the Power Profiles (and optionally, the ROCM-SMI tool, found at
<a href="https://github.com/RadeonOpenCompute/ROC-smi" target="_blank">https://github.com/RadeonOpenCompute/ROC-smi</a>), or the pp_sclk mask, depending on what exactly you want. I’ll list out the methods here and the rocm-smi and non-SMI commands to do it. I’ll assume that
 this GPU is card0 (it may be card1, card2, etc, depending on what GPUs are installed on your system; “rocm-smi -i” or “cat /sys/class/drm/card?/device/device will give you the GPU IDs of all of the cards, then you can figure out which one you want to use)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:0in">Mask the SCLKs . pp_dpm_sclk allows you to set a mask of what levels to use.
<u></u><u></u></li><ol style="margin-top:0in" start="1" type="a">
<li class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:0in">First, read the values (“rocm-smi --showclkfrq” , or “cat /sys/class/drm/card0/device/pp_dpm_sclk”) and see the supported DPM levels for your card.
<u></u><u></u></li><li class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:0in">Mask off the levels that you don’t want. E.g. If you only want to use levels 0-6 (and thus skip level 7), you can do either ‘rocm-smi --setsclk 0 1 2 3 4 5 6’ or ‘echo manual > /sys/class/drm/card0/device/power_dpm_force_performance_level
 && echo “0 1 2 3 4 5 6” > /sys/class/drm/card0/device/pp_dpm_sclk’ . This will set DPM to only use levels 0-6 and skip level 7. You can do this for any combination of levels or a single level (“0 2 5”, “1 2 7”, “5”, etc). That will tell it to only use the
 specified DPM levels and will persist until reboot, or until the power_dpm_force_performance is set back to ‘auto’ .<u></u><u></u></li></ol>
<li class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:0in">Set the specific DPM level values manually:<u></u><u></u></li><ol style="margin-top:0in" start="1" type="a">
<li class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:0in">First, you’ll need to enable the Power Profile Overdrive functionality. The easiest way is to add “amdgpu.ppfeaturemask=0xffffffff” to your linux command line parameters (by editing
 /boot/grub/grub.cfg manually, editing /etc/default/grub and doing an update-grub, or manually entering the kernel parameter in the GRUB menu before booting).<u></u><u></u></li><li class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:0in">Once that’s enabled, you should see the following file: /sys/class/drm/card0/device/pp_od_clk_voltage.<u></u><u></u></li><li class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:0in">Check the current DPM level information with “rocm-smi -S” or “cat /sys/class/drm/card0/device/pp_od_clk_voltage file” . Now that we have that, you can see the supported SCLK and voltages
 for each level. <u></u><u></u></li><li class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:0in">You can use the rocm-smi tool to manually change the levels through “rocm-smi --setslevel # MHZ VLT”, where:<u></u><u></u></li></ol>
</ol>
<p class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:1.5in">
<u></u><span><span style="font:7pt "Times New Roman"">                                                              
</span>i.<span style="font:7pt "Times New Roman"">      </span></span><u></u> # is the level (level 7 is probably the one you want, but you can do it for all of them)<u></u><u></u></p>
<p class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:1.5in">
<u></u><span><span style="font:7pt "Times New Roman"">                                                            
</span>ii.<span style="font:7pt "Times New Roman"">      </span></span><u></u>MHZ is the speed in MHz<u></u><u></u></p>
<p class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:1.5in">
<u></u><span><span style="font:7pt "Times New Roman"">                                                          
</span>iii.<span style="font:7pt "Times New Roman"">      </span></span><u></u>VLT is the voltage in mV.
<u></u><u></u></p>
<ol style="margin-top:0in" start="2" type="1">
<ol style="margin-top:0in" start="5" type="a">
<li class="gmail-m_-2496531401980789461MsoListParagraph" style="margin-left:0in">Honestly, you can probably just copy the highest level that you’re comfortable with and set that for all of the levels that exceed the values that you desire. So if you want to keep
 it to whatever level 6 is, just set level 7 to have the same values as level 6 (that way you don’t have to muck with voltages and such). Or if 5 is the highest that you want, set level 6 and level 7 to match level 5<u></u><u></u></li></ol>
</ol>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Hopefully that helps. It also means that you don’t have to constantly try to build your own kernel with a change to cap the SCLK cherry-picked on tpo. Please let me know if you have any questions at all!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Kent<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org" target="_blank">amd-gfx-bounces@lists.freedesktop.org</a>>
<b>On Behalf Of </b>Lauri Ehrenpreis<br>
<b>Sent:</b> Friday, March 22, 2019 6:18 AM<br>
<b>To:</b> amd-gfx list <<a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a>><br>
<b>Subject:</b> Limit gpu max clock for ryzen 2400g<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Hi!<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Is there a way how to limit gpu max clock rate? Currently I can either leave the clock to automatic mode or force it to specific level via /sys/class/drm/card0/device/pp_dpm_sclk. But ideally I would like the clock to be automatically regulated
 but specify a different upper limit for power saving reasons.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">--<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Lauri<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>

</blockquote></div>