FFE: support for NVIDIA runtimepm (hybrid gfx)

Bug #1895855 reported by Alberto Milone
16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OEM Priority Project
Fix Released
Critical
Alex Tu
nvidia-graphics-drivers-450 (Ubuntu)
Fix Released
Undecided
Alberto Milone
nvidia-prime (Ubuntu)
Fix Released
Undecided
Alberto Milone
Focal
Fix Released
Undecided
Unassigned
ubuntu-drivers-common (Ubuntu)
Fix Released
Wishlist
Alberto Milone

Bug Description

The work that went into ubuntu-drivers-common and nvidia-prime is meant to enable RTD3 support on Intel/NVIDIA or AMD/NVIDIA hybrid systems, introduced by the NVIDIA 450 driver series.

This allows the supported systems to make use of the integrated GPU (Intel or AMD) and to keep the discrete NVIDIA GPU powered down until needed. While powered down, the NVIDIA GPU can still detect any events, should external displays be plugged in.

This brings hybrid graphics on Linux on par with Windows.

Only the supported GPUs will be able to benefit from this change. This is why NVIDIA provides a hardware database (included in the nvidia packages), which gpu-manager can now parse. The ubuntu-drivers tool relies on that detection to enable this new feature when installing the NVIDIA driver.

Another improvement is the ability of ubuntu-drivers to detect LTSB (Long term support branch), NFB (New feature branch), Legacy, Beta flags, which the NVIDIA drivers can have, and make informed detection choices.

This work also includes a number of bug fixes reported on errors.ubuntu.com.

Requirements:

The new ubuntu-drivers-common:

The new nvidia-prime:

Changes to the NVIDIA drivers:

Changed in ubuntu-drivers-common (Ubuntu):
importance: Undecided → Wishlist
Alex Tu (alextu)
Changed in oem-priority:
importance: Undecided → Critical
assignee: nobody → Alex Tu (alextu)
Revision history for this message
Alberto Milone (albertomilone) wrote :

Changes for u-d-c

Revision history for this message
Alberto Milone (albertomilone) wrote :

nvidia-prime changes

Revision history for this message
Alberto Milone (albertomilone) wrote :

Changes to the NVIDIA drivers.

Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

I heard that in the new design, we can't see nvidia pci device in lspci as we are in power saving mode (say `prime-select intel`)

if that's the case, what's the proper too to list all pci device on the machine?

tags: added: oem-priority
Alex Tu (alextu)
tags: added: originate-from-1840753 somerville
Revision history for this message
Alberto Milone (albertomilone) wrote :

You can't list the NVIDIA cards if they aren't on the bus any more.

What you can do is check the availability of /etc/prime-discrete , which is only created when hybrid graphics is detected.

Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

May I know why we need to remove it from the bus?
Don’t we have other way to archive that?

Unable to have a consistent way to check it is inconvenient and higher probability to make mistakes.

Revision history for this message
Steve Langasek (vorlon) wrote :

Looks ok to me from a Feature Freeze perspective (but it would be nice to have an answer to Yuan-Chen's concern, from a technical perspective).

Aside, on ubuntu-drivers-common:

+Files: share/hybrid/json-parser/*
+Copyright: Copyright (c) 2012, 2013 James McLaughlin et al.
+License: BSD
+

Please don't use 'BSD' as a license descriptor, it's ambiguous. https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/#license-specification

(also, is there a reason you're embedding a json parser instead of building against json-c which is supported in main?)

On nvidia-prime:

> + self._nvidia_runtimepm_file = '/lib/modprobe.d/nvidia-runtimepm.conf'

Why are you managing files under /lib instead of under /etc? (this is a preexisting pattern so not a blocker, but it would be nice if this could be corrected at some point)

Changed in nvidia-prime (Ubuntu):
status: New → Triaged
Changed in nvidia-graphics-drivers-450 (Ubuntu):
status: New → Triaged
Revision history for this message
Alberto Milone (albertomilone) wrote :

I have uploaded a new nvidia-prime and a new ubuntu-drivers-common in Groovy.

They address Yuan-Chen's concerns.

I also fixed the licence, specifying the two-clause BSD licence.

As for the reason why I didn't relied on on json-c was that I did not see it in the archive. I can certainly rebase my code against that in the future.

As for using /lib/modprobe.d/ instead of /etc/modprobe.d/ , I think this comes from LP: #1761593 .

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nvidia-prime - 0.8.15

---------------
nvidia-prime (0.8.15) groovy; urgency=medium

  [ Alberto Milone ]
  * prime-select:
    - Enable runtimepm in on-demand mode if supported (LP: #1895855).
    - Disable workaround for on-demand mode.
    - Enable KMS if runtimepm is supported.

  [ Kai-Heng Feng ]
  * prime-select: Remove udev rules

 -- Alberto Milone <email address hidden> Fri, 09 Oct 2020 14:50:37 +0200

Changed in nvidia-prime (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-drivers-common - 1:0.8.6

---------------
ubuntu-drivers-common (1:0.8.6) groovy; urgency=medium

  [ Alberto Milone ]
  * share/hybrid/json-parser, debian/copyright:
    - Include json-parser (just C file and header).
  * gpu-manager.c:
    - Add json parsing code to detect support for runtimepm on NVIDIA
      (LP: #1895855).
    - Check that RTD3 is enabled, and write that to a file in /run.
    - Make on-demand mode the default when no settings are available.
    - Add support for AMD+NVIDIA hybrid systems.
    - Add support for checking PME capabilities for runtimepm, so that,
      if the GPU is not boot_vga, and it is not listed in the json
      database, we can at least check whether d3hot is supported, and
      enable runtimepm in the NVIDIA driver.
  * gpu-manager.py:
    - Adjust the test suite to match the changes in gpu-manager.c.
  * UbuntuDrivers/detect.py, ubuntu-drivers:
    - Catch apt exceptions.
    - Catch failure when modinfo is not available.
    - Introduce the concept of LTSB (long term support branch), NFB
      (new feature branch), Legacy, and Beta, which the driver packages
      can specify.
    - Use package support to pick the nvidia driver:
      o Desktop case: pick the latest non-server driver, when available
        (this preserves the current behaviour).
      o Server case: pick the LTSB -server driver, when available.
  * NvidiaDetector/nvidiadetector.py:
    - Use regex to parse package names (LP: #1891183).
  * ubuntu-drivers:
    - Select on-demand mode if runtimepm is supported.
    - Check RTD3 support for NVIDIA, and enable it when available.
    - Show the package support level, when available, when using
      "ubuntu-drivers debug".
  * debian/control:
    - Replace build-dep on libpciaccess-dev with libpci-dev.
  * debian/rules: make sure to call the clean target of the Makefile

  [ Cyrus Lien ]
  * gpu-manager.c:
    - Fix segmentation fault in json_find_feature_in_array.

 -- Alberto Milone <email address hidden> Mon, 12 Oct 2020 16:00:18 +0200

Changed in ubuntu-drivers-common (Ubuntu):
status: Triaged → Fix Released
Changed in nvidia-graphics-drivers-450 (Ubuntu):
status: Triaged → Fix Released
assignee: nobody → Alberto Milone (albertomilone)
Changed in nvidia-prime (Ubuntu):
assignee: nobody → Alberto Milone (albertomilone)
Changed in nvidia-graphics-drivers-450 (Ubuntu Bionic):
assignee: nobody → Alberto Milone (albertomilone)
importance: Undecided → Wishlist
status: New → Triaged
Changed in nvidia-graphics-drivers-450 (Ubuntu Focal):
assignee: nobody → Alberto Milone (albertomilone)
status: New → Triaged
importance: Undecided → Wishlist
no longer affects: nvidia-graphics-drivers-450 (Ubuntu Bionic)
no longer affects: nvidia-graphics-drivers-450 (Ubuntu Focal)
no longer affects: nvidia-prime (Ubuntu Bionic)
no longer affects: nvidia-prime (Ubuntu Focal)
no longer affects: ubuntu-drivers-common (Ubuntu Bionic)
no longer affects: ubuntu-drivers-common (Ubuntu Focal)
Revision history for this message
Brian Murray (brian-murray) wrote :

This bug report is missing SRU information.

Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Alberto, or anyone else affected,

Accepted nvidia-prime into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/nvidia-prime/0.8.15.3~0.20.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in nvidia-prime (Ubuntu Focal):
status: New → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

This has been pulled in as part of the backport in LP: #1904583 . Skipping verification in favor of general testing in the aforementioned bug.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nvidia-prime - 0.8.15.3~0.20.04.1

---------------
nvidia-prime (0.8.15.3~0.20.04.1) focal; urgency=medium

  [ Alberto Milone ]
  * prime-select:
    - Enable runtimepm in on-demand mode if supported (LP: #1895855).
    - Disable workaround for on-demand mode.
    - Enable KMS if runtimepm is supported.
  * debian/postinst.in:
    - Remove obsolete udev rules in the postinst too.
  * debian/rules:
    - Add postinst file to the autoclean target.

  [ Kai-Heng Feng ]
  * prime-select: Remove udev rules (LP: #1904583).

 -- Alberto Milone <email address hidden> Fri, 20 Nov 2020 16:19:39 +0100

Changed in nvidia-prime (Ubuntu Focal):
status: Fix Committed → Fix Released
Changed in oem-priority:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.