View previous topic :: View next topic |
Author |
Message |
The_Document Apprentice
Joined: 03 Feb 2018 Posts: 275
|
Posted: Tue Mar 20, 2018 5:30 am Post subject: AMDGPU power monitoring |
|
|
Does anybody know of an app which can output gpu power usage in watts for AMDGPU hardware? LM-Sensors only returns CPU power usage. |
|
Back to top |
|
|
audiodef Watchman
Joined: 06 Jul 2005 Posts: 6656 Location: The soundosphere
|
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3751 Location: Rasi, Finland
|
Posted: Tue Mar 20, 2018 1:03 pm Post subject: |
|
|
I doubt it has the capability (yet).
But it seems that ROCm may give us that. _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
The_Document Apprentice
Joined: 03 Feb 2018 Posts: 275
|
Posted: Tue Mar 20, 2018 8:53 pm Post subject: |
|
|
audiodef wrote: | I wonder if there's a Gkrellm module for this. I know it has a module for giving you the GPU temp, maybe it can give you power usage as well. |
I found out how it is in
/sys/kernel/debug/dri/0/amdgpu_pm_info
but cannot find out how to grant ordinary users permission to read it. Can it even be done?
What is sad is apparently nobody on stack exchange knows how also, my question:
https://unix.stackexchange.com/questions/432255/grant-user-read-write-permissions-for-files-in-sys
perhaps "gentoo people" are more knowledgeable then they. |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3751 Location: Rasi, Finland
|
Posted: Tue Mar 20, 2018 10:05 pm Post subject: |
|
|
Well... You can bind-mount the /sys/kernel/debug/dri/0 directory to somewhere else. And then read the files by regular user. I think it poses a security risk as you open some content of debugfs as world readable. Safer would be to first create a subdirectory where only one, otherwise unpriviliged, user can access. Then create the mount point inside that directory. Then it sould be possible to access the data only by root or the newly created user. But please, consider this as a dirty hack. _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
The_Document Apprentice
Joined: 03 Feb 2018 Posts: 275
|
Posted: Tue Mar 20, 2018 10:11 pm Post subject: |
|
|
Zucca wrote: | Well... You can bind-mount the /sys/kernel/debug/dri/0 directory to somewhere else. And then read the files by regular user. I think it poses a security risk as you open some content of debugfs as world readable. Safer would be to first create a subdirectory where only one, otherwise unpriviliged, user can access. Then create the mount point inside that directory. Then it sould be possible to access the data only by root or the newly created user. But please, consider this as a dirty hack. |
Not concerned with security and "gentoo people" turned out more knowledgeable. Will certainly give it a shot. |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3751 Location: Rasi, Finland
|
Posted: Tue Mar 20, 2018 10:55 pm Post subject: |
|
|
If you want to read just one value, I'd probably just poll the file using grep etc on root account and update a file which anyone can read with the value.
If there was a way to "bind-mount" a file it would be maybe the best "hack" I could think of. _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
The_Document Apprentice
Joined: 03 Feb 2018 Posts: 275
|
Posted: Wed Mar 21, 2018 12:35 am Post subject: |
|
|
Zucca wrote: | If you want to read just one value, I'd probably just poll the file using grep etc on root account and update a file which anyone can read with the value.
If there was a way to "bind-mount" a file it would be maybe the best "hack" I could think of. |
I consider it a great workaround because it is doing exactly what I tried to do and I then tried to write an script but failed rc-config list does not list my script which resides in /etc/init.d/ as "apu-monitor" script:
https://paste.pound-python.org/show/stMGb3Tfpi5yxO5xnwSE/
would be neat to get this working. Here is a pic of what I want this for, its a KDE plasmoid on the desktop:
https://image.ibb.co/jGja4c/dd.png |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3751 Location: Rasi, Finland
|
Posted: Wed Mar 21, 2018 12:52 am Post subject: |
|
|
I haven't had a need to write any OpenRC scripts (yet), so I can only guess...
Have you chmod +x it? Code: | depend() {
# (Dependency information)
} | ... might not be correct in syntax. I think functions need to have at least one command inside them or the code isn't valid. Code: | depend() {
true
# (Dependency information)
}
| ... might then help. Maybe best to just comment the whole function?
But why don't you just put it in /etc/fstab?
Also I just read mount man page... wrote: | Code: | Note that the filesystem mount options will remain the same as those on the original mount
point.
mount(8) since v2.27 allows to change the mount options by passing the relevant options along
with --bind. For example:
mount -o bind,ro foo foo
This feature is not supported by the Linux kernel; it is implemented in userspace by an addi‐
tional mount(2) remounting system call. This solution is not atomic.
The alternative (classic) way to create a read-only bind mount is to use the remount operation,
for example:
mount --bind olddir newdir
mount -o remount,bind,ro olddir newdir
Note that a read-only bind will create a read-only mountpoint (VFS entry), but the original
filesystem superblock will still be writable, meaning that the olddir will be writable, but the
newdir will be read-only. |
| You learn something new every day. I didn't knew bind mounts can have different options. You should then consider making yours ro. _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Wed Mar 21, 2018 1:00 am Post subject: |
|
|
That works for me:
Code: | $ cat /sys/kernel/debug/dri/0/amdgpu_pm_info
cat: /sys/kernel/debug/dri/0/amdgpu_pm_info: Permission denied
# touch /tmp/amdgpu_pm_info
# mount --bind -o ro /sys/kernel/debug/dri/0/amdgpu_pm_info /tmp/amdgpu_pm_info
$ cat /tmp/amdgpu_pm_info
Clock Gating Flags Mask: 0x37bcf
Graphics Medium Grain Clock Gating: On
Graphics Medium Grain memory Light Sleep: On
Graphics Coarse Grain Clock Gating: On
Graphics Coarse Grain memory Light Sleep: On
Graphics Coarse Grain Tree Shader Clock Gating: Off
Graphics Coarse Grain Tree Shader Light Sleep: Off
Graphics Command Processor Light Sleep: On
Graphics Run List Controller Light Sleep: On
Graphics 3D Coarse Grain Clock Gating: Off
Graphics 3D Coarse Grain memory Light Sleep: Off
Memory Controller Light Sleep: On
Memory Controller Medium Grain Clock Gating: On
System Direct Memory Access Light Sleep: Off
System Direct Memory Access Medium Grain Clock Gating: On
Bus Interface Medium Grain Clock Gating: Off
Bus Interface Light Sleep: On
Unified Video Decoder Medium Grain Clock Gating: On
Video Compression Engine Medium Grain Clock Gating: On
Host Data Path Light Sleep: Off
Host Data Path Medium Grain Clock Gating: On
Digital Right Management Medium Grain Clock Gating: Off
Digital Right Management Light Sleep: Off
Rom Medium Grain Clock Gating: On
Data Fabric Medium Grain Clock Gating: Off
GFX Clocks and Power:
1500 MHz (MCLK)
228 MHz (SCLK)
4.170 W (VDDC)
4.72 W (VDDCI)
10.124 W (max GPU)
11.115 W (average GPU)
GPU Temperature: 44 C
GPU Load: 94 %
UVD: Enabled
VCE: Disabled |
Seems like this stuff should be accessible in /sys/class/drm/card0/device/hwmon/hwmon*/ though. All I get there is fan speed and temp. I know lm_sensors can handle power meters on the CPU, so that's no excuse for leaving it out. |
|
Back to top |
|
|
The_Document Apprentice
Joined: 03 Feb 2018 Posts: 275
|
Posted: Wed Mar 21, 2018 1:23 am Post subject: |
|
|
Ant P. wrote: | That works for me:
...
Seems like this stuff should be accessible in /sys/class/drm/card0/device/hwmon/hwmon*/ though. All I get there is fan speed and temp. I know lm_sensors can handle power meters on the CPU, so that's no excuse for leaving it out. |
Someone should tell lmsensor people about this. However my initscript still isn't listed. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22746
|
Posted: Wed Mar 21, 2018 1:31 am Post subject: |
|
|
Zucca wrote: | You learn something new every day. | You should wait until tomorrow to read the rest of this post.
Still here? Good: Zucca wrote: | If there was a way to "bind-mount" a file it would be maybe the best "hack" I could think of. |
Code: | mount --bind /etc/passwd /etc/issue ; cat -n /etc/issue ; umount /etc/issue |
|
|
Back to top |
|
|
The_Document Apprentice
Joined: 03 Feb 2018 Posts: 275
|
Posted: Wed Mar 21, 2018 1:49 am Post subject: |
|
|
Hu wrote: | Zucca wrote: | You learn something new every day. | You should wait until tomorrow to read the rest of this post.
Still here? Good: Zucca wrote: | If there was a way to "bind-mount" a file it would be maybe the best "hack" I could think of. |
Code: | mount --bind /etc/passwd /etc/issue ; cat -n /etc/issue ; umount /etc/issue |
|
I don't need fancy mount options, what I have is just fine, all I needed to do was to make the script executable. However its not mounting because Im sure I didn't adhere to rc syntax. Weird because it doesn't output any errors when doing rc-config start apu-monitor |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3751 Location: Rasi, Finland
|
Posted: Wed Mar 21, 2018 7:34 am Post subject: |
|
|
Oooh... I'm having a steep learning curve at the moment.
_________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
|