Frequency and CPU !

teo

Aspiring Daemon

Reaction score: 39
Messages: 692

Why doesn't FreeBSD have a moderate standard of automated hardware frequency usage that can reach 98% while compiling and burning the CPUs?
 

vigole

Daemon

Reaction score: 1,462
Messages: 1,270

When I compile I set it manually sysctl dev.cpu.0.freq=800
 
OP
T

teo

Aspiring Daemon

Reaction score: 39
Messages: 692

When I compile I set it manually sysctl dev.cpu.0.freq=800
The danger of the automatic overuse of CPUs is not only in the compilation, but also when watching some video for example on youtube.
 

ralphbsz

Son of Beastie

Reaction score: 2,351
Messages: 3,241

Because how and whether to control CPU frequency is not very standardized between machines. What works on a laptop with an Intel CPU doesn't necessarily work on a desktop with an AMD CPU, nor on an embedded system (router, NAS server) with a small CPU. There aren't even really standardized device drivers and interfaces for this that transcends OSes: what works on Linux doesn't work on AIX, nor on FreeBSD, and NetBSD handles it probably yet differently. Let's not even talk about MacOS.

Just to show you what's important to the people who designed this OS: There is a huge set of things you can do to adjust serial ports. Read the man pages for stty and tcsetattr sometime. That's because at the time the design decisions for the Unix family of OSes was frozen, adjusting serial port parameters was extremely important. Many machines had dozens (sometimes hundreds) of serial ports, connected to all manner of devices in many strange and different ways. There is elaborate machinery for controlling this. CPU frequency? Not so much.

Also consider that the requirements and wishes of the user(s) can be very different. Is this a laptop, where battery conservation is paramount, and we have to strive for maximum efficiency taking the non-linearity of batteries and cooling into account? Is this a mildly loaded cloud machine, where we have to minimize the carbon footprint? Is latency (instant gratification, fast response) important, such as in gaming? Is the problem being solved of the utmost urgency, and energy usage not important? Can we turn whole cores off, or is the program we're running inherently parallel and needs all cores (but perhaps all running more slowly)? Not everything is a desktop machine that does compilations for software engineers; in reality, that usage is probably 1/10th of a percent of all computer usage, or less.

The ability to adjust CPU frequency while running is actually a very recent addition; on a PDP or VAX or Sun-3, nobody would have ever thought of doing that. And until relatively recently, most computers were multi-user, and typically had a backlog of batch workload, so at most times you wanted to run the CPU as fast as possible (except on an IO-bound machine).
 

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,588

burning the CPUs?
Burning up the CPU is not probable. All modern CPU's have thermal trip.
They will shut themselves down when they reach TJunction temperature.
You can literally run your CPU with no heatsink and it will not burn out.
It may ruin your filesystem by abruptly shutting down but you will not kill the CPU.

Look here at TJunction (typically 100C). This is your thermal trip temperature.

You might decrease the lifetime of a CPU by constantly running it at high temperatures.
Chances are it will become obsolete before it dies.
 
OP
T

teo

Aspiring Daemon

Reaction score: 39
Messages: 692

Because how and whether to control CPU frequency is not very standardized between machines. What works on a laptop with an Intel CPU doesn't necessarily work on a desktop with an AMD CPU, nor on an embedded system (router, NAS server) with a small CPU. There aren't even really standardized device drivers and interfaces for this that transcends OSes: what works on Linux doesn't work on AIX, nor on FreeBSD, and NetBSD handles it probably yet differently. Let's not even talk about MacOS.

Just to show you what's important to the people who designed this OS: There is a huge set of things you can do to adjust serial ports. Read the man pages for stty and tcsetattr sometime. That's because at the time the design decisions for the Unix family of OSes was frozen, adjusting serial port parameters was extremely important. Many machines had dozens (sometimes hundreds) of serial ports, connected to all manner of devices in many strange and different ways. There is elaborate machinery for controlling this. CPU frequency? Not so much.

Also consider that the requirements and wishes of the user(s) can be very different. Is this a laptop, where battery conservation is paramount, and we have to strive for maximum efficiency taking the non-linearity of batteries and cooling into account? Is this a mildly loaded cloud machine, where we have to minimize the carbon footprint? Is latency (instant gratification, fast response) important, such as in gaming? Is the problem being solved of the utmost urgency, and energy usage not important? Can we turn whole cores off, or is the program we're running inherently parallel and needs all cores (but perhaps all running more slowly)? Not everything is a desktop machine that does compilations for software engineers; in reality, that usage is probably 1/10th of a percent of all computer usage, or less.

The ability to adjust CPU frequency while running is actually a very recent addition; on a PDP or VAX or Sun-3, nobody would have ever thought of doing that. And until relatively recently, most computers were multi-user, and typically had a backlog of batch workload, so at most times you wanted to run the CPU as fast as possible (except on an IO-bound machine).
Some FreeBSD maintainers recommend using the system on older hardware because of the lack of drivers and support for modern hardware , and I wonder, the FreeBSD system can not by itself automatically limit the use of frequencies which carries the danger that CPUs burn out while compiling or just start watching a video on youtube, it is simply staying in the past obsolete, that does not happen in linux and windows , controls and regulates the frequency automatically while performing its activity.
 

drhowarddrfine

Son of Beastie

Reaction score: 2,356
Messages: 4,313

Some FreeBSD maintainers recommend using the system on older hardware because of the lack of drivers and support for modern hardware
I have never heard that in the 16 years I've been running FreeBSD. I've also used all new hardware when building my workstation and servers.

I don't know how one would set the CPU frequency to a non-existent number that could burn a CPU up. If a manufacturer has such a setting, that's on them, not FreeBSD or anyone else.

The original question makes no sense to me.
 

mickey

Aspiring Daemon

Reaction score: 310
Messages: 754

limit the use of frequencies which carries the danger that CPUs burn out while compiling or just start watching a video on youtube
If overheating is your primary concern, my own observations recently showed, that disabling Intel Turbo Boost on my system can reduce temperatures by as much as 10°C without significant loss of overall performance.
 

PMc

Daemon

Reaction score: 676
Messages: 1,358

Why doesn't FreeBSD have a moderate standard of automated hardware frequency usage that can reach 98% while compiling and burning the CPUs?
Because this is only a problem on laptop machines. Everything else should be designed to run at max for an unlimited time. If it isn't, just move more air thru the case. (Same would be applicable for laptops, but there proper fans may not be available, and/or the thing will get noisy.)

If overheating is your primary concern, my own observations recently showed, that disabling Intel Turbo Boost on my system can reduce temperatures by as much as 10°C without significant loss of overall performance.
That depends on the specs of the individual chip. Some do benefit significantly from TurboBoost, some do not much.

The danger of the automatic overuse of CPUs is not only in the compilation, but also when watching some video for example on youtube.
How come? Watching a video will usually do this:
* run one core at max, probably entering TurboBoost
* never allow the package to go to C-states
If this already gets the cpu too hot, then that case is quite misdesigned.

Anyway, you can always watch the temperature readings (at least with intel chips) in sysctl:
Code:
dev.cpu.3.temperature: 40.0C
dev.cpu.3.coretemp.throttle_log: 0
dev.cpu.3.coretemp.tjmax: 105.0C
dev.cpu.3.coretemp.resolution: 1
dev.cpu.3.coretemp.delta: 65

So if this shows your machine getting near the limits, then that is an issue specific to your model of machine. It wouldn't be very difficult to monitor these values and switch cpu frequency accordingly. (I am doing just that to switch my extra fans on demand - but I am concerned mainly with disk temperatures, as disks won't throttle automatically.)
 
OP
T

teo

Aspiring Daemon

Reaction score: 39
Messages: 692

Because this is only a problem on laptop machines. Everything else should be designed to run at max for an unlimited time. If it isn't, just move more air thru the case. (Same would be applicable for laptops, but there proper fans may not be available, and/or the thing will get noisy.)


That depends on the specs of the individual chip. Some do benefit significantly from TurboBoost, some do not much.


How come? Watching a video will usually do this:
* run one core at max, probably entering TurboBoost
* never allow the package to go to C-states
If this already gets the cpu too hot, then that case is quite misdesigned.

Anyway, you can always watch the temperature readings (at least with intel chips) in sysctl:
Code:
dev.cpu.3.temperature: 40.0C
dev.cpu.3.coretemp.throttle_log: 0
dev.cpu.3.coretemp.tjmax: 105.0C
dev.cpu.3.coretemp.resolution: 1
dev.cpu.3.coretemp.delta: 65

So if this shows your machine getting near the limits, then that is an issue specific to your model of machine. It wouldn't be very difficult to monitor these values and switch cpu frequency accordingly. (I am doing just that to switch my extra fans on demand - but I am concerned mainly with disk temperatures, as disks won't throttle automatically.)

In the past of another open theme published the real dimension of the FreeBSD system working on a real machine laptop compiling, which in minimal compilations of obsolete ports was turned off the machine in the middle of compilation, sounding the ventilations at full, the same happened simply by watching a video on youtube.

$ sysctl -a grep temperature
Code:
hw.acpi.thermal.tz0.temperature: 94,1C
dev.cpu.3.temperature: 96,0C
dev.cpu.2.temperature: 96,0C
dev.cpu.1.temperature: 92,0C
dev.cpu.0.temperature: 92,0C
$
 

Attachments

  • Screen_2020-11-22_19-27-10.png
    Screen_2020-11-22_19-27-10.png
    129.4 KB · Views: 95

PMc

Daemon

Reaction score: 676
Messages: 1,358

Thanks for the pic. You're right, that is something I would not enjoy.

So we learn: whenever you get to buy a new laptop, do that test, right in the shop, before buying.

Probably one could look into the code of powerd, and insert an option to retrieve the temperature and set a limit there.
Otherwise, some shell scripting might also do
(WARNING: this is not tested, it is just quick cut+paste of some parts from my scripts!)
Code:
#! /bin/sh
SYSCTL=/sbin/sysctl
SPEAKER=/dev/speaker
NCPU=`$SYSCTL -n hw.ncpu`
SLEEPTM=7
HWMTM=0
HWMPER=20
MODE1=0
MAX_SYS=0

MODE1_UTS=$1   # upper thresh
MODE1_LTS=$2    # lower thresh

alert()
{
  local mode=$1
  case $mode in
    30) echo "T255 O4 CGAECB" > $SPEAKER ;;
    31) echo "T255 O4 CGAEAC" > $SPEAKER ;;
  esac
}

gethwm()
{
  MAX_SYS=0
  i=0
  while test $i -lt $NCPU; do
    eval cpu_$i=`$SYSCTL -n dev.cpu.$i.temperature | cut -f 1 -d .`
    if test $i -gt $MAX_SYS; then
      MAX_SYS=$i
    fi
    i=`expr $i + 1`
  done
}

throttle()
{
  /usr/sbin/service powerd stop
  $SYSCTL dev.cpu.0.freq=200

  # could also do something with 'rctl' here, if appropriate

}

release()
{
  /usr/sbin/service powerd start
}

setcomp()
{
  if test $1 -eq 1; then
    throttle
    alert 31
  fi
  if test $1 -eq 0; then
    release
    alert 30
  fi
  MODE1=$1
}

while true
do
  CURTM=`date +%s`

  # get sys data
  if test `expr $HWMTM + $HWMPER` -lt $CURTM; then
    gethwm
    HWMTM=$CURTM
  fi

  NEW_MODE1=-1

  if test $MAX_SYS -ge $MODE1_UTS; then
    NEW_MODE1=1
  fi
  if test $MAX_SYS -le $MODE1_LTS; then
    NEW_MODE1=0
  fi
  if test $NEW_MODE1 -ne -1 -a $NEW_MODE1 -ne $MODE1; then
    setcomp $NEW_MODE1
  fi

  sleep $SLEEPTM
done
 

Phishfry

Beastie's Twin

Reaction score: 2,668
Messages: 5,588

96C is much too hot. You definatly have a problem. You are very near thermal trip and should be around 80C-85C max.
Places to start:
Desktop-
Check your heatsink for proper seating and thermal grease. Look for airflow restrictions. Do not place things around your PC.

Laptop-
Check your heatsink for lint and carpet fibers. These get sucked up and can reduce airflow.

General: ACPI handles the speed of the PWM fans. ACPI has been known to cause problems on some systems.

Perhaps you could try turning off HyperThreading in the BIOS in addition to TurboBoost.
 

Alain De Vos

Daemon

Reaction score: 648
Messages: 2,168

Currently compiling 4 parallel ports. My desktop PC has a CPU temperature of ,
Code:
dev.cpu.0.temperature: 64.0C
 

Alain De Vos

Daemon

Reaction score: 648
Messages: 2,168

8-cores,on all cpu's,3.4Ghz
Code:
dev.cpu.7.temperature: 61.0C
dev.cpu.6.temperature: 61.0C
dev.cpu.5.temperature: 58.0C
dev.cpu.4.temperature: 58.0C
dev.cpu.3.temperature: 58.0C
dev.cpu.2.temperature: 63.0C
dev.cpu.1.temperature: 63.0C
dev.cpu.0.temperature: 63.0C
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,324
Messages: 38,841

With older systems the thermal paste may have dried out, this results in really bad heat conductivity. This can happen with both desktops and laptops. Laptops are a bit more prone to this though. Take it apart, clean out the dust bunnies, take off the heat sinks, clean up and apply new thermal paste.
 

Trihexagonal

Son of Beastie

Reaction score: 2,424
Messages: 2,946

$ sysctl -a grep temperature
Code:
hw.acpi.thermal.tz0.temperature: 94,1C
dev.cpu.3.temperature: 96,0C
dev.cpu.2.temperature: 96,0C
dev.cpu.1.temperature: 92,0C
dev.cpu.0.temperature: 92,0C
$
That's still within my safe zone. 100.0C is when you get the console message and beep saying it's too hot and getting ready to shut down.

All my machines are Win7 era Thinkpads except for an Acer/Gateway clone. I need to take them all apart, make sure they're clean and go from there.

If I don't use my oPolar gaming fan when compiling ports all but my W520's will overheat and shut down. I'm already aware of it so I do one at a time with the one fan I have and that's enough to cool it off.

This W520 with Intel Quad Core i7-2760QM @ 2.40GHz is at 51C with a youtube video playing in another tab. I vacuumed the exhaust vent on one T61 and it will run an onboard video at full-screen 2 hours and not overheat.

None of them shut down watching a youtube video.
 
OP
T

teo

Aspiring Daemon

Reaction score: 39
Messages: 692

FreeBSD does not control the temperature automatically that in system without activity is above 40.C, and with activity it shoots above 60 to 70 .C temperature, it does not control the excessive use of the frequency automatically that at the minimum of activity like watching a video it reaches 70 or 80% of the cores, and compiling some small package has reached its top of 97% the use of the cores automatically shutting down the computer and the life of the computer, FreeBSD ended up killing my Notebook.
 

Vull

Aspiring Daemon

Reaction score: 447
Messages: 741

Nor in the old ones, because my Notebook was about 11 years old.
Eleven years? That's a lot of sugar for a dime. I once got about 12 years out of a Dell Dimension, but that was a heavy-duty tower configuration. How many years do you expect to get out of a notebook/laptop?

What was that make and model again?

Edited to add: Did you do any preventative maintenance like SirDice mentioned in post #17 above?
 
Top