New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvidia_modeset, nvidia_uvm handling #719

Open
ArchangeGabriel opened this Issue Dec 28, 2015 · 18 comments

Comments

Projects
None yet
@ArchangeGabriel
Member

ArchangeGabriel commented Dec 28, 2015

Per #565 and #699 we need to handle the existence of nvidia-modeset and nvidia-uvm.

The unloading of nvidia module failing because of dependencies of above mentioned modules. Very common problem, results in card staying ON.

Part of the fix is using modprobe -r instead of rmmod, but this also needs some aliases file. But at this point, we have one issue: a line as remove nvidia rmmod nvidia-uvm nvidia-modeset nvidia seems to be causing issue if one of them isn’t loaded. This happen for instance when running optirun --no-xorg, where nvidia-modeset do not get loaded. Also, nvidia-uvm does not seems to be automatically loaded anymore with recent versions of the driver.

The second point is who should ship this file: us, or the driver? Finally, is their another fix possible that doesn’t imply explicitly coding the removal of this driver in bumblebee?

@ArchangeGabriel

This comment has been minimized.

Member

ArchangeGabriel commented Dec 28, 2015

Also, we might need to take care of loading too according to #604.

@karolherbst

This comment has been minimized.

karolherbst commented Jan 13, 2016

well for me

remove nvidia modprobe -r --ignore-remove nvidia-modeset nvidia-uvm nvidia

works

@karolherbst

This comment has been minimized.

karolherbst commented Jan 13, 2016

ohh it even works without --ignore-remove, so why does it fail for others?

@karolherbst

This comment has been minimized.

karolherbst commented Jan 13, 2016

ohh, in the optirun --no-xorg case "--ignore-remove" helps :)

@phaazon

This comment has been minimized.

phaazon commented Jan 25, 2016

Same problem here. This fixed the issue though:

sudo rmmod nvidia_modeset
sudo rmmod nvidia
sudo tee /proc/acpi/bsswitch <<< OFF

@ghost

This comment has been minimized.

ghost commented Jan 30, 2016

modprobe -r nvidia-modeset nvidia-uvm nvidia
tee /proc/acpi/bbswitch <<< OFF

Works for me

@doraskayo

This comment has been minimized.

doraskayo commented Feb 1, 2016

It appears that this relatively simple issue renders power management completely useless on every updated NVIDIA driver.

@ArchangeGabriel, any chance this can be hotfixed as v3.2.2?

@Yamakuzure

This comment has been minimized.

Yamakuzure commented Feb 3, 2016

Please make sure that the new nvidia-modeset is not autoloaded by your kernel.

I had to add this to my grub kernel line:

modprobe.blacklist=nvidia-modeset,nvidia-uvm,nvidia,nouveau

Otherwise my kernel autoloads nvidia-modeset, which will pull in the other two, and bbswitch will no longer be able to unload nvidia and turn the card off, because it is "in use".

However, as nvidia-modeset will be loaded when activating the card, the nvidia removal must be configured like karolherbst quoted.

Note: I have nvidia-drivers-358.16-r1 installed with kms support on a gentoo system with using the live ebuilds for bumblebee, primusrun, bbswitch and virtualgl.

@Yamakuzure

This comment has been minimized.

Yamakuzure commented Feb 5, 2016

btw.: I am working with bumblebee from its development branch. Only the UVM patch is added, nothing else. And the whole thing works perfectly well since I made sure nothing autoloads any nvidia module before bbswitch is loaded and the bumblebee daemon is running.

@AnAkkk

This comment has been minimized.

AnAkkk commented Feb 16, 2016

This is actually quite annoying, I have to use @ciechomke solution every time I use primusrun.

@ArchangeGabriel is there any progress on a fix?

@HileV

This comment has been minimized.

HileV commented Feb 26, 2016

Yamakuzure, you described the way will help automatically upload to GPU once deactivated "optirun" ?

@bluca

This comment has been minimized.

Member

bluca commented Mar 22, 2016

Hello, Debian maintainer here.

We ship the following modprobe conf file in Debian as part of the Nvidia driver packages (includes a nvidia-drm bit which is not released yet, new module in 364.12):

install nvidia modprobe -i nvidia-current $CMDLINE_OPTS

install nvidia-modeset modprobe nvidia ; modprobe -i nvidia-current-modeset $CMDLINE_OPTS

install nvidia-drm modprobe nvidia-current-modeset ; modprobe -i nvidia-current-drm $CMDLINE_OPTS

install nvidia-uvm modprobe nvidia ; modprobe -i nvidia-current-uvm $CMDLINE_OPTS

remove nvidia modprobe -r -i nvidia-drm nvidia-modeset nvidia-uvm nvidia

# These aliases are defined in *all* nvidia modules.
# Duplicating them here sets higher precedence and ensures the selected
# module gets loaded instead of a random first match if more than one
# version is installed. See #798207.
alias   pci:v000010DEd00000E00sv*sd*bc04sc80i00*    nvidia
alias   pci:v000010DEd00000AA3sv*sd*bc0Bsc40i00*    nvidia
alias   pci:v000010DEd*sv*sd*bc03sc02i00*       nvidia
alias   pci:v000010DEd*sv*sd*bc03sc00i00*       nvidia

This works both on a desktop and on an optimus laptop with bumblebee. Including running optirun --no-xorg for CUDA/OpenCL stuff. The needed modules are loaded and unloaded correctly.

Note that the bumblebee version we ship also has a patch with the following commit: 1ada79f to use modprobe -r instead of rmmod when removing modules.

Hope this info can be useful!

@syddel

This comment has been minimized.

syddel commented Apr 4, 2016

I'm using Ubuntu and conjured up a workaround that worked in Ubuntu 15.10:

#!/bin/bash

is_loaded() {
  lsmod | grep -wo nvidia > /dev/null
  return $?
}

on() {
  is_loaded
  if [ $? -eq 1 ]; then
    tee /proc/acpi/bbswitch <<<ON > /dev/null
    modprobe nvidia_drm nvidia_modeset nvidia_uvm nvidia
  fi
}

off() {
  is_loaded
  if [ $? -eq 0 ]; then
    rmmod nvidia_drm nvidia_modeset nvidia_uvm nvidia
    tee /proc/acpi/bbswitch <<<OFF > /dev/null
  fi
}

status() {
  cat /proc/acpi/bbswitch | grep -oE '[^ ]+$'
}

case $1 in
  on|off|status)
    if [ -f /proc/acpi/bbswitch ]; then 
      "$1"
    fi
    ;;
  *) echo "Usage: [sudo] nvidia {on|off|status}"
esac

I then put the following in my /etc/rc.local:

if [ -f /proc/acpi/bbswitch ]; then
  /usr/local/bin/nvidia off
fi

In Ubuntu 15.10, this allowed me to switch between drivers by selecting DISCRETE or MSHYBRID for the GPU settings in the BIOS (I didn't have to do anything else).

Since upgrading to Ubuntu 16.04 (beta) and the nVidia 364.12 driver, this no longer works. I now have to do a sudo prime-select {nvidia|intel} first. Sometimes this messes up my Unity desktop (it's pretty easy to get it back though).

@AnAkkk

This comment has been minimized.

AnAkkk commented Apr 10, 2016

Ping @ArchangeGabriel

@AnAkkk

This comment has been minimized.

AnAkkk commented Apr 11, 2016

The patche(s) need to be updated to handle the nvidia-drm module.

@ArchangeGabriel ArchangeGabriel removed the P:High label May 6, 2016

@ArchangeGabriel ArchangeGabriel self-assigned this May 6, 2016

@ArchangeGabriel

This comment has been minimized.

Member

ArchangeGabriel commented May 6, 2016

Thanks to @JOndra91, #762 should solve this.

@markmuir87

This comment has been minimized.

markmuir87 commented Dec 5, 2016

Don't know if this is still a problem anyone is having (although I just had it).

But just in case, for future searchers, what worked for me (in Arch) was to remove all references to nvidia drivers in the 'modules' array of /etc/mkinitcpio.conf and also any presets in /etc/mkinitcpio.d/ , and then rebuild initramfs.

@QkiZMR

This comment has been minimized.

QkiZMR commented Dec 6, 2016

On Ubuntu 16.04 I had this problem, but on Ubuntu 16.10 is ok. Right after stopping program bbswitch turn off NVidia card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment