Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Daemon to set scaling_max_freq according to CPU temperature
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Fri Jul 26, 2024 9:11 am    Post subject: Reply with quote

Thanks!

I know that trick but didn't want to make people do extra things.

Anyways, here's the wgetpaste, if that's preferable for somebody: https://bpa.st/raw/J36A

Pay attention, this is not the same link generated by wgetpaste. The same link would return html, you need it raw, hence the /raw/ part in the link.

For convenience, here's the command:

Code:
curl -s https://bpa.st/raw/J36A | base64 -d | zstd -kd


Pipe it to whatever you like.

Best Regards,
Georgi
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Fri Jul 26, 2024 3:06 pm    Post subject: Reply with quote

Thanks for your efforts to share the logs, the last link from bpa.st worked.

I think i found the cause of the problem, some snippets from your log:
Code:

1: 08:43:58.392651: cputemp2maxfreq.c:157: main: Data: 81750 80000 4463000 4263000 3942603
1: 08:43:58.392659: cputemp2maxfreq.c:193: main: Decrease to 4163000
1: 08:43:58.392673: cpufreq.c:31: cpufreq_set_str: Set scaling_max_freq to 4163000
(... more logs, next poll interval ...)
1: 08:44:08.719813: cputemp2maxfreq.c:157: main: Data: 79875 80000 4463000 4163000 3762337
1: 08:44:08.719822: cputemp2maxfreq.c:170: main: Increase to 4163000
1: 08:44:08.719838: cpufreq.c:31: cpufreq_set_str: Set scaling_max_freq to 4163000
(... more logs, next poll interval ...)
1: 08:44:19.044787: cputemp2maxfreq.c:157: main: Data: 79250 80000 4463000 4163000 3792900
1: 08:44:19.044795: cputemp2maxfreq.c:170: main: Increase to 4163000
1: 08:44:19.044807: cpufreq.c:31: cpufreq_set_str: Set scaling_max_freq to 4163000

Those are two "increases" that don't do anything. The first two numbers on the Data: lines are the CPU temperature and the value set with -t (80 degrees celsius), and as you can see the CPU temperature is lower (which triggers the increase) but by a very small margin.

This is what happens in my code:
Code:

  if ((cpudata.cur_temp<config.max_temp) && (cpudata.scale_max<cpudata.max_freq))
  {
   diff=(config.max_temp-cpudata.cur_temp)/1000;
   newfreq=cpudata.scale_max+(config.freq_step*diff);

You see the check on the first line, which triggers the increase, then a diff is calculated and devided by 1000 to get the difference in celcius instead of millicelcius. So for the last occourence this means the diff is 80000-79250 = 750, devided by 1000 this gets rounded to 0. Then the actual increase is calculated by multiplying this with the stepsize, which always results in 0, and this is added to the current maximum frequency ... which of course doesn't change.

Then you might wonder why I didn't have this issue before ... well, my CPU reports full degrees celsius only, so it's always 43000 44000 etc.

This should be easy to fix :)
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com


Last edited by pa4wdh on Fri Jul 26, 2024 5:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Fri Jul 26, 2024 4:00 pm    Post subject: Reply with quote

I'm glad I was able to tackle an insignificant bug :D

Keep up the good work, that small piece of code seems to be of inversely proportional value to its size!

Best Regards,
Georgi
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Fri Jul 26, 2024 5:14 pm    Post subject: Reply with quote

I'm actually a bit surprised by your attention for this code, i wrote it a year ago and nobody seemed to care :).

The repo at https://code.pa4wdh.nl.eu.org/tools/cputemp2maxfreq/tree/ contains a fixed version now, are you able to do a test-run with that? My hardware behaves different than yours to i can't really test.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Fri Jul 26, 2024 5:38 pm    Post subject: Reply with quote

pa4wdh wrote:
I'm actually a bit surprised by your attention for this code, i wrote it a year ago and nobody seemed to care :).


Well, I remember your thread. I may have missed the post you announced you've written it or not, I don't remember, but I most certainly come up with the idea that it may rid me of the need to manually switch power profiles only after seeing the most recent posts.

pa4wdh wrote:
The repo at https://code.pa4wdh.nl.eu.org/tools/cputemp2maxfreq/tree/ contains a fixed version now, are you able to do a test-run with that? My hardware behaves different than yours to i can't really test.


I have a Ryzen 7 5800H in a Lenovo Legion 5 Pro gaming laptop which I bought not to play games but for Gentoo :D

I tested it compiling the kernel and it doesn't do that, but it doesn't seem to be that kind of load either. LLVM/clang and Firefox allowed for maximum frequency and it was happening at it.

I'll test more it as soon as something big gets updated. Last time I tested ti with llvm/clang and gathered logs with firefox.

However I believe that if you've found the logic behind the issue, it should be fixed.

Best Regards,
Georgi
Back to top
View user's profile Send private message
NichtDerHans
Apprentice
Apprentice


Joined: 27 Jan 2023
Posts: 173

PostPosted: Fri Jul 26, 2024 6:16 pm    Post subject: Reply with quote

pa4wdh wrote:
I've made a new (0.4) version of the daemon which includes a parameter to manually set the transition delay.
@NichtDerHans: This should help with you setup. Valid values are 0...100000, 50000 should be a safe first try. When it's too low you'll see it exit immediately (just like it did now), and increase by 10000 until it works.


Thank you for the fix. It works now. :D
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Fri Jul 26, 2024 7:40 pm    Post subject: Reply with quote

@logrusx:
If you just need to have some load to heat up your CPU for testing purposes i always use:
Code:
dd if=/dev/urandom of=/dev/null bs=1024k &

and start that as many times as you have cores, it heats my CPU up in a matter of minuites :-). If you're done just use killall dd to stop them all.

@NichtDerHans:
Good to hear, what value for the transition latency are you using?
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Fri Jul 26, 2024 8:03 pm    Post subject: Reply with quote

pa4wdh wrote:
@logrusx:
If you just need to have some load to heat up your CPU for testing purposes i always use:
Code:
dd if=/dev/urandom of=/dev/null bs=1024k &

and start that as many times as you have cores, it heats my CPU up in a matter of minuites :-). If you're done just use killall dd to stop them all.

@NichtDerHans:
Good to hear, what value for the transition latency are you using?


While that might be a very effecient method, I think it exhausts entropy and might not be a very good idea to do it if you use encryption. Also if you run out of entropy, it'll become very inefficient.

I need not very evenly distributed load, the kind of load gcc or clang make when they are processing large compilation units. This gives time for the CPU to cool off and allows for the threshold to return back to max freq.

Don't worry, there sure will be a suitable package soon but I'm not in a hurry as I believe if you understood the problem, then it must be fixed. After all this is not some kind of a very complicated system.

EDIT: I started a firefox rebuild and I can confidently say I don't observe the problematic behavior. Another thing I noticed which might be a subjective experience is it seems to keep the temperature more stable.

Best Regards,
Georgi
Back to top
View user's profile Send private message
NichtDerHans
Apprentice
Apprentice


Joined: 27 Jan 2023
Posts: 173

PostPosted: Fri Jul 26, 2024 8:26 pm    Post subject: Reply with quote

pa4wdh wrote:
@logrusx:
If you just need to have some load to heat up your CPU for testing purposes i always use:
Code:
dd if=/dev/urandom of=/dev/null bs=1024k &

and start that as many times as you have cores, it heats my CPU up in a matter of minuites :-). If you're done just use killall dd to stop them all.

@NichtDerHans:
Good to hear, what value for the transition latency are you using?


50000 from your tip. But in a 3 seconds interval.

If i write in to a cvs logfile with unix timestamps, the logfile is not updated.

Code:
./cputemp2maxfreq -t 60 -g powersave -d 50000 -c log.csv -u -p 3
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Fri Jul 26, 2024 8:27 pm    Post subject: Reply with quote

logrusx wrote:

While that might be a very effecient method, I think it exhausts entropy and might not be a very good idea to do it if you use encryption. Also if you run out of entropy, it'll become very inefficient.

Of course this is just for testing purposes, it's not meant to be run for a long time. Nowadays It's quite hard to exhaust /dev/urandom, I've run the same on a 12 core Xeon CPU without problems.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Sun Jul 28, 2024 7:12 am    Post subject: Reply with quote

@logrusx:
I've been able to test it myself. I pointed the temperature input to a real file on my filesystem, allowing me to feed it any abitrary value by writing it to the file. It behaved as i intended :), I wasn't sure about negative numbers.

@NichtDerHans:
The CSV file is closed when the daemon exits, so reading the file while it's running may give wrong results due to buffering. I'll see if i can add a flush to improve that.


I also have a question regarding the temperature input, which is now fixed to /sys/devices/virtual/thermal/thermal_zone0/temp.
I found that in /sys/devices/platform/coretemp.0 the right temperature input to use has the label "Package id 0", is that the same for everybody? That would allow autodetection of the correct sensor, which also helps if the numbers change for whatever reason.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Sun Jul 28, 2024 1:11 pm    Post subject: Reply with quote

Coretemp sound like Intel. If that the way it detects /sys/devices/virtual/thermal/thermal_zone0/temp as input, that does nothing for me and I guess everything not Intel.

I'll check later when I get back home.

Best Regards,
Georgi
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Sun Jul 28, 2024 1:41 pm    Post subject: Reply with quote

coretemp is indeed intel specific.

I made a first attempt at autodetection, searching for the label "Package id 0", but i can of course add others too.
Maybe you can run this to find any labels and see if the right one is listed:
Code:
find -L /sys/class/hwmon -maxdepth 2 -name "temp*_label" | xargs cat

(You can ignore the loop detected errors find will report)

Edit:
Some drivers don't use labels and expose a single temperature reading, for those cases use:
Code:
find -L /sys/class/hwmon -maxdepth 2 -name "name" | xargs cat

_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Sun Jul 28, 2024 5:42 pm    Post subject: Reply with quote

pa4wdh wrote:
coretemp is indeed intel specific.

I made a first attempt at autodetection, searching for the label "Package id 0", but i can of course add others too.
Maybe you can run this to find any labels and see if the right one is listed:
Code:
find -L /sys/class/hwmon -maxdepth 2 -name "temp*_label" | xargs cat

(You can ignore the loop detected errors find will report)


Code:
# find -L /sys/class/hwmon -maxdepth 2 -name "temp*_label" | xargs cat
find: File system loop detected; ‘/sys/class/hwmon/hwmon4/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon2/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon0/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon5/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon3/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon1/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
Tdie
Tctl
edge
Composite
Sensor 1
Sensor 2


pa4wdh wrote:
Edit:
Some drivers don't use labels and expose a single temperature reading, for those cases use:
Code:
find -L /sys/class/hwmon -maxdepth 2 -name "name" | xargs cat

Code:
# find -L /sys/class/hwmon -maxdepth 2 -name "name" | xargs cat
find: File system loop detected; ‘/sys/class/hwmon/hwmon4/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon2/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon0/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon5/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon3/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon1/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
zenpower
amdgpu
ADP0
iwlwifi_1
nvme
BAT0


/sys/devices/virtual/thermal/thermal_zone0/temp is irrelevant for me. It reports something else that's not even close to CPU temperature. When the CPU was nearing 90 degrees C it was showing 35000.

I forgot to mention I'm using zenpower3 which is an out of tree module. I can try with k10temp too later.

Best Regards,
Georgi
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Sun Jul 28, 2024 6:16 pm    Post subject: Reply with quote

Thanks for sharing the outputs.

Today i learned that /sys/devices/virtual/thermal/thermal_zone0/temp isn't actually my CPU either, but it's close enough to work :). I now found the real CPU sensor which responds much faster to frequency changes and system load. Smaller step sizes and shorter intervals make more sense which that sensor.

To me Tdie stands out in your output, could that be useful?

Quote:
I forgot to mention I'm using zenpower3 which is an out of tree module. I can try with k10temp too later.

I assume zenpower3 is the "zenpower" from your output. For autodetection i can add zenpower and k10temp (in that order) so zenpower gets priority if it's available.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Sun Jul 28, 2024 6:22 pm    Post subject: Reply with quote

pa4wdh wrote:
Thanks for sharing the outputs.

Today i learned that /sys/devices/virtual/thermal/thermal_zone0/temp isn't actually my CPU either, but it's close enough to work :). I now found the real CPU sensor which responds much faster to frequency changes and system load. Smaller step sizes and shorter intervals make more sense which that sensor.

To me Tdie stands out in your output, could that be useful?


How do I find out?

pa4wdh wrote:
Quote:
I forgot to mention I'm using zenpower3 which is an out of tree module. I can try with k10temp too later.

I assume zenpower3 is the "zenpower" from your output. For autodetection i can add zenpower and k10temp (in that order) so zenpower gets priority if it's available.


k10temp is the official kernel module, maybe it should take priority. Either way whoever wants to use zenpower needs to blacklist k10temp, they can't be used at the same time.

Best Regards,
Georgi
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Sun Jul 28, 2024 7:29 pm    Post subject: Reply with quote

logrusx wrote:
How do I find out?

Check out the temperature reading and see if it makes sense. Vary the load on your CPU and see if the temperature reading responds.

Quote:
k10temp is the official kernel module, maybe it should take priority. Either way whoever wants to use zenpower needs to blacklist k10temp, they can't be used at the same time.

Ok, good to know, if they can't be loaded together the order doesn't matter.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Sun Jul 28, 2024 7:41 pm    Post subject: Reply with quote

pa4wdh wrote:
logrusx wrote:
How do I find out?

Check out the temperature reading and see if it makes sense. Vary the load on your CPU and see if the temperature reading responds.


tDie and tCtl don't seem to differ. At one point I knew what the difference between the two theoretically was, but now I can't remember even where I found that information or what I was searching for.

Tomorrow I'll post information regarding k10temp

Best Regards,
Georgi
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Mon Jul 29, 2024 8:54 am    Post subject: Reply with quote

With k10temp:

Code:
# find -L /sys/class/hwmon -maxdepth 2 -name "temp*_label" | xargs cat
find: File system loop detected; ‘/sys/class/hwmon/hwmon4/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon2/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon0/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon5/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon3/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon1/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
Tctl
edge
Composite
Sensor 1
Sensor 2
# find -L /sys/class/hwmon -maxdepth 2 -name "name" | xargs cat
find: File system loop detected; ‘/sys/class/hwmon/hwmon4/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon2/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon0/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon5/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon3/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
find: File system loop detected; ‘/sys/class/hwmon/hwmon1/subsystem’ is part of the same file system loop as ‘/sys/class/hwmon’.
k10temp
amdgpu
ADP0
iwlwifi_1
nvme
BAT0


It looks like Tctl would be most useful as it's present for both k10temp and zenpower.

There's one mistery however. With both modules unloaded, Freon still shows temperature. Zenmonitor, which is a tool that can read zenpower's measurements still shows all of them. Only Tctl and Tdie labels are missing from the above commands.

I had noticed in the past Freon had continued to work despite me had forgotten rebuilding zenpower after a kernel upgrade but I had forgotten. I don't know where it takes its measurements from...

Best Regards,
Georgi
Back to top
View user's profile Send private message
NichtDerHans
Apprentice
Apprentice


Joined: 27 Jan 2023
Posts: 173

PostPosted: Mon Jul 29, 2024 2:06 pm    Post subject: Reply with quote

Code:

% find -L /sys/class/hwmon -maxdepth 2 -name "temp*_label" | xargs cat
find: File system loop detected; '/sys/class/hwmon/hwmon4/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
find: File system loop detected; '/sys/class/hwmon/hwmon2/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
find: File system loop detected; '/sys/class/hwmon/hwmon0/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
find: File system loop detected; '/sys/class/hwmon/hwmon3/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
find: File system loop detected; '/sys/class/hwmon/hwmon1/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
Core 2
Package id 0
Core 3
Core 0
Core 1
Composite
Sensor 1
Sensor 2



and

Code:

% find -L /sys/class/hwmon -maxdepth 2 -name "name" | xargs cat
find: File system loop detected; '/sys/class/hwmon/hwmon4/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
find: File system loop detected; '/sys/class/hwmon/hwmon2/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
find: File system loop detected; '/sys/class/hwmon/hwmon0/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
find: File system loop detected; '/sys/class/hwmon/hwmon3/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
find: File system loop detected; '/sys/class/hwmon/hwmon1/subsystem' is part of the same file system loop as '/sys/class/hwmon'.
coretemp
BAT0
AC
nvme
acpitz
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Mon Jul 29, 2024 3:28 pm    Post subject: Reply with quote

Thanks for sharing all the info.

@logrusx:
Quote:
tDie and tCtl don't seem to differ. At one point I knew what the difference between the two theoretically was, but now I can't remember even where I found that information or what I was searching for.

Tdie sounds like the temperature for the complete chip, Tctl sounds like some controller, i'd guess a memory controller within the CPU?

Quote:
It looks like Tctl would be most useful as it's present for both k10temp and zenpower.

Sounds like a good candidate indeed, thanks!

Quote:
There's one mistery however. With both modules unloaded, Freon still shows temperature. Zenmonitor, which is a tool that can read zenpower's measurements still shows all of them. Only Tctl and Tdie labels are missing from the above commands.

That's odd. Most sensors are available via some kind of bus (smbus, gpio, i2c), maybe it queries the sensors directly?

@NichtDerHans:
It seems like the "Package id 0" would be the right one for you too.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Mon Jul 29, 2024 3:50 pm    Post subject: Reply with quote

Based on the information posted here i'm now using this for autodetection:
1) First search for a sensor with label "Package id 0" which seems to be generic for intel
2) If that's not available search for Tctl (offered by k10temp but not always available)
3) If that's not available search for driver k10temp which sometimes offers a single temperature reading without a label, seems to be generic AMD

Am i missing something? I skipped zenpower for now since it's out-of-tree.

In case someone wants to test, the repo at https://code.pa4wdh.nl.eu.org/tools/cputemp2maxfreq/tree/ is up to date. I think i'll make it version 0.5 with an ebuild if we don't find anything obvious missing.

Main changes:
- Sensor autodetection
- Flush after writing to the CSV file, which should make it possible to read the file while the daemon is running
- Solved the useless increases
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Mon Jul 29, 2024 8:01 pm    Post subject: Reply with quote

pa4wdh wrote:
Am i missing something? I skipped zenpower for now since it's out-of-tree.


Tctl will work for both I suppose. Maybe there's a difference in the desktop processors, 5800H is only found in laptops.

Best Regards,
Georgi
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 867

PostPosted: Tue Jul 30, 2024 5:16 pm    Post subject: Reply with quote

I just pushed a new version including an ebuild to the repo.

I'm curious to see how it works for you :)

Keep in mind that the -i parameter works different now:
- You can specify an absolute path to a file (which was how it worked before, but that also worked with relative paths, it doesn't do that anymore)
- You can specify a sensor or driver name, like "Package id 0" or "k10temp" (remind to quote if required), this is case insensitive
- The word "auto" for autodetection (default when -i is omitted), this tries to find a sensor named "Package id 0", "Tctl" or "k10temp"
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2155

PostPosted: Tue Jul 30, 2024 5:23 pm    Post subject: Reply with quote

With zenpower:

Code:
# ./cputemp2maxfreq -t 80
2024-07-30 20:21:08: cputemp2maxfreq version 0.5-0b4dcca (master), buildtime Jul 30 2024 18:02:10
2024-07-30 20:21:08: Configuration:
2024-07-30 20:21:08: Governor: conservative
2024-07-30 20:21:08: Temperature: 80000
2024-07-30 20:21:08: Temp input: auto
2024-07-30 20:21:08: Frequency step: 100000
2024-07-30 20:21:08: Fallback frquency: 2000000
2024-07-30 20:21:08: Interval: 10
2024-07-30 20:21:08: Logger: stdout (0x55af18a90dd2)
2024-07-30 20:21:08: Log measurement data: 0
2024-07-30 20:21:08: CSV Log file: Disabled
2024-07-30 20:21:08: Use unix timestamps: 0
2024-07-30 20:21:08: Transition latency: Autodetect
2024-07-30 20:21:08: Starting temperature sensor autodetection
2024-07-30 20:21:08: Detection returned temperature input: /sys/class/hwmon/hwmon4/temp2_input
2024-07-30 20:21:08: Temperature input name: Tctl
2024-07-30 20:21:08: CPU data:
2024-07-30 20:21:08: Minimum frequency: 400000
2024-07-30 20:21:08: Maximum frequency: 4463000
2024-07-30 20:21:08: Scaling maximum frequency: 4463000
2024-07-30 20:21:08: Transition Latency: 20000 (Autodetected)


With k10temp:

Code:
# ./cputemp2maxfreq -t 80
2024-07-30 20:22:43: cputemp2maxfreq version 0.5-0b4dcca (master), buildtime Jul 30 2024 18:02:10
2024-07-30 20:22:43: Configuration:
2024-07-30 20:22:43: Governor: conservative
2024-07-30 20:22:43: Temperature: 80000
2024-07-30 20:22:43: Temp input: auto
2024-07-30 20:22:43: Frequency step: 100000
2024-07-30 20:22:43: Fallback frquency: 2000000
2024-07-30 20:22:43: Interval: 10
2024-07-30 20:22:43: Logger: stdout (0x562feb6ecdd2)
2024-07-30 20:22:43: Log measurement data: 0
2024-07-30 20:22:43: CSV Log file: Disabled
2024-07-30 20:22:43: Use unix timestamps: 0
2024-07-30 20:22:43: Transition latency: Autodetect
2024-07-30 20:22:43: Starting temperature sensor autodetection
2024-07-30 20:22:43: Detection returned temperature input: /sys/class/hwmon/hwmon4/temp1_input
2024-07-30 20:22:43: Temperature input name: Tctl
2024-07-30 20:22:43: CPU data:
2024-07-30 20:22:43: Minimum frequency: 400000
2024-07-30 20:22:43: Maximum frequency: 4463000
2024-07-30 20:22:43: Scaling maximum frequency: 400000
2024-07-30 20:22:43: Transition Latency: 20000 (Autodetected)
2024-07-30 20:22:43: Increase scaling_max_freq to 4400000


I'm not sure where the difference in temp1/2_input comes from. I'm not very savvy with those things.

When I have something to build I'll report on how it behaves.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum