Public bug reported:

As far as I can tell, any system with an NVIDIA graphics card won't
resume from sleep correctly when running mantic unless the NVIDIA driver
has the option `NVreg_PreserveVideoMemoryAllocations=1` set.  This is
because by default most video memory allocations are not preserved on
suspend and the user space needs to handle the case where (from the
application's point of view) they suddenly and mysteriously go missing.

The GNOME shell fails to do this and fails fairly spectacularly.  This
results in a wide variety of visual defects but leaves the system
unusable.

The suggested option works around this by making the driver write video
memory out to file while suspending and restoring video memory from file
when resuming.  It's important that the path where this temporary file
is written out has enough free space to hold all of video memory; on
mantic, `/tmp` (the default) seems appropriate as it is not a ramfs but
this could be configured elsewhere.

While there are obviously cases where this behaviour is not desired
(mainly where GPUs are used for non-display purposes), it seems likely
that in the vast majority of cases where such a GPU is present and the
system is regularly put into a sleep state that the GPU will be used for
display and not as a GPGPU.  Systems that are put into sleep states tend
to be portables, where the GPU is primarily for display; systems used
for GPGPU tend not to be portable and are not usually put into sleep
states where the GPU is shut down.  Obviously these are generalisations,
but they are _generally_ true.  It's also likely that users doing GPGPU
will already have to go and reconfigure their systems for optimal
performance whereas desktop users generally expect the system to work
correctly out of the box.  I'm a long-term Ubuntu user and software
engineer and it took me a couple of weeks to figure out that suspend
isn't broken on my new laptop, I just need to set GPU driver options;
the chances of a normal user figuring this out are slim.

I'd suggest that putting the option in /etc/modprobe.d/nvidia-graphics-
drivers-kms.conf is likely to be the right way to achieve this.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 23.10
Release:        23.10
Codename:       mantic

$ apt-cache policy nvidia-kernel-common-535
nvidia-kernel-common-535:
  Installed: 535.154.05-0ubuntu0.23.10.1
  Candidate: 535.154.05-0ubuntu0.23.10.1
  Version table:
 *** 535.154.05-0ubuntu0.23.10.1 500
        500 http://gb.archive.ubuntu.com/ubuntu mantic-updates/restricted amd64 
Packages
        500 http://security.ubuntu.com/ubuntu mantic-security/restricted amd64 
Packages
        100 /var/lib/dpkg/status
     535.113.01-0ubuntu3 500
        500 http://gb.archive.ubuntu.com/ubuntu mantic/rest

** Affects: nvidia-graphics-drivers-535 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to nvidia-graphics-drivers-535 in Ubuntu.
https://bugs.launchpad.net/bugs/2052597

Title:
  NVreg_PreserveVideoMemoryAllocations=1 should be the default

Status in nvidia-graphics-drivers-535 package in Ubuntu:
  New

Bug description:
  As far as I can tell, any system with an NVIDIA graphics card won't
  resume from sleep correctly when running mantic unless the NVIDIA
  driver has the option `NVreg_PreserveVideoMemoryAllocations=1` set.
  This is because by default most video memory allocations are not
  preserved on suspend and the user space needs to handle the case where
  (from the application's point of view) they suddenly and mysteriously
  go missing.

  The GNOME shell fails to do this and fails fairly spectacularly.  This
  results in a wide variety of visual defects but leaves the system
  unusable.

  The suggested option works around this by making the driver write
  video memory out to file while suspending and restoring video memory
  from file when resuming.  It's important that the path where this
  temporary file is written out has enough free space to hold all of
  video memory; on mantic, `/tmp` (the default) seems appropriate as it
  is not a ramfs but this could be configured elsewhere.

  While there are obviously cases where this behaviour is not desired
  (mainly where GPUs are used for non-display purposes), it seems likely
  that in the vast majority of cases where such a GPU is present and the
  system is regularly put into a sleep state that the GPU will be used
  for display and not as a GPGPU.  Systems that are put into sleep
  states tend to be portables, where the GPU is primarily for display;
  systems used for GPGPU tend not to be portable and are not usually put
  into sleep states where the GPU is shut down.  Obviously these are
  generalisations, but they are _generally_ true.  It's also likely that
  users doing GPGPU will already have to go and reconfigure their
  systems for optimal performance whereas desktop users generally expect
  the system to work correctly out of the box.  I'm a long-term Ubuntu
  user and software engineer and it took me a couple of weeks to figure
  out that suspend isn't broken on my new laptop, I just need to set GPU
  driver options; the chances of a normal user figuring this out are
  slim.

  I'd suggest that putting the option in /etc/modprobe.d/nvidia-
  graphics-drivers-kms.conf is likely to be the right way to achieve
  this.

  $ lsb_release -a
  No LSB modules are available.
  Distributor ID:       Ubuntu
  Description:  Ubuntu 23.10
  Release:      23.10
  Codename:     mantic

  $ apt-cache policy nvidia-kernel-common-535
  nvidia-kernel-common-535:
    Installed: 535.154.05-0ubuntu0.23.10.1
    Candidate: 535.154.05-0ubuntu0.23.10.1
    Version table:
   *** 535.154.05-0ubuntu0.23.10.1 500
          500 http://gb.archive.ubuntu.com/ubuntu mantic-updates/restricted 
amd64 Packages
          500 http://security.ubuntu.com/ubuntu mantic-security/restricted 
amd64 Packages
          100 /var/lib/dpkg/status
       535.113.01-0ubuntu3 500
          500 http://gb.archive.ubuntu.com/ubuntu mantic/rest

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-535/+bug/2052597/+subscriptions


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

Reply via email to