Throttling CPU based on temperature?

Ralf Mardorf kde.lists at yahoo.com
Wed Aug 17 08:20:24 UTC 2022


On Wed, 2022-08-17 at 07:45 +0200, Bo Berglund wrote:
> $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> ondemand

Hi,

I'm used this for my old AMD machine and continue to use it for my now
also old, but still in use Intel machine.

echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
     ^^^^^^^^^
AMD  ondemand, Intel powersave

echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

"Performance" or any, even a low fixed frequency is required on some
realtime machines, to e.g. avoid audio glitches. However,
ondemand/powersave alone don't help you with your issue. Since the
frequency is variable, low when the machine is idle, but on max when the
machine is on heavy load. What might help is setting a low fixed
frequency or when using ondemand/powersave reducing the max frequency.

I can only comment on the default behaviour of ondemand/powersave.

Probably inaccurate, but a starting point:

https://wiki.archlinux.org/title/CPU_frequency_scaling#Scaling_governors

What is mentioned about powersave is not what is happening on my
machine, here happens the same as what is mentioned about ondemand:

powersave 	Run the CPU at the minimum frequency, obtained from...
ondemand 	Scales the frequency dynamically according to current
load. Jumps to the highest frequency and then possibly back off as the
idle time increases.

You should run a few tests. My machine is more or less idle at the
moment, but the frequency is nearly a its max:

[rocketmouse at archlinux ~]$ hwinfo --cpu
01: None 00.0: 10103 CPU                                        
  [Created at cpu.462]
  Unique ID: rdCR.j8NaKXDZtZ6
  Hardware Class: cpu
  Arch: X86-64
  Vendor: "GenuineIntel"
  Model: 6.60.3 "Intel(R) Celeron(R) CPU G1840 @ 2.80GHz"
  Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,pdpe1gb,rdtscp,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,nopl,xtopology,nonstop_tsc,cpuid,aperfmperf,pni,pclmulqdq,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,sdbg,cx16,xtpr,pdcm,pcid,sse4_1,sse4_2,movbe,popcnt,tsc_deadline_timer,xsave,rdrand,lahf_lm,abm,cpuid_fault,invpcid_single,pti,ssbd,ibrs,ibpb,stibp,tpr_shadow,vnmi,flexpriority,ept,vpid,ept_ad,fsgsbase,tsc_adjust,erms,invpcid,xsaveopt,dtherm,arat,pln,pts,md_clear,flush_l1d
  Clock: 2650 MHz
  BogoMips: 5587.27
  Cache: 2048 kb
  Units/Processor: 16
  Config Status: cfg=new, avail=yes, need=no, active=unknown

02: None 01.0: 10103 CPU
  [Created at cpu.462]
  Unique ID: wkFv.j8NaKXDZtZ6
  Hardware Class: cpu
  Arch: X86-64
  Vendor: "GenuineIntel"
  Model: 6.60.3 "Intel(R) Celeron(R) CPU G1840 @ 2.80GHz"
  Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,pdpe1gb,rdtscp,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,nopl,xtopology,nonstop_tsc,cpuid,aperfmperf,pni,pclmulqdq,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,sdbg,cx16,xtpr,pdcm,pcid,sse4_1,sse4_2,movbe,popcnt,tsc_deadline_timer,xsave,rdrand,lahf_lm,abm,cpuid_fault,invpcid_single,pti,ssbd,ibrs,ibpb,stibp,tpr_shadow,vnmi,flexpriority,ept,vpid,ept_ad,fsgsbase,tsc_adjust,erms,invpcid,xsaveopt,dtherm,arat,pln,pts,md_clear,flush_l1d
  Clock: 1887 MHz
  BogoMips: 5587.27
  Cache: 2048 kb
  Units/Processor: 16
  Config Status: cfg=new, avail=yes, need=no, active=unknown
[rocketmouse at archlinux ~]$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
powersave
powersave
[rocketmouse at archlinux ~]$ hwinfo --cpu | grep Clock
  Clock: 2594 MHz
  Clock: 2587 MHz
[rocketmouse at archlinux ~]$ hwinfo --cpu | grep Clock
  Clock: 2717 MHz
  Clock: 2293 MHz
[rocketmouse at archlinux ~]$ hwinfo --cpu | grep Clock
  Clock: 2459 MHz
  Clock: 2650 MHz
[rocketmouse at archlinux ~]$ hwinfo --cpu | grep Clock
  Clock: 2755 MHz
  Clock: 2650 MHz
[rocketmouse at archlinux ~]$ hwinfo --cpu | grep Clock
  Clock: 2766 MHz
  Clock: 2533 MHz

I never used lowered the max frequency or set a fixed frequency, but I
know from Linux audio mailing lists that at least the latter does work.

Btw.

$ echo foo | sudo tee /sys/devices...

requires tee, but

# echo foo > /sys/devices...

works without tee.

the pipe to tee is only required, because you can't sudo the redirection
by >.

Regards,
Ralf







More information about the ubuntu-users mailing list