Nvidia PRIME Render Offload won't turn off my dGPU

I followed the instructions at PRIME - ArchWiki but if I run nvidia-smi I still get a 4W power usage by the dGPU and a the /usr/lib/Xorg process loaded on the GPU

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64       Driver Version: 440.64       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 2060    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   49C    P8     4W /  N/A |     16MiB /  5934MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0       716      G   /usr/lib/Xorg                                 14MiB |
+-----------------------------------------------------------------------------+

My xorg.conf looks as follows

Section "ServerLayout"
    Identifier     "layout"
    Screen         0 "iGPU"
    Option         "AllowNVIDIAGPUScreens"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Module"
    Load           "modesetting"
    Load           "glx"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "Device"
    Identifier     "iGPU"
    Driver         "modesetting"
    BusID          "PCI:0:2:0"
EndSection

Section "Device"
    Identifier     "dGPU"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier     "iGPU"
    Device         "iGPU"
EndSection

On a possibly related note, I tried following the instructions at Chapter 22. PCI-Express Runtime D3 (RTD3) Power Management for the power management, but despite setting the rules in /lib/udev/rules.d/ as indicated, the relevant settings in /sys/bus/pci/devices/… get reset to their default values after rebooting.
nvidia-bug-report.log.gz (242 KB)

I’m also wondering about can turn off dGPU while not used.

I suspect running nvidia-smi turns on the gpu so it’s not usable for checking if power management is effective. Rather use powertop for that.

Yeah, you’re correct that nvidia-smi turns the GPU on, so it’s not useful to check for runtime power management. Instead, you can check the kernel’s power status file /sys/bus/pci/devices/<busid>/power/runtime_status. If it says suspended then the kernel put the GPU to sleep.

It’s not available quite yet, but in a future release there will also be a /proc/driver/nvidia/gpus/<busid>/power file you can read for additional information (i.e. to tell whether the VRAM is powered off or in self-refresh mode).

Is there any way to disable the Nvidia dGpu completely in order to save battery on Linux? I’ve been trying a lot of things but it is consuming a lot of power and it drain the battery. I actually don’t use the Nvidia on Linux since it doesn’t support the use of the Type C port with Nvidia dGPU and the HDMI with the AMD iGPU at the same time (this laptop uses the HDMI with AMD iGPU and Type C with the Nvidia dGPU) uninstalling the drivers maybe?