LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to read CPU temp from /sys, what to think of it (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-read-cpu-temp-from-sys-what-to-think-of-it-4175631534/)

X-LFS-2010 06-08-2018 06:50 PM

how to read CPU temp from /sys, what to think of it
 
core i5 (locked, non-o.c. version), msi, z710 chipset

https://www.kernel.org/doc/Documenta...ysfs-interface

/sys/devices/platform/coretemp.0/hwmo/hwmon0/temp?_input

i compiled in powersave governor and every last intel support i could find so that would work (acpi, apm, pch, ich, i2c, blah - intel supports). my cpus were running at ~ 74 deg F but /proc/cpuinfo sayd "3.2 GHz" freq. (likely wrong)

temp?_crit says 100 deg C crit, 84 C max: but intel says the max is 80 deg C TJmax. 100 C is 212 deg F, 80C is 176 deg). but /sys/modules/coretemp/parameters/tjmax says 0 (ex, not 80000). it's possible 84C is stored in chip as TJmax, but i doubt 100C is. but i really don't know.

i loaded acpi-cpufreq and now see 800 MHz in /proc/cpuinfo. the 800 thing i found acpi-cpufreq is my "scaling_driver" and i can set governor in /sys/devices/system/cpu/cpufreq/policy?/

i've been compiling kernels. temp appears to change 2 C change only in 2 processors only, but in 'performace mode' see a 25C to 36C (9 C change) using.

my processor is "locked", however i have no idea if that doesn't mean i can't destroy it if i try hard ? :)

I'm hoping someone knows what i'm doing wrong / how to read the temps "correctly" from /sys

---------------------

i have a locked processor i'd be surprised if i found out it "isn't really locked". comment on that if you know any way i could destroy this cpu please.

(forget saying yast/aptget cpufreq doesn't cut it here - i want to verify the value not rely that some software version doesn't know lk-4.16.x changes right? temp isn't something i want to leave as maybe broken)

i can guess if TCC 80C (when cpu ajusts it's own freq. so it doesn't go over - if not disabled - which i'm unsure of) then linux might say 84C is a "max" (or warning level, failure) (or maybe this chip does 84C when produced). but then i can't guess what 100C is.


the i5 has auto frequency scaling internally, why doesn't /proc/cpuinfo show change unless acpi-cpufreq has "taken over governing" over the cpu afs?

should recompile kernel without the linux governor assuming i5's internal gov will enact itself and be better*?

what remains un-explained is how temp?_crit can say 100C is "limit" while intel and other sources don't mention 212 deg F anywhere

* (if i do there's no way to know what freq is, i won't know if it's "on" or "off", as cpufreq won't compile unless one of it's governors is selected)

business_kid 06-09-2018 03:57 AM

Typical temperatures for CPUs are
Operating ~75C
Critical (by which stage effects on behaviour are usually noticeable) ~120C
TJmax 150 - 200C

These may vary especially with ultra small new tab size. But heat is generated in the core, cooling is external, and sensors in between. So if you have a TJmax of 100C it may be what the sensor is going to report

I wouldn't bother reading specs, but keep the operating temperature in double figures. What you read as TJmax could also be critical temperature.

ondoho 06-09-2018 04:25 AM

less for intel CPUs:
Code:

cat /sys/devices/platform/coretemp.0/hwmon/hwmon?/temp*
100000
0
25000
Package id 0
80000
100000
0
25000
Core 0
80000
100000
0
24000
Core 1
80000


AwesomeMachine 06-09-2018 05:46 AM

The programs you use to output temp are reading it from /sys. So, they really 'do' know. You don't know how to read the sys values. Many times the value in sys is the arithmetic difference between the current condition and the maximum permissible. So, you need to read the module documentation in order to know what you're doing directly reading the sys file system.

I would just install lm-sensors. Run sensors-detect, and then run sensors. It will do all the translations for you, and output just what you want.

X-LFS-2010 06-14-2018 04:22 AM

yes, the Intel documentation does say TJmax is the package temperature (reported by sensors) not internal temperature of the cpu.

and that there are two temps: the case temp and cpu "package" temp

I later booted windows 10 and saw see a 25C to 36C (9 C change) is what the desktop (no software running but the monitor), is pushing.


I'm still not %100 on upper limits but I feel better about 36C not being a problem

the other problem is if Linux-4.16.12 /sys is telling me "target temperatures" or real measurements or estimates

WHY? well Intel docs say the 6500u cannot do separate frequency per processor. and Linux-2.3.x (I bothered to make one) … it's cpufreq says all cpu freq change to the same freq (they fluctuate together - all 4)

that leaves a question for Linux-4.16.12: is it truthful about cpufreq being different on each processor (perhaps newer kernel code does what Intel doc says can't be done?) or is it giving … partially bogus info?

I disagree totally that a Linux hacker should not trust kernel variables in /sys. if a module exports fake variables than it shouldn't even be an experimental option in the kernel. but cpufreq isn't one of those I assume

X-LFS-2010 06-14-2018 04:30 AM

do I trust windows 10 not to cook my 6500u to an earlier than normal demise? PHHH! NO!! not unless Intel wrote the driver :)

business_kid 06-15-2018 01:51 AM

I am surprised to find no 'critical' temperature, as acpi uses that for shutting down due to overheating. Thermally runaway is possible as you approach TJMax. I am also surprised to see TJmax specified at what I would expect to be TJ critical. Where does acpi shut down?

kernelb 05-13-2020 05:00 AM

temperature can be read from /sys/class/thermal interface
go through below link for more details:
http://www.lookup2learn.com/post/the...ement-in-linux

business_kid 05-14-2020 03:26 AM

lm_sensors also reads temperatures and translates it into plain English.Just run 'sensors.'

It's a complicated area.

JeremyBoden 05-14-2020 09:44 AM

Have a look at http://seperohacker.blogspot.com/201...frequency.html which is a script which dynamically alters the frequency at which your CPU runs, in order to limit the maximum temperature of the CPU.

Works well for me - a slightly modified version gets loaded during boot as a background job and runs all day.

ondoho 05-14-2020 03:25 PM

^ don't CPUs and the kernel do that automagically anyhow nowadays?

JeremyBoden 05-14-2020 04:27 PM

Only if you mean that a program that saturates all cores will quite quickly cause a hard shutdown.

ondoho 05-14-2020 04:37 PM

Quote:

Originally Posted by JeremyBoden (Post 6123093)
Only if you mean that a program that saturates all cores will quite quickly cause a hard shutdown.

Not on my machine.

JeremyBoden 05-15-2020 08:59 AM

Video transcoding on my 4 core, 3.8GHz PC desktop tries to run many threads until some internal heat sensor pulls the plug.
Perhaps a laptop would be different?

So I run a script to vary the frequency, depending on the temperature.
Frequencies can be found in
Code:

/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq

CPU temperature (on my machine) can be found in /sys/class/hwmon/hwmon1/temp1_input

It would be nice if I could tell the kernel to run my CPU at some moderate temperature, since excessive temperature is going to reduce the life of an expensive component.
Currently, I don't let my CPU exceed 65 degrees. :)

ondoho 05-16-2020 02:53 AM

^ funny, I just spent an intense week transcoding most of my videos to smaller chunks, running all 4 threads on 99% for hours and hours, for days and days.
Conky shows CPU temperature, usage and frequency.
When it gets too hot the frequency scales down.
This is an MSI mobo with an Intel CPU (i3-6100 iirc).
Code:

uname -rmv
5.4.39-1-lts #1 SMP Wed, 06 May 2020 17:32:42 +0000 x86_64



All times are GMT -5. The time now is 07:48 AM.