ubuntu-drivers-common
ubuntu-drivers-common copied to clipboard
Make sure drm devices are ready
- In some cases, the DM, gpu-manager will launch earlier than drm-uevetns be processed but DM and gpu-manager are usually expect related events are there. For example, the GDM using udev (at least in amd64) to prefer the specific configurations. (e.g. X or Wayland). If the drm-uevents are not there then it will choose the unexpected configuration.
- This patch monitors the uevents and waiting for them be processed. Since there are many uevents be queued, we more incline to careful drm related only instead of all uevents (also which speed up the boot time roughly 300 ms). Thus, if there is a boot_vga device be processed then no more wait (because at least, the boot_vga monitor should work smoothly)
- This patch increase the average boot time roughly 300-500 ms but also increase the system stabilities.
Launchpad bug: https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/1958488 gdm upstream bug: https://gitlab.gnome.org/GNOME/gdm/-/issues/763 Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1004131
have you tested that in a VM with no available GPU? (e.g. with an ubuntu-server installation)
Tested on focal:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
# with no GPU
ubuntu@focal-server:~$ lspci -nnv -d ::0x0300
ubuntu@focal-server:~$ lspci -nnv -d ::0x0302
gpu-manager doesn't start probably because of depended display-manager.service
Thus, I start it manually and here is the /var/log/gpu-manager.log
$ sudo journalctl -b -u gpu-manager
-- Logs begin at Mon 2022-01-31 09:20:17 UTC, end at Thu 2022-02-10 14:27:52 UTC. --
Feb 10 14:27:39 focal-server systemd[1]: Starting Detect the available GPUs and deal with any system changes...
Feb 10 14:27:40 focal-server systemd[1]: gpu-manager.service: Succeeded.
Feb 10 14:27:40 focal-server systemd[1]: Finished Detect the available GPUs and deal with any system changes.
$ cat /var/log/gpu-manager.log
log_file: /var/log/gpu-manager.log
last_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
new_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
can't access /run/u-d-c-nvidia-was-loaded file
can't access /opt/amdgpu-pro/bin/amdgpu-pro-px
Looking for nvidia modules in /lib/modules/5.4.0-96-generic/kernel
Looking for nvidia modules in /lib/modules/5.4.0-96-generic/updates/dkms
Looking for amdgpu modules in /lib/modules/5.4.0-96-generic/kernel
Looking for amdgpu modules in /lib/modules/5.4.0-96-generic/updates/dkms
Is nvidia loaded? no
Was nvidia unloaded? no
Is nvidia blacklisted? no
Is intel loaded? no
Is radeon loaded? no
Is radeon blacklisted? no
Is amdgpu loaded? no
Is amdgpu blacklisted? no
Is amdgpu versioned? no
Is amdgpu pro stack? no
Is nouveau loaded? no
Is nouveau blacklisted? no
Is nvidia kernel module available? no
Is amdgpu kernel module available? no
Error : Failed to open /dev/dri
Error : Failed to open /dev/dri
Error : Failed to open /dev/dri
Error : Failed to open /dev/dri
Does it require offloading? no
last cards number = 1
Has amd? no
Has intel? no
Has nvidia? no
How many cards? 0
The number of cards has changed!
Has the system changed? Yes
System configuration has changed
after applying the patch:
$ cat /var/log/gpu-manager.log
log_file: /var/log/gpu-manager.log
last_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
new_boot_file: /var/lib/ubuntu-drivers-common/last_gfx_boot
Not able to get events list.
Not able to get events list.
Not able to get events list.
Not able to get events list.
Takes 40ms to wait for udev events completed.
can't access /run/u-d-c-nvidia-was-loaded file
can't access /opt/amdgpu-pro/bin/amdgpu-pro-px
Looking for nvidia modules in /lib/modules/5.4.0-96-generic/kernel
Looking for nvidia modules in /lib/modules/5.4.0-96-generic/updates/dkms
Looking for amdgpu modules in /lib/modules/5.4.0-96-generic/kernel
Looking for amdgpu modules in /lib/modules/5.4.0-96-generic/updates/dkms
Is nvidia loaded? no
Was nvidia unloaded? no
Is nvidia blacklisted? no
Is intel loaded? no
Is radeon loaded? no
Is radeon blacklisted? no
Is amdgpu loaded? no
Is amdgpu blacklisted? no
Is amdgpu versioned? no
Is amdgpu pro stack? no
Is nouveau loaded? no
Is nouveau blacklisted? no
Is nvidia kernel module available? no
Is amdgpu kernel module available? no
Error : Failed to open /dev/dri
Error : Failed to open /dev/dri
Error : Failed to open /dev/dri
Error : Failed to open /dev/dri
Does it require offloading? no
last cards number = 0
Has amd? no
Has intel? no
Has nvidia? no
How many cards? 0
Has the system changed? No
Since there is no GPU available (no boot_vga will be detected), it takes 40ms to wait all uevents be processed.
There are something need to revisit from me. please hold-on to check.