LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-08-2018, 06:50 PM   #1
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 510

Rep: Reputation: 58
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)

Last edited by X-LFS-2010; 06-08-2018 at 09:31 PM.
 
Old 06-09-2018, 03:57 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,376

Rep: Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336
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.
 
Old 06-09-2018, 04:25 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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
 
Old 06-09-2018, 05:46 AM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
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.
 
Old 06-14-2018, 04:22 AM   #5
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 510

Original Poster
Rep: Reputation: 58
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

Last edited by X-LFS-2010; 06-14-2018 at 04:28 AM.
 
Old 06-14-2018, 04:30 AM   #6
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 510

Original Poster
Rep: Reputation: 58
do I trust windows 10 not to cook my 6500u to an earlier than normal demise? PHHH! NO!! not unless Intel wrote the driver
 
Old 06-15-2018, 01:51 AM   #7
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,376

Rep: Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336
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?
 
Old 05-13-2020, 05:00 AM   #8
kernelb
LQ Newbie
 
Registered: Nov 2019
Posts: 2

Rep: Reputation: Disabled
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
 
Old 05-14-2020, 03:26 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,376

Rep: Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336Reputation: 2336
lm_sensors also reads temperatures and translates it into plain English.Just run 'sensors.'

It's a complicated area.
 
Old 05-14-2020, 09:44 AM   #10
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
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.
 
Old 05-14-2020, 03:25 PM   #11
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ don't CPUs and the kernel do that automagically anyhow nowadays?
 
Old 05-14-2020, 04:27 PM   #12
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Only if you mean that a program that saturates all cores will quite quickly cause a hard shutdown.
 
Old 05-14-2020, 04:37 PM   #13
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by JeremyBoden View Post
Only if you mean that a program that saturates all cores will quite quickly cause a hard shutdown.
Not on my machine.
 
Old 05-15-2020, 08:59 AM   #14
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
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.
 
Old 05-16-2020, 02:53 AM   #15
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ 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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CPU Temp in /sys/bus/acpi/devices/LNXTHERM:00/thermal_zone homebrew1075 Linux - General 1 11-24-2011 05:30 AM
lm_sensors cpu temp v.slightly different to MOBO temp on Intel D865GLC sc_3007 Linux - Hardware 5 11-13-2009 12:17 PM
CPU Temp Pedroski Linux - Hardware 1 12-02-2007 11:04 AM
lfs 5.0 Creating the temp sys {Installing Tcl-8.4.4} x3m.seth Linux From Scratch 0 11-12-2003 09:13 PM
cpu temp zaman Linux - Hardware 21 07-17-2003 10:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration