2

I am trying to replace value in the file of constraint_0_power_limit with new value using echo "45000000" | sudo tee constraint_0_power_limit_uw

That file is under /sys/class/powercap/intel-rapl/intel-rapl:0/

When I use above command, I get tee: constraint_0_power_limit_uw: No data available error.

How can I fix that error?

Mehmet
  • 107
  • 1
    The location is not writable for all processors, it is for mine, and your command does work fine on my computer (20.04 server). I did not know of this method to adjust maximum processor package power, having always done it via direct MSR write before. Awesome. – Doug Smythies Apr 26 '20 at 00:08
  • I have 2 unlocked processors. one is older, and I get the same error as you, the other is newer, and I can change the value. They also have /sys/class/powercap/intel-rapl/intel-rapl:0/enabled as 0 and 1 and I can not change either one. – Doug Smythies Apr 26 '20 at 02:51
  • I tried same command on different CPU models. For example, I tried it on Intel Xeon E5-2620 v4 and Intel Xeon E3-1240 v2 but it did not work for none of them. Btw, my OS is Ubuntu 18.04.3 LTS. I just tried to change enabled from 0 to 1 but I got tee: enabled: Function not implemented error. – Mehmet Apr 26 '20 at 04:25
  • Yes, that is what I get on the computer that doesn't work for this. I am unable to set it to 0 on the computer that does work. – Doug Smythies Apr 26 '20 at 15:39

1 Answers1

4

The ability to adjust TDP (Thermal Design Power) at the OS (Linux) level requires:

  • An processor where TDP is configurable (actually TDP is fixed, but the max power is adjustable)
  • A BIOS that both supports this stuff AND has made it available to the O.S.

Check by looking at the enable flag. Two examples:

doug@s15:~$ cat /sys/class/powercap/intel-rapl/intel-rapl:0/enabled
0

.

doug@s18:~$ cat /sys/class/powercap/intel-rapl/intel-rapl:0/enabled
1

Now, attempt to enable the one that is disabled:

doug@s15:~$ echo 1 | sudo tee /sys/class/powercap/intel-rapl/intel-rapl:0/enabled
1
tee: '/sys/class/powercap/intel-rapl/intel-rapl:0/enabled': Function not implemented

Which does not look good. So let's check dmesg on this computer:

doug@s15:~$ dmesg | grep locked
[   21.945790] intel_rapl_common: RAPL package-0 domain package locked by BIOS
[ 5315.714761] powercap intel-rapl:0: package locked by BIOS, monitoring only

So, observe that it is BIOS that is not allowing it. And in this case, the BIOS does not support this at all, it isn't just disabled. Readers will want to check their BIOS for some sort of enable, but I could not find such a switch in the BIOS of my computer that does work.

So, for the computer where we know this will not work:

doug@s15:~$  echo "94500000" | sudo tee /sys/class/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw
94500000
tee: '/sys/class/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw': No data available

Now, for the computer that has enable as 1:

doug@s18:~$ cat /sys/class/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw
93500000
doug@s18:~$ echo "94500000" | sudo tee /sys/class/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw
94500000
doug@s18:~$ cat /sys/class/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw
94500000

Note: While researching for this answer, I did find testimonies where users were able to write a 1 to enable from the 0 state. I think this would indicate that BIOS supports this stuff, but it defaulted to disabled.

Doug Smythies
  • 16,186
  • 5
  • 48
  • 63
  • 1
    Awesome answer. Thank you! – Mehmet Apr 26 '20 at 20:29
  • "Unlocked processor" seems to usually refer to an unlocked clock multiplier, but changing the PL1 works (BIOS and chipset dependent) also on regular processors. E.g., I have changed the PL1 on an XPS 8940 with a regular i9-10900, not an unlocked i9-10900K. – Ulrich Stern Mar 10 '21 at 19:21
  • Thank you for your comment. Good to know. I'll edit the answer. @UlrichStern – Doug Smythies Mar 10 '21 at 19:23