** Summary changed:

- [nvidia][xorg] display hangs on boot LOGO
+ [nvidia][xorg] display hangs on boot LOGO due to race of gdm and nvidia 
driver probe

** Tags added: gdm3

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to ubuntu-drivers-common in Ubuntu.
https://bugs.launchpad.net/bugs/1958488

Title:
  [nvidia][xorg] display hangs on boot LOGO due to race of gdm and
  nvidia driver probe

Status in OEM Priority Project:
  Confirmed
Status in gdm3 package in Ubuntu:
  New
Status in ubuntu-drivers-common package in Ubuntu:
  In Progress
Status in gdm3 source package in Focal:
  New
Status in ubuntu-drivers-common source package in Focal:
  In Progress
Status in gdm3 source package in Impish:
  New
Status in ubuntu-drivers-common source package in Impish:
  In Progress

Bug description:
  [Impact]

   * In Ubuntu 20.04 (either impish, jammy, upstream gdm) (which using Xorg 
with proprietary nvidia driver), in some cases, the nvidia driver will probe 
later than launching gdm.
   * If above race condition happens in iGPU + nvidia cases and monitor 
connects to dGPU, which will cause gdm starts with wayland as opposed to Xorg. 
Which may lead the monitor stuck in black-screen or boot LOGO.

  [Test Plan]

   * The environment:
    1. A desktop or workstation which containing an iGPU.
    2. Plug a nvidia graphic card to the system and installing proprietary
    nvidia driver (470 in my case)
    3. Attach a monitor to dGPU and leave iGPU connect to nothing.
    (in my test environment, there is the other ethernet card and TBT4 cards)
   * Setup a cronjob,
     e.g. @reboot /home/u/test.sh
   * Have a test script in something like /home/u/test.sh as

  #!/bin/bash

  sleep 20
  count="$(cat /home/ubuntu/count)"
  count=$((count+1))
  echo $count | tee /home/ubuntu/count
  journalctl -b | grep -q -i wayland || sudo reboot

   * the system will probably stuck in black-screen or boot LOGO.
   * Before applying the fix, the fail rate is 6/24 (fail 6 time in 24 runs).
   * After applying the fix, it got pass within 1000+ reboot cycles.
   * Test PPA can be found here 
https://launchpad.net/~os369510/+archive/ubuntu/lp1958488

  [Fix]
   * The patch makes gpu-manager to probe nvidia (if needed) first and waiting 
for the /run/u-d-c-nvidia-drm-was-loaded be touched by 
71-u-d-c-gpu-detection.rules.
   * Also, the gdm is using 61-gdm.rules to configure the gdm mode by checking 
the nvidia driver presents or not.
   * gpu-manager is before display-manager. Thus, gpu-manager will wait for 
nvidia uevent be processed and then continue to work. When gdm be launched, the 
targeted nvidia uevent has been processed already. 
(71-u-d-c-gpu-detection.rules is later than 61-gdm.rules)

  [Where problems could occur]
   * there is not potential regression from my mind but it will lead the boot 
time be longer.
   * In my test cycles, it leads extra 0~1000ms in boot time. Usually, 0~200ms. 
Worst case, over 1 s in 8xx runs (of 1000).
   * I think the stability is important than performance in this case.

  [Other Info]
   * For non-ubuntu-desktop (which doesn't have gpu-manager), which using gdm 
will meet this issue still. The other potential fix (from either gdm or logind) 
is under discussion in 
https://gitlab.gnome.org/GNOME/gdm/-/issues/763#note_1385786.
   * u-d-c upstream fix: 
https://github.com/tseliot/ubuntu-drivers-common/pull/67

  ---

  Test environment/steps:
  1. A desktop or workstation which containing an iGPU.
  2. Plug a nvidia graphic card to the system and installing proprietary nvidia 
driver (470 in my case)
  3. Attach a monitor to dGPU and leave iGPU connect to nothing.
  (in my test environment, there is the other ethernet card and TBT4 cards)
  4. Reboot system.

  Based on:
  $ cat /lib/udev/rules.d/61-gdm.rules
  # disable Wayland on Hi1710 chipsets
  ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", 
RUN+="/usr/lib/gdm3/gdm-disable-wayland"
  # disable Wayland when using the proprietary nvidia driver
  DRIVER=="nvidia", RUN+="/usr/lib/gdm3/gdm-disable-wayland"

  It will disable wayland by default if proprietary nvidia driver load.
  But in some race condition cases, the nvidia probe is later than gnome 
launches. (The fail rate is 6/24.)
  Thus, ubuntu-gdm has a fix for Bug#1794280 to add 
"ExecStartPre=@libexecdir@/gdm-wait-for-drm".

  The gdm-wait-for-drm is intend to make sure all drm udev devices
  enumerated before launching gdm.

  It rely on at least one "master-of-seat" graphic card for gdm but it's not 
rigorous enough.
  Since most of graphic cards are own "master-of-seat"[1].

  In my case, it detects the iGPU is probed but dGPU.
  However, the display is attached to dGPU.

  We need to make sure the targeted gpu (connecting to monitor) is probe
  before launching gdm.

  debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1004131
  upstream bug: https://gitlab.gnome.org/GNOME/gdm/-/issues/763

  [1] https://www.freedesktop.org/wiki/Software/systemd/multiseat/
  /lib/udev/rules.d/71-seat.rules
  /lib/udev/rules.d/71-nvidia.rules

To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/1958488/+subscriptions


-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to