You are not logged in.

#1 2023-06-25 10:11:06

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Laptop always using discrete GPU even when idle

I have an MSI Laptop with a Ryzen 5 5600H APU and an RX5500M GPU. Until recently, the laptop was using hybrid graphics to switch between the iGPU and dGPU only when necessary.
However, after a system update and me messing around with the boot folder, the laptop seems to be using the iGPU for normal applications but the dGPU is also drawing power as can be confirmed from utilities and the orange light on the power button, which means the same. Battery life has decreased by around 2.5 hours since then. However, on Windows, everything works fine with the graphics switching. I have tried downgrading the kernel, mesa and xf86-video-amdgpu packages but to no avail.

journalctl -x -b -p 3 output:

Jun 25 15:14:19 CraftyWiz bluetoothd[471]: src/plugin.c:plugin_init() Failed to init vcp plugin
Jun 25 15:14:19 CraftyWiz bluetoothd[471]: src/plugin.c:plugin_init() Failed to init mcp plugin
Jun 25 15:14:19 CraftyWiz bluetoothd[471]: src/plugin.c:plugin_init() Failed to init bap plugin
Jun 25 15:14:26 CraftyWiz sddm-helper[718]: gkr-pam: unable to locate daemon control file
Jun 25 15:14:29 CraftyWiz wpa_supplicant[630]: bgscan simple: Failed to enable signal strength monitoring

lspci -k output

Offline

#2 2023-06-25 13:25:02

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

Please post your complete system journal for the boot:

sudo journalctl -b | curl -F 'f:1=<-' ix.io

Please post your Xorg log, https://wiki.archlinux.org/title/Xorg#General
And generally (try to) remove xf86-video-amdgpu

Offline

#3 2023-06-25 14:19:54

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

journal

Xorg log

Should I remove xf86-video-amdgpu now?

Offline

#4 2023-06-25 14:27:57

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

You should remove all xf86-video-* packages.

[ 20282.224] (==) Log file: "/home/crafter/.local/share/xorg/Xorg.1.log", Time: Thu Sep  1 08:08:17 2022

The xorg log is dated and doesn't fit the lspci you posted. There's only one

[ 20282.229] (II) systemd-logind: got fd for /dev/dri/card0 226:0 fd 13 paused 0
[ 20282.231] (--) PCI:*(4@0:0:0) 1002:15d8:1028:0a12 rev 194, Mem @ 0xb0000000/268435456, 0xc0000000/2097152, 0xc0900000/524288, I/O @ 0x00001000/256

which doesn't show up in the lspci at all.

Look at the file timestamps and usually it's gonna be some *.0.log

Edit, from teh journal

Jun 25 19:44:38 CraftyWiz kernel: amdgpu 0000:03:00.0: [drm] Cannot find any crtc or sizes

The only outputs are attached to the Cezanne chip which will likely outperform the RX 5500M anyway - can you completely disable the latter in the BIOS?

Last edited by seth (2023-06-25 14:34:33)

Offline

#5 2023-06-25 18:24:09

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

New Xorg log

Which one is the Cezanne chip? I have an RX5500M with 4GB VRAM and the integrated GPU with 512MB VRAM. I don't think there's a way to disable the dGPU in the BIOS of my laptop (which is MUXless)

Offline

#6 2023-06-25 18:50:41

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

The Cezanne is the iGP

You're running on

[     5.858] (--) PCI:*(7@0:0:0) 1002:1638:1462:130e rev 198, Mem @ 0xff20000000/268435456, 0xff30000000/2097152, 0xfcb00000/524288, I/O @ 0x0000e000/256

which is

07:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] (rev c6)
03:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 14 [Radeon RX 5500/5500M / Pro 5500M] (rev c1)

is available as

[     5.885] (II) modeset(G0): using drv /dev/dri/card0

in a regular prime setup.

=> https://wiki.archlinux.org/title/PRIME# … Management
Also

cat /sys/class/drm/card*/device/power_state
echo $DRI_PRIME
glxinfo -B
DRI_PRIME=1 glxinfo -B

I don't think there's a way to disable the dGPU

Did you check?

Offline

#7 2023-06-25 19:04:14

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

[crafter@CraftyWiz log]$ cat /sys/class/drm/card*/device/power_state
D0
D0
[crafter@CraftyWiz log]$ echo $DRI_PRIME

[crafter@CraftyWiz log]$ glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: AMD (0x1002)
    Device: AMD Radeon Graphics (renoir, LLVM 15.0.7, DRM 3.52, 6.3.9-arch1-1) (0x1638)
    Version: 23.1.2
    Accelerated: yes
    Video memory: 512MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 81 MB, largest block: 81 MB
    VBO free aux. memory - total: 7560 MB, largest block: 7560 MB
    Texture free memory - total: 81 MB, largest block: 81 MB
    Texture free aux. memory - total: 7560 MB, largest block: 7560 MB
    Renderbuffer free memory - total: 81 MB, largest block: 81 MB
    Renderbuffer free aux. memory - total: 7560 MB, largest block: 7560 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 512 MB
    Total available memory: 8197 MB
    Currently available dedicated video memory: 81 MB
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon Graphics (renoir, LLVM 15.0.7, DRM 3.52, 6.3.9-arch1-1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.1.2
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.1.2
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.1.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

[crafter@CraftyWiz log]$ DRI_PRIME=1 glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: AMD (0x1002)
    Device: AMD Radeon RX 5500M (navi14, LLVM 15.0.7, DRM 3.52, 6.3.9-arch1-1) (0x7340)
    Version: 23.1.2
    Accelerated: yes
    Video memory: 4096MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 4076 MB, largest block: 4076 MB
    VBO free aux. memory - total: 7661 MB, largest block: 7661 MB
    Texture free memory - total: 4076 MB, largest block: 4076 MB
    Texture free aux. memory - total: 7661 MB, largest block: 7661 MB
    Renderbuffer free memory - total: 4076 MB, largest block: 4076 MB
    Renderbuffer free aux. memory - total: 7661 MB, largest block: 7661 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 4096 MB
    Total available memory: 11781 MB
    Currently available dedicated video memory: 4076 MB
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon RX 5500M (navi14, LLVM 15.0.7, DRM 3.52, 6.3.9-arch1-1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.1.2
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.1.2
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.1.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

In the BIOS, I checked for options in the advanced tab under graphics but there weren't any

Offline

#8 2023-06-25 19:12:26

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

D0
D0

Yeah, they both are in use or at least the RX 5500M doesn't power down.

cat /sys/class/drm/card*/device/power/control

You want this to be "auto" for at least card1
If not,

echo auto | sudo tee /sys/class/drm/card1/device/power/control

and see whether the card powers down.

Also see whether amdgpu_top lists any consumers for the card, https://wiki.archlinux.org/title/AMDGPU#Monitoring

Offline

#9 2023-06-26 03:39:10

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

cat /sys/class/drm/card*/device/power/control
auto
auto
auto
on

amdgpu_top shows normal usage by applications like firefox, plasmashell, kwin_x11, etc for the iGPU but nothing for the dGPU except amdgpu_top itself while continuously drawing 5-7W of power.

Offline

#10 2023-06-26 05:29:36

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

on

I had expected only two outputs, but from the order, that's a problem.

Offline

#11 2023-06-26 05:34:01

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

So, how do I fix that?

Offline

#12 2023-06-26 05:35:22

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

Set it to auto, figure why it's on (and which device this actually is)

Offline

#13 2023-06-26 05:43:10

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

Ok that was card1.
I executed

echo auto | sudo tee /sys/class/drm/card1/device/power/control

and now everything is set to auto.
But the problem still persists

Edit: However, on rebooting, the card gets turned back to on

Last edited by craftywiz (2023-06-26 05:45:06)

Offline

#14 2023-06-26 06:03:55

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

Try the behavior w/ the LTS kernel to rule out some regression and see the wiki on how to set the control w/ a udev rule (and whether you maybe added one to do the opposite)
The GPU will take a moment to figure that there's nothing to do and enter D3, that's normal.
Also don't use amdgpu_top to figure whether it's active (because as you figured, amdgpu_top itself keeps it busy) - the most interesting thing is whether the GPU moves from D0 to D3

Offline

#15 2023-06-26 07:13:31

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

The LTS kernel has the same problem.

Which control should I change with a udev rule (this is the first time I'm using one)? Any references/links would be helpful.

Offline

#16 2023-06-26 07:29:17

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

I posted https://wiki.archlinux.org/title/PRIME# … Management in #6, the nvidia section shows udev examples and the linked udev wiki explains how to query the proper attributes in https://wiki.archlinux.org/title/Udev#L … f_a_device

Offline

#17 2023-06-26 14:27:29

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

I created a file with the following udev rule :

ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x1022", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="auto"

but nothing has changed. The device corresponding to the dGPU for some reason gives information about the iGPU when I query its attributes:

looking at device '/devices/pci0000:00/0000:00:08.1/0000:07:00.0/graphics/fb0':
    KERNEL=="fb0"
    SUBSYSTEM=="graphics"
    DRIVER==""
    ATTR{bits_per_pixel}=="32"
    ATTR{blank}==""
    ATTR{console}==""
    ATTR{cursor}==""
    ATTR{mode}==""
    ATTR{modes}=="U:1920x1080p-0"
    ATTR{name}=="amdgpudrmfb"
    ATTR{pan}=="0,0"
    ATTR{power/control}=="auto"
    ATTR{power/runtime_active_time}=="0"
    ATTR{power/runtime_status}=="unsupported"
    ATTR{power/runtime_suspended_time}=="0"
    ATTR{rotate}=="0"
    ATTR{state}=="0"
    ATTR{stride}=="7680"
    ATTR{virtual_size}=="1920,1080"

  looking at parent device '/devices/pci0000:00/0000:00:08.1/0000:07:00.0':
    KERNELS=="0000:07:00.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="amdgpu"
    ATTRS{ari_enabled}=="0"
    ATTRS{boot_vga}=="1"

and so on

Offline

#18 2023-06-26 20:32:30

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

but nothing has changed

The power control for card1 still says "on"?
Did you only create that file or also reboot (and perhaps recreate the initramfs before)?

device corresponding to the dGPU for some reason gives information about the iGPU

What device specifically did you query?
card1? What about card0?

Offline

#19 2023-06-27 05:42:12

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

Yes, it still says "on" after rebooting and rebuilding initramfs.
I queried the dGPU which is card0 but apparently it gave info about card1 which is the iGPU and power/control was already set to auto there

Edit: I might be wrong as I am saying this based on seeing the PCI slot corresponding to the iGPU in the info of the dGPU. However, since the power/control for the iGPU is normally set to "on", this might not be the case

Last edited by craftywiz (2023-06-27 05:54:04)

Offline

#20 2023-06-27 06:06:26

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

Yes, it still says "on" after rebooting and rebuilding initramfs.

Means either the udev rule doesn't apply or is later overridden by eg. some power management tool.

I queried the dGPU which is card0 but apparently it gave info about card1

Don't paraphrase. Post the complete outputs of

udevadm info --attribute-walk --path=/sys/class/drm/card0
udevadm info --attribute-walk --path=/sys/class/drm/card1

Offline

#21 2023-06-27 06:34:25

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

For card0
For card1

Sorry for the confusion, I was using the wrong device name. These are the rules I modified and added to /etc/udev/rules.d/ :

ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x1002", ATTR{class}=="0x038000", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x1002", ATTR{class}=="0x060400", TEST=="power/control", ATTR(power/control}="auto"

ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x1002", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x1022", ATTR{class}=="0x060400", TEST=="power/control", ATTR{power/control}="auto"

I rebuilt initramfs and am rebooting

Edit: card1 still says "on" and this is the output of ls /sys/class/drm/ :
card0  card0-HDMI-A-1  card1  card1-eDP-1  renderD128  renderD129  version

The other cards are still set to auto.

Last edited by craftywiz (2023-06-27 06:37:55)

Offline

#22 2023-06-27 08:26:46

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

The Cezanne chip is card1 and has power/control=on, you're actively using that one so that's not a problem.

systool -vm amdgpu

Offline

#23 2023-06-27 08:44:55

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

Offline

#24 2023-06-27 08:58:47

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Laptop always using discrete GPU even when idle

aspm is disabled?

cat /proc/cmdline

and try adding explicit

amdgpu.aspm=1 amdgpu.runpm=1 amdgpu.bapm=1 amdgpu.dpm=1

to the https://wiki.archlinux.org/title/Kernel_parameters

Offline

#25 2023-06-27 09:19:53

craftywiz
Member
Registered: 2023-06-25
Posts: 18

Re: Laptop always using discrete GPU even when idle

The parameters show up in /proc/cmdline after reboot and aspm has a value "1". What else should I edit?

Offline

Board footer

Powered by FluxBB