Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

radeontop - non-root access #61

Closed
fermulator opened this issue May 22, 2018 · 12 comments
Closed

radeontop - non-root access #61

fermulator opened this issue May 22, 2018 · 12 comments

Comments

@fermulator
Copy link

fermulator commented May 22, 2018

As per #51 , a community contributor (@franglais125) was adding support for GPU monitoring directly in gnome system monitor (awesome!) - nVidia support was added, but AMD not yet;

radeontop was proven capable to query + parse the necessary information there, however, the problem is that it required root privs.

A comment from @clbr in #51 (comment), indicates:

Root rights are not required if your kernel is new enough, libdrm is new enough, and your user has access to the DRM node. If you tried to run radeontop without a Radeon card, it would fail to find one in DRM, and assume it needed the root path - even if your system otherwise was set up for non-root access.

More details? I'm on latest Ubuntu 18.04 just recently, and still radeontop isn't ready for non-root usage.

$ radeontop
Cannot access GPU registers, are you root?

(if we run as root of course it works)

$ uname -a
Linux fermmy 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ dpkg --list | grep libdrm | awk '{print $1,$2, $3}'
ii libdrm-amdgpu1:amd64 2.4.91-2
ii libdrm-amdgpu1:i386 2.4.91-2
ii libdrm-common 2.4.91-2
ii libdrm-dev:amd64 2.4.91-2
ii libdrm-intel1:amd64 2.4.91-2
ii libdrm-intel1:i386 2.4.91-2
rc libdrm-nouveau1a:amd64 2.4.52-1~precise2
rc libdrm-nouveau1a:i386 2.4.52-1~precise2
ii libdrm-nouveau2:amd64 2.4.91-2
ii libdrm-nouveau2:i386 2.4.91-2
ii libdrm-radeon1:amd64 2.4.91-2
ii libdrm-radeon1:i386 2.4.91-2
ii libdrm2:amd64 2.4.91-2
ii libdrm2:i386 2.4.91-2

How to access "DRM node"?

@clbr
Copy link
Owner

clbr commented May 22, 2018

The DRM node is /dev/dri/card0 on systems with just one GPU. Otherwise the number might be something else.

I don't have the required kernel/libdrm versions at hand, but Ubuntu 18.04 is certainly new enough. I believe the issue for you is that your card is new; only the "radeon" cards currently support non-root querying, your RX card is an "amdgpu" card. That support is in a pull request with some issues, nobody is working on it, and I have no such cards either.

@Fatmice
Copy link

Fatmice commented Apr 3, 2019

Hello, I'm using Fedora 29, my graphic card is a Sapphire Radeon RX Vega 64

unam -a
Linux yellowtrain 5.0.4-200.fc29.x86_64 #1 SMP Mon Mar 25 02:27:33 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

sudo dnf list --installed *drm*
libdrm.x86_64                                                          2.4.97-1.fc29

ls -la /dev/dri
total 0
drwxr-xr-x.  3 root root        100 Mar 30 02:02 .
drwxr-xr-x. 21 root root       4840 Mar 30 23:13 ..
drwxr-xr-x.  2 root root         80 Mar 30 02:02 by-path
crw-rw----+  1 root video  226,   0 Apr  2 20:39 card0
crw-rw-rw-.  1 root render 226, 128 Mar 30 02:02 renderD128

lspci -vnn
45:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Vega 10 XL/XT [Radeon RX Vega 56/64] [1002:687f] (rev c1) (prog-if 00 [VGA controller])
	Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] RX Vega64 [1002:0b36]
	Flags: bus master, fast devsel, latency 0, IRQ 99, NUMA node 1
	Memory at 80000000 (64-bit, prefetchable) [size=256M]
	Memory at 90000000 (64-bit, prefetchable) [size=2M]
	I/O ports at 3000 [size=256]
	Memory at 9f200000 (32-bit, non-prefetchable) [size=512K]
	Expansion ROM at 000c0000 [disabled] [size=128K]
	Capabilities: <access denied>
	Kernel driver in use: amdgpu
	Kernel modules: amdgpu
45:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Vega 10 HDMI Audio [Radeon Vega 56/64] [1002:aaf8]
	Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Vega 10 HDMI Audio [Radeon Vega 56/64] [1002:aaf8]
	Flags: bus master, fast devsel, latency 0, IRQ 155, NUMA node 1
	Memory at 9f2a0000 (32-bit, non-prefetchable) [size=16K]
	Capabilities: <access denied>
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel

I also get the same message when running the command without sudo

$ radeontop
Cannot access GPU registers, are you root?

How can I run the command without sudo? Do I need to configure selinux to allow radeontop to read /dev/drm and /dev/mem? Something like this? or This?

@clbr
Copy link
Owner

clbr commented Apr 3, 2019

Your card is also an amdgpu card, and that situation hasn't changed unfortunately. I suppose giving your user read access to /dev/mem would work, but that'd be horribly insecure.

@Fatmice
Copy link

Fatmice commented Apr 3, 2019

Thanks for answering. Running with sudo gives this

Failed to open DRM node, no VRAM support.
Collecting data, please wait....

before it launches something that looks like an ncurses GUI
https://streamable.com/xp92n
So at least it works with sudo albeit with some worrying messages.

@clbr
Copy link
Owner

clbr commented Aug 1, 2019

Non-root access for amdgpu might work in current git, please try.

@mark9064
Copy link

mark9064 commented Aug 2, 2019

With the amdgpu-pro stack, non-root seems to be working (built v1.2-8-g09d8c0b)

@MauroMombelli
Copy link

amdgpu 19.0.1-1 non-root access does not seems to work, im part of the group video and
crw-rw----+ 1 root video 226, 0 Sep 23 00:09 card0

@Bengt
Copy link
Contributor

Bengt commented Oct 19, 2019

For my RX Vega 64s, non-root access does indeed work using amdgpu 19.0.1-1 under Ubuntu 18.04.

$ groups
docker adm tty uucp dialout cdrom sudo dip video plugdev lpadmin sambashare

I upgraded my kernel using ukuu, though:

$ uname -a
Linux bengt-desktop 5.2.14-050214-generic #201909101030 SMP Tue Sep 10 10:33:06 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

@Bengt
Copy link
Contributor

Bengt commented Oct 19, 2019

The README currently states:

Requires access to /dev/dri/cardN files or /dev/mem (root privileges).

Should we add a link from the README to this issue for more details to users to whom running as root is an inacceptable limitation?

@clbr
Copy link
Owner

clbr commented Oct 19, 2019 via email

@luyatshimbalanga
Copy link
Contributor

I confirm the support of non-root access using the 20191001 git snapshot.

Hello, I'm using Fedora 29, my graphic card is a Sapphire Radeon RX Vega 64

unam -a
Linux yellowtrain 5.0.4-200.fc29.x86_64 #1 SMP Mon Mar 25 02:27:33 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

sudo dnf list --installed *drm*
libdrm.x86_64                                                          2.4.97-1.fc29

ls -la /dev/dri
total 0
drwxr-xr-x.  3 root root        100 Mar 30 02:02 .
drwxr-xr-x. 21 root root       4840 Mar 30 23:13 ..
drwxr-xr-x.  2 root root         80 Mar 30 02:02 by-path
crw-rw----+  1 root video  226,   0 Apr  2 20:39 card0
crw-rw-rw-.  1 root render 226, 128 Mar 30 02:02 renderD128

lspci -vnn
45:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Vega 10 XL/XT [Radeon RX Vega 56/64] [1002:687f] (rev c1) (prog-if 00 [VGA controller])
	Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] RX Vega64 [1002:0b36]
	Flags: bus master, fast devsel, latency 0, IRQ 99, NUMA node 1
	Memory at 80000000 (64-bit, prefetchable) [size=256M]
	Memory at 90000000 (64-bit, prefetchable) [size=2M]
	I/O ports at 3000 [size=256]
	Memory at 9f200000 (32-bit, non-prefetchable) [size=512K]
	Expansion ROM at 000c0000 [disabled] [size=128K]
	Capabilities: <access denied>
	Kernel driver in use: amdgpu
	Kernel modules: amdgpu
45:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Vega 10 HDMI Audio [Radeon Vega 56/64] [1002:aaf8]
	Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Vega 10 HDMI Audio [Radeon Vega 56/64] [1002:aaf8]
	Flags: bus master, fast devsel, latency 0, IRQ 155, NUMA node 1
	Memory at 9f2a0000 (32-bit, non-prefetchable) [size=16K]
	Capabilities: <access denied>
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel

I also get the same message when running the command without sudo

$ radeontop
Cannot access GPU registers, are you root?

How can I run the command without sudo? Do I need to configure selinux to allow radeontop to read /dev/drm and /dev/mem? Something like this? or This?

@rdmello
Copy link

rdmello commented Oct 10, 2020

Hi, I just tried building the current git master branch of radeontop on Ubuntu 20.04 to get it to run without root access, and it is now working fine for my GPU (AMD Radeon RX5700 XT) without needing to run sudo. Thanks for adding support for this.

@clbr clbr closed this as completed Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants