Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-15 Thread Michael
On Saturday, 15 June 2024 18:24:04 BST Walter Dnes wrote:
> On Sat, Jun 15, 2024 at 12:39:09PM +0100, Michael wrote
> 
> > The maximum temperature at which your CPU die with its 65W TDP starts
> > throttling to keep its temperatures safe is 100°C TjMax.  Look at the
> > TJunction number here:
> > 
> > https://www.intel.com/content/www/us/en/products/sku/199271/intel-core-i51
> > 0400-processor-12m-cache-up-to-4-30-ghz/specifications.html
> > 
> > According to Intel anything below 100°C is 'normal'.  If this were
> > my CPU I would not worry with temperatures ~70-85°C.  Above that
> > I would install a better CPU cooler.
> 
>   Thanks.  I wasn't aware of the two different versions of "Max
> Temperature".

I have had laptops which throttled on hot days and when there wasn't enough 
airflow around/underneath them.  You'll see dmesg filling up with warnings 
about max temp reached or some such and any heavy lifting compilation taking 
forever to finish, since the CPU is throttling and cutting out.  If the 
overheating was extreme due to a race condition, then the laptop would just 
shutdown.  Since you have not observed this kind of rather concerning 
symptoms, I think you can continue using the schedutil governor which is quite 
intelligent in juggling and optimising tasks.  Check the documentation for 
your kernel in:

/usr/src/linux-6.6.30-gentoo/Documentation/scheduler/schedutil.rst



signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-15 Thread Walter Dnes
On Sat, Jun 15, 2024 at 12:39:09PM +0100, Michael wrote

> The maximum temperature at which your CPU die with its 65W TDP starts 
> throttling to keep its temperatures safe is 100°C TjMax.  Look at the 
> TJunction number here:
> 
> https://www.intel.com/content/www/us/en/products/sku/199271/intel-core-i510400-processor-12m-cache-up-to-4-30-ghz/specifications.html
 
> According to Intel anything below 100°C is 'normal'.  If this were
> my CPU I would not worry with temperatures ~70-85°C.  Above that
> I would install a better CPU cooler.

  Thanks.  I wasn't aware of the two different versions of "Max Temperature".

-- 
Roses are red
Roses are blue
Depending on their velocity
Relative to you



Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-15 Thread Michael
On Friday, 14 June 2024 20:53:04 BST Walter Dnes wrote:
> On Fri, Jun 14, 2024 at 11:54:52AM +0100, Michael wrote
> 
> > I would think 46-48°C is refreshingly cool, but it very much depends
> > on the CPU chip, the MoBo and its BIOS/microcode settings.
> 
>   I looked up my CPU (see my reply to Dale).  The max temp allowed is
> 71.3 C.  A short kernel compile is one thing.  I tried schedutil during
> an emerge world update, and the temp was hitting 70 C.  Ouch!  schedutil
> has to go.

Not so fast!  :-)

The maximum temperature at which your CPU die with its 65W TDP starts 
throttling to keep its temperatures safe is 100°C TjMax.  Look at the 
TJunction number here:

https://www.intel.com/content/www/us/en/products/sku/199271/intel-core-i510400-processor-12m-cache-up-to-4-30-ghz/specifications.html

As I understand it 72°C is the TCase temperature.  sys-apps/lm-sensors are 
meant to report TjMax, the core temperature of the CPU.  The TCase can be 
measured (approximately) with an infrared thermometer, or by hacking the cover 
of the CPU (seriously NOT recommended!).  Assuming you have enough RAM and you 
use all your CPU threads, a big package compile (e.g. chromium) will indicate 
typical max temperatures your particular installation achieves.  Something 
like MAKEOPTS="-j13 -l12.8" ought to squeeze the juice out of it.

The TjMax is controlled by the MoBo firmware and any updates to it.  
Aftermarket CPU coolers and thermal paste will give you an edge here over 
stock options for desktops, especially when ambient temperatures hit higher 
numbers in the summer months.  For a laptop there are limited things to try, 
e.g. better thermal pads/paste and a cooling pad with external fans.  However, 
such measures may only be necessary if the stock cooler does not keep 
temperatures within normal operating range.

According to Intel anything below 100°C is 'normal'.  If this were my CPU I 
would not worry with temperatures ~70-85°C.  Above that I would install a 
better CPU cooler.


> > I recall an early i7 CPU laptop would not go above 2,400MHz when
> > 4core/8threads were running, but on single core processes I would
> > see it on i7z jumping up to 4,200MHz.
> 
>   Speaking of cores+threads... I had always thought my cpu had 12
> cores.  i.e. /proc/cpuinfo showed 12 "cpus" as did directory
> /sys/devices/system/cpu/  But I was wrong.  The specs show 6 real cores,
> plus hyperthreading.

You can use lscpu.  It shows threads and cores.


> See Greg Kroah-Hartman's presentation about the
> security issue called "hyperthreading"...
> https://events19.linuxfoundation.org/wp-content/uploads/2018/07/gregkh_mds.p
> df Read it and weep.  Page 6 summarizes it succinctly...
> 
> ==
>   OpenBSD was right
> * Guessed more problems would be in this area
> * Disabled SMT for Intel chips in June 2018
> * Repeated the plea to disable this in August 2018
> * Prevented almost all MDS issues automatically
> * Security over performance
> * Huge respect!
> ==
> 
>   I immediately went into the BIOS and disabled hyperthreading... and
> adjusted makeopts in make.conf 

In June 2018 and for 2019 the idea to disable hyperthreading would be a 
security precaution, especially for datacenters and systems running VM 
installations.

I am not sure this is either necessary or even recommended anymore.  More 
knowledgeable contributors should chime in here.  As far as I know, OEM MoBo 
firmware updates, CPU microcode releases, OS kernels, compilers and 
applications have implemented a lot of fixes and patches to cover the litany 
of CPU bugs and vulnerabilities discovered since then.

If you run lscpu and also check your dmesg output, you'll see what known 
vulnerabilities your CPU may be still be exposed to - if any.  Sadly Intel are 
not very charitable toward their older retail market CPUs and did not release 
needed microcode updates.  This steered me away from their CPUs since then.

You could also take a look at the spectre-meltdown-checker if you want a more 
detailed report on the latest revealed vulnerabilities:

https://github.com/speed47/spectre-meltdown-checker


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-15 Thread Peter Humphrey
On Friday, 14 June 2024 16:16:09 BST Michael wrote:

> Liquid cooling would have made it as quiet as a church mouse.  ;-)

I have a machine here with liquid cooling, and over its few years it's become 
deafening under full load (24 simultaneous floating-point physics 
applications). It is quiet when idling, though - of course.

Perhaps I should get busy cleaning...

-- 
Regards,
Peter.






Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-14 Thread Walter Dnes
On Fri, Jun 14, 2024 at 11:54:52AM +0100, Michael wrote

> I would think 46-48°C is refreshingly cool, but it very much depends
> on the CPU chip, the MoBo and its BIOS/microcode settings.

  I looked up my CPU (see my reply to Dale).  The max temp allowed is
71.3 C.  A short kernel compile is one thing.  I tried schedutil during
an emerge world update, and the temp was hitting 70 C.  Ouch!  schedutil
has to go.

> I recall an early i7 CPU laptop would not go above 2,400MHz when
> 4core/8threads were running, but on single core processes I would
> see it on i7z jumping up to 4,200MHz.

  Speaking of cores+threads... I had always thought my cpu had 12
cores.  i.e. /proc/cpuinfo showed 12 "cpus" as did directory
/sys/devices/system/cpu/  But I was wrong.  The specs show 6 real cores,
plus hyperthreading.  See Greg Kroah-Hartman's presentation about the
security issue called "hyperthreading"...
https://events19.linuxfoundation.org/wp-content/uploads/2018/07/gregkh_mds.pdf
Read it and weep.  Page 6 summarizes it succinctly...

==
  OpenBSD was right
* Guessed more problems would be in this area
* Disabled SMT for Intel chips in June 2018
* Repeated the plea to disable this in August 2018
* Prevented almost all MDS issues automatically
* Security over performance
* Huge respect!
==

  I immediately went into the BIOS and disabled hyperthreading... and
adjusted makeopts in make.conf 

> What do you get when you run make with '-j jobs', where jobs=max
> threads of your CPU?

  I hadn't realized that this applied to kernel compiling as well as
portage "emerge".  Since my system now shows 6 (real) cores, I set 5
jobs.  My /usr/src/makeover script is now...

===
#!/bin/bash
make -j 5 && \
make modules_install && \
cp  arch/x86_64/boot/bzImage /boot/vmlinuz-experimental && \
cp System.map /boot/System.map-experimental && \
cp .config /boot/config-experimental
===

  Since I wanted to exorcise schedutil from my system, I had an excuse
to run another compile.  From /usr/src/linux I executed...

cp .config ..
make mrproper
cp ../.config .
time ../makeover

  I had manually selected "userspace" and 290 khz.  The result was
so farcical, I repeated it a second time to confirm it was for real.

real4m43.120s
user20m11.003s
sys 1m25.728s.

  Under 5 minutes.  Like wow!  The CPU stayed pegged at around 2.900 Ghz
and the temperature never got over 47 C.  Thank you very much for that
info about jobs for make.

-- 
Roses are red
Roses are blue
Depending on their velocity
Relative to you



Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-14 Thread Michael
On Friday, 14 June 2024 15:18:36 BST Peter Humphrey wrote:
> On Friday, 14 June 2024 13:55:49 BST William Kenworthy wrote:
> > I have a (now quite old) MSsurface-pro4 with an I5 - it runs about
> > 50-60c on normal use but compiling (for example) webkit-gtk and
> > Libreoffice causes the temp to go way too high. I have a script checking
> > the cpu temps - at something like 65 deg it switches from performance to
> > the powersave governer (helps some), at greater than 71c it hibernates.
> > After a cooldown I restart it and it continues on. If I move the 71c
> > trippoint to 72c, it will reliably hard lockup after a short delay.
> > Ideally, I would like to be able to tune MAKEOPTS dynamicly to reduce
> > the number of cpu cores to help further but I dont believe portage can
> > do that.
> 
> Sounds like a useful script, but is 71C really too high? The fan in this i5
> Intel NUC, admittedly much younger (just a few months old), doesn't start
> until the CPU temperature reaches 90C. No doubt you've done your research,
> so by all means ignore me if you want to.

Some Intel chips will not throttle until the temperatures have exceeded 103°C.  
71°C should be considered normal operating temperature, but as always ... it 
depends.


> > I am in the process of setting up distcc to try and help distribute the
> > load while limiting the i5 to -J2 which I hope can speed things up
> > whilst still keeping its cool.
> 
> That makes me think a bit. I used to use a 24-thread Ryzen M9 as a compute
> host with smaller machines being NFS-mounted into a chroot, which worked
> well, but that beast has become too noisy. Now I just use the Gentoo
> packages where I can.

Liquid cooling would have made it as quiet as a church mouse.  ;-)


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-14 Thread Peter Humphrey
On Friday, 14 June 2024 13:55:49 BST William Kenworthy wrote:

> I have a (now quite old) MSsurface-pro4 with an I5 - it runs about
> 50-60c on normal use but compiling (for example) webkit-gtk and
> Libreoffice causes the temp to go way too high. I have a script checking
> the cpu temps - at something like 65 deg it switches from performance to
> the powersave governer (helps some), at greater than 71c it hibernates.
> After a cooldown I restart it and it continues on. If I move the 71c
> trippoint to 72c, it will reliably hard lockup after a short delay.
> Ideally, I would like to be able to tune MAKEOPTS dynamicly to reduce
> the number of cpu cores to help further but I dont believe portage can
> do that.

Sounds like a useful script, but is 71C really too high? The fan in this i5 
Intel NUC, admittedly much younger (just a few months old), doesn't start 
until the CPU temperature reaches 90C. No doubt you've done your research, so 
by all means ignore me if you want to.

> I am in the process of setting up distcc to try and help distribute the
> load while limiting the i5 to -J2 which I hope can speed things up
> whilst still keeping its cool.

That makes me think a bit. I used to use a 24-thread Ryzen M9 as a compute 
host with smaller machines being NFS-mounted into a chroot, which worked well, 
but that beast has become too noisy. Now I just use the Gentoo packages where 
I can.

-- 
Regards,
Peter.






Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-14 Thread William Kenworthy



On 14/6/24 20:16, Dale wrote:

Walter Dnes wrote:

On Thu, Jun 13, 2024 at 10:49:57PM -0500, Dale wrote


The biggest thing, find out what the exact specs are for your CPU.
Then go from there.  That's your starting point tho.

   "grep model /proc/cpuinfo" returns 12 instances of...

model   : 165
model name  : Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz

   "I asked Mr.Google" and the best hit was...
https://www.cpu-world.com/Compare/463/Intel_Core_i5_i5-10400_vs_Intel_Core_i5_i5-9400.html
...which compares my CPU against a previous generation.  The "model" and
"model name" both match.  My CPU is stepping 3 versus 5 on the web page.
The "Core name" is "Comet Lake-S", which matches output from "lspci" on
my system.  The base max frequency is 2900 Mhz and the "turbo frequency"
is 4300, which matches what I see during compiles.

   Now for the important part...Max temperature = 71.3 C (160.34 F).  So
schedutil is not a problem.


If it were my CPU with a max of 70C and I was running at 48C, I wouldn't
be worried.  In degrees F, that's a difference of about 40 degrees.  It
seems your max temp and mine are pretty close.  You are actually running
a little cooler than mine.

Unless someone else sees a problem, I would carry on.  The CPU at those
temps should have a nice long life.  You can also enjoy the speed increase.

Dale

:-)  :-)

I have a (now quite old) MSsurface-pro4 with an I5 - it runs about 
50-60c on normal use but compiling (for example) webkit-gtk and 
Libreoffice causes the temp to go way too high. I have a script checking 
the cpu temps - at something like 65 deg it switches from performance to 
the powersave governer (helps some), at greater than 71c it hibernates. 
After a cooldown I restart it and it continues on. If I move the 71c 
trippoint to 72c, it will reliably hard lockup after a short delay. 
Ideally, I would like to be able to tune MAKEOPTS dynamicly to reduce 
the number of cpu cores to help further but I dont believe portage can 
do that.


I am in the process of setting up distcc to try and help distribute the 
load while limiting the i5 to -J2 which I hope can speed things up 
whilst still keeping its cool.


BillK







Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-14 Thread Dale
Walter Dnes wrote:
> On Thu, Jun 13, 2024 at 10:49:57PM -0500, Dale wrote
>
>> The biggest thing, find out what the exact specs are for your CPU. 
>> Then go from there.  That's your starting point tho. 
>   "grep model /proc/cpuinfo" returns 12 instances of...
>
> model   : 165
> model name  : Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
>
>   "I asked Mr.Google" and the best hit was...
> https://www.cpu-world.com/Compare/463/Intel_Core_i5_i5-10400_vs_Intel_Core_i5_i5-9400.html
> ...which compares my CPU against a previous generation.  The "model" and
> "model name" both match.  My CPU is stepping 3 versus 5 on the web page.
> The "Core name" is "Comet Lake-S", which matches output from "lspci" on
> my system.  The base max frequency is 2900 Mhz and the "turbo frequency"
> is 4300, which matches what I see during compiles.
>
>   Now for the important part...Max temperature = 71.3 C (160.34 F).  So
> schedutil is not a problem.
>

If it were my CPU with a max of 70C and I was running at 48C, I wouldn't
be worried.  In degrees F, that's a difference of about 40 degrees.  It
seems your max temp and mine are pretty close.  You are actually running
a little cooler than mine. 

Unless someone else sees a problem, I would carry on.  The CPU at those
temps should have a nice long life.  You can also enjoy the speed increase.

Dale

:-)  :-) 



Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-14 Thread Walter Dnes
On Thu, Jun 13, 2024 at 10:49:57PM -0500, Dale wrote

> The biggest thing, find out what the exact specs are for your CPU. 
> Then go from there.  That's your starting point tho. 

  "grep model /proc/cpuinfo" returns 12 instances of...

model   : 165
model name  : Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz

  "I asked Mr.Google" and the best hit was...
https://www.cpu-world.com/Compare/463/Intel_Core_i5_i5-10400_vs_Intel_Core_i5_i5-9400.html
...which compares my CPU against a previous generation.  The "model" and
"model name" both match.  My CPU is stepping 3 versus 5 on the web page.
The "Core name" is "Comet Lake-S", which matches output from "lspci" on
my system.  The base max frequency is 2900 Mhz and the "turbo frequency"
is 4300, which matches what I see during compiles.

  Now for the important part...Max temperature = 71.3 C (160.34 F).  So
schedutil is not a problem.

-- 
Roses are red
Roses are blue
Depending on their velocity
Relative to you



Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-14 Thread Michael
On Friday, 14 June 2024 03:52:38 BST Walter Dnes wrote:
>   I've been doing a bunch of kernel-compiling recently and I've switched
> between schedulers from compile to compile to compare.  See
> https://www.kernel.org/doc/html/v6.6/admin-guide/pm/cpufreq.html for
> background info.  All frequencies in khz.  On my machine...
> 
> * bios_limit == 2901000
> 
> * scaling_available_frequencies == 2901000 290 270 260 240
> 230 210 200 180 170 150 140 120 110
> 90 80
> 
> * scaling_available_governors == conservative ondemand userspace powersave
> performance schedutil NOTE: You must build the governors you want into the
> kernel
> make menuconfig
> Power management and ACPI options
> CPU Frequency scaling
> ...and select the desired governors.
> 
>   *YOUR NUMBERS AND GOVERNORS WILL BE DIFFERENT*  When rebuilding
> kernels, I wanted to do "apples-to-apples" comparisons so I would...
> 
> * make menuconfig (in /usr/src/linux)
> * cp .config .. (*VERY IMPORTANT*)
> * make mrproper (initialize stuff in /usr/src/linux to a sane state)
> * cp ../.config . (restore .config which got wiped by "make mrproper")
> * (build new kernel, "time blah blah blah")
> 
>   I've cobbled together a bash script that can list and set cpu
> frequencies and governors.  Note that root or sudo permission is needed
> to set anything, because the script is writing to the /sys/ filesystem.
> I would hover the mouse pointer over the ICEWM toolbar CPU widget to get
> CPU data.
> 
> * select governor "userspace" and speed 290
> * computer "idling"; CPU speed approx 2.900 ghz and temp 28 C
> * compiling kernel; CPU speed approx 2.900 ghz and temp 35-to-37 C
> * kernel takes 20 minutes to build
> 
> * select governor "schedutil"
> * computer "idling"; CPU speed approx 0.800 ghz and temp 28 C
> * compiling kernel; CPU speed approx 4.200 ghz and temp 46-to-48 C
> * kernel takes 15 minutes to build
> 
>   Is that a dangerously high CPU temperature?  Building the kernel 5
> minutes faster is a minor improvement.

I would think 46-48°C is refreshingly cool, but it very much depends on the 
CPU chip, the MoBo and its BIOS/microcode settings.

As a rule laptops have lower temperatures than desktops, before they start 
throttling.  Laptop platforms also tend to limit the maximum frequency when 
all cores are running to keep the temperature under control.  I recall an 
early i7 CPU laptop would not go above 2,400MHz when 4core/8threads were 
running, but on single core processes I would see it on i7z jumping up to 
4,200MHz.

Similarly, on modern CPUs the boost frequency on all cores is lower than when 
applied on a single core only.

A 25% improvement on a kernel compilation time is rather significant and 
corresponds to your 30% increase in frequency minus thermal losses.

What do you get when you run make with '-j jobs', where jobs=max threads of 
your CPU?

signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] CPU frequency governors and temperatures

2024-06-13 Thread Dale
Walter Dnes wrote:
>   I've been doing a bunch of kernel-compiling recently and I've switched
> between schedulers from compile to compile to compare.  See
> https://www.kernel.org/doc/html/v6.6/admin-guide/pm/cpufreq.html for
> background info.  All frequencies in khz.  On my machine...
>
> * bios_limit == 2901000
>
> * scaling_available_frequencies == 2901000 290 270 260 240 
> 230 210 200 180 170 150 140 120 110 
> 90 80
>
> * scaling_available_governors == conservative ondemand userspace powersave 
> performance schedutil
>   NOTE: You must build the governors you want into the kernel
> make menuconfig
> Power management and ACPI options
> CPU Frequency scaling
> ...and select the desired governors.
>
>   *YOUR NUMBERS AND GOVERNORS WILL BE DIFFERENT*  When rebuilding
> kernels, I wanted to do "apples-to-apples" comparisons so I would...
>
> * make menuconfig (in /usr/src/linux)
> * cp .config .. (*VERY IMPORTANT*)
> * make mrproper (initialize stuff in /usr/src/linux to a sane state)
> * cp ../.config . (restore .config which got wiped by "make mrproper")
> * (build new kernel, "time blah blah blah")
>
>   I've cobbled together a bash script that can list and set cpu
> frequencies and governors.  Note that root or sudo permission is needed
> to set anything, because the script is writing to the /sys/ filesystem.
> I would hover the mouse pointer over the ICEWM toolbar CPU widget to get
> CPU data.
>
> * select governor "userspace" and speed 290
> * computer "idling"; CPU speed approx 2.900 ghz and temp 28 C
> * compiling kernel; CPU speed approx 2.900 ghz and temp 35-to-37 C
> * kernel takes 20 minutes to build
>
> * select governor "schedutil"
> * computer "idling"; CPU speed approx 0.800 ghz and temp 28 C
> * compiling kernel; CPU speed approx 4.200 ghz and temp 46-to-48 C
> * kernel takes 15 minutes to build
>
>   Is that a dangerously high CPU temperature?  Building the kernel 5
> minutes faster is a minor improvement.
>


I think some CPUs can run at different temps.  I'd check the specs to
see what the max is.  Obviously, stay away from that.  I converted to F
since C eludes me.  It converts to about 118F.  My FX-8350 during long
compiles reaches 123F, sometimes 125F.  I have a very large cooler on
that thing and serious fans in my case.  I've never worried about it
even at that temp.  I think mine starts to slow down at around 160F. 
Shutdown is a little more than that.  I wouldn't want to go above 135F
myself.  That gives good wiggle room. 

I'd think that 118F is OK but it can vary from CPU to CPU.  I'd check
the specs for that chip and stay at least 30 degrees below that if
possible.  If you're using a laptop, that limits your options.  A
cooling pad can help and make sure the dust bunnies are blown out as
well.  If desktop, blow the dust bunnies out, make sure you have good
case air flow and nothing is blocking the flow in or out.  I tend to
blow mine out twice a year, at least. 

The biggest thing, find out what the exact specs are for your CPU.  Then
go from there.  That's your starting point tho. 

Hope that helps.

Dale

:-)  :-)