You are not logged in.

#1 2021-04-08 01:53:14

phollox
Member
Registered: 2013-05-04
Posts: 37

bbswitch not working because GPU driver is in use

Stupid question.

I have a laptop with an nVIDIA GPU and an Intel graphics. I want to turn off the GPU when not in use.
The current state of the system was discussed here:
https://bbs.archlinux.org/viewtopic.php?id=263633

I installed and enabled bbswitch. However, because the nvidia drivers are loaded and in use, bbswitch can't turn off the GPU

I'm loading the drivers for nvidia on KMS, as explained on the previous post. Is this affecting bbswitch?

I'm getting

~/ dmesg | grep bbswitch                             

[   99.862674] bbswitch: version 0.8
[   99.862685] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[   99.862696] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
[   99.862869] bbswitch: detected an Optimus _DSM function
[   99.862878] bbswitch: device 0000:01:00.0 is in use by driver 'nvidia', refusing OFF
[   99.862881] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on

For the previous output, I loaded bbswitch manually, with options

# modprobe bbswitch load_state=0 unload_state=1

That's why the timestamps are as high. But loadïng it during boot has the same result.

The dev says that I need to unload the video driver for the GPU. But then, how I'm going to use the GPU when bbswitch activates it?

My goal with the GPU is CUDA, not rendering

Thanks


I divide by zero, multiple times per day. Also, I don't believe in tipping
Arch + i3wm (still learning)

Offline

#2 2021-04-08 10:33:16

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 9,019

Re: bbswitch not working because GPU driver is in use

Try removing the nvidia modules from mkinitcpio , then rebooting.
Does bbswitch work now ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
Did you use the guided installer ? If yes, I can't help you.

(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2021-04-08 21:40:44

phollox
Member
Registered: 2013-05-04
Posts: 37

Re: bbswitch not working because GPU driver is in use

Thanks,

I removed the nvidia modules from the MODULES array in mkinitcpio. Regenerated the images

# mkinitcpio -P

Changed the kernel line in /etc/default/grub to remove nvidia-drm.modeset=1. Updated grub

# grub-mkconfig -o /boot/grub/grub.cfg

And rebooted.

$ dmesg | grep bbswitch
[    2.005672] bbswitch: version 0.8
[    2.005677] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[    2.005682] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
[    2.005770] bbswitch: detected an Optimus _DSM function
[    2.005894] bbswitch: disabling discrete graphics
[    2.113148] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is off

In short, it seems to works.

I still need to see if it turns back on when required by CUDA, or if I have to manually activate it writting ON into /proc/acpi/bbswitch

Thanks

EDIT:

# tee /proc/acpi/bbswitch <<< OFF
OFF

However

$ dmesg | grep bbswitch           
[    2.005672] bbswitch: version 0.8
[    2.005677] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[    2.005682] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
[    2.005770] bbswitch: detected an Optimus _DSM function
[    2.005894] bbswitch: disabling discrete graphics
[    2.113148] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is off
[ 1849.328441] bbswitch: device 0000:01:00.0 is in use by driver 'nvidia', refusing OFF

So the GPU was active

$ dmesg | grep nvidia  
[    2.266592] nvidia-gpu 0000:01:00.3: can't change power state from D3cold to D0 (config space inaccessible)
[    2.266598] nvidia-gpu 0000:01:00.3: can't change power state from D3hot to D0 (config space inaccessible)
[    2.266777] nvidia-gpu 0000:01:00.3: pci_alloc_irq_vectors err -22
[    2.267193] nvidia-gpu: probe of 0000:01:00.3 failed with error -22
[    3.047663] nvidia: module license 'NVIDIA' taints kernel.
[    3.110059] nvidia-nvlink: Nvlink Core is being initialized, major device number 235
[    3.242656] nvidia 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
[    3.393905] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  460.67  Thu Mar 11 00:03:18 UTC 2021
[    3.399246] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[    3.399247] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 1
[ 1849.328441] bbswitch: device 0000:01:00.0 is in use by driver 'nvidia', refusing OFF

Thanks

Last edited by phollox (2021-04-08 22:31:36)


I divide by zero, multiple times per day. Also, I don't believe in tipping
Arch + i3wm (still learning)

Offline

#4 2021-04-09 10:50:28

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 9,019

Re: bbswitch not working because GPU driver is in use

Try creating /etc//etc/modprobe.d/bbswitch.conf & starting bbswitch on boot, [1] for details .

Another possible cause is https://github.com/Bumblebee-Project/bb … issues/140 .
Please post full dmesg & journalctl -b (run both as root)




[1] https://wiki.archlinux.org/index.php/Bu … g_bbswitch

Last edited by Lone_Wolf (2021-04-09 10:50:45)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
Did you use the guided installer ? If yes, I can't help you.

(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

Board footer

Powered by FluxBB