# [bumblebee] bbswitch optirun : rmmod échoue (solved)

## pti-rem

Bonjour,

Je lance Bumblebee avec # bumblebeed --debug

Je lance une commande $ optirun glxspheres64

Trois modules sont chargés à l'appel de la commande optirun : nvidia <- nvidia_modeset <- nvidia_drm

```
n73sm ~ # lsmod

Module                  Size  Used by

nvidia_drm             38275  0

nvidia_modeset        756775  1 nvidia_drm

nvidia              11848427  1 nvidia_modeset
```

Quand je quitte optirun seul le module nvidia semble vouloir être déchargé par bumblebeed

```
...

[ 8613.971406] [DEBUG]Socket closed.

[ 8613.971416] [INFO]Stopping X server

[ 8614.016166] [DEBUG]Process with PID 12274 returned code 0

[ 8614.016287] [INFO]Unloading nvidia driver

[ 8614.016409] [DEBUG]Process rmmod started, PID 12283.

rmmod: ERROR: Module nvidia is in use by: nvidia_modeset

[ 8614.017231] [DEBUG]Process with PID 12283 returned code 1

[ 8617.023441] [ERROR]Unloading nvidia driver timed out.

[ 8617.023487] [DEBUG]Drivers are still loaded, unable to disable card

...
```

La carte nvidia reste en fonction :

```
n73sm ~ # cat /proc/acpi/bbswitch 

0000:01:00.0 ON
```

La présence du module nvidia empêche la commande manuelle de désactivation ;

```
n73sm ~ # tee /proc/acpi/bbswitch <<<OFF

OFF
```

```
[ 8937.937942] bbswitch: device 0000:01:00.0 is in use by driver 'nvidia', refusing OFF
```

Je n'ai que ma séquence

```
rmmod nvidia_drm

rmmod nvidia_modeset

rmmod nvidia

tee /proc/acpi/bbswitch <<<OFF
```

pour éviter la consommation et la surchauffe constante.

D'où la question, comment la sortie d'une commande optirun peut-elle permettre de décharger les modules dépendant du module nvidia (nvidia_drm & nvidia_modeset) ?

 *amonakov commented on 18 Oct 2015 wrote:*   

> https://github.com/Bumblebee-Project/Bumblebee/issues/691#issuecomment-149000636
> 
> Sounds like the bumblebee package was updated to use modprobe -r instead of rmmod, but your nvidia drivers package does not install module aliases required to make that work.

 

```
n73sm rem # modprobe -r nvidia

modprobe: FATAL: Module nvidia-uvm not found.

modprobe: FATAL: Error running remove command for nvidia
```

les modules nvidia_drm, nvidia_modeset et nvidia sont déchargés.

Après la mise à jour de bumblebee : =x11-misc/bumblebee-3.2.1_p20170123

```
[11325.092206] [DEBUG]Socket closed.

[11325.092341] [DEBUG]Socket closed.

[11325.092352] [INFO]Stopping X server

[11325.137906] [DEBUG]Process with PID 16701 returned code 0

[11325.138081] [INFO]Unloading module nvidia_modeset

[11325.145153] [INFO]Unloading module nvidia

[11325.157470] [INFO]Switching dedicated card OFF [bbswitch]

[11325.184274] [DEBUG][XORG] (II) UnloadModule: "kbd"

[11325.184289] [DEBUG][XORG] (II) UnloadModule: "mouse"

[11325.184292] [DEBUG][XORG] (II) NVIDIA(GPU-0): Deleting GPU-0

[11325.184295] [DEBUG][XORG] (II) Server terminated successfully (0). Closing log file.
```

```
n73sm ~ # cat /proc/acpi/bbswitch 

0000:01:00.0 OFF
```

```
n73sm ~ # uname -a

Linux n73sm 4.4.6-gentoo #4 SMP Thu Dec 22 14:09:27 CET 2016 x86_64 Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz GenuineIntel GNU/Linux
```

```
n73sm ~ # lspci -vnn | grep '\''[030[02]\]'

00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09) (prog-if 00 [VGA controller])

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108M [GeForce GT 630M] [10de:0de9] (rev ff) (prog-if ff)
```

```
rem@n73sm ~ $ vblank_mode=0 glxspheres64 -v

Polygons in scene: 62464 (61 spheres * 1024 polys/spheres)

ATTENTION: default value of option vblank_mode overridden by environment.

ATTENTION: default value of option vblank_mode overridden by environment.

Visual ID of window: 0xa8

Context is Direct

OpenGL Renderer: Mesa DRI Intel(R) Sandybridge Mobile 

155.328351 frames/sec - 173.346440 Mpixels/sec

137.478924 frames/sec - 153.426479 Mpixels/sec

137.408401 frames/sec - 153.347776 Mpixels/sec

136.403331 frames/sec - 152.226117 Mpixels/sec

137.576198 frames/sec - 153.535037 Mpixels/sec

137.371809 frames/sec - 153.306939 Mpixels/sec

137.279645 frames/sec - 153.204084 Mpixels/sec

137.563741 frames/sec - 153.521135 Mpixels/sec

129.351768 frames/sec - 144.356573 Mpixels/sec

136.558253 frames/sec - 152.399010 Mpixels/sec

rem@n73sm ~ $ vblank_mode=0 optirun glxspheres64 -v

Polygons in scene: 62464 (61 spheres * 1024 polys/spheres)

ATTENTION: default value of option vblank_mode overridden by environment.

ATTENTION: default value of option vblank_mode overridden by environment.

Visual ID of window: 0xa8

Context is Direct

OpenGL Renderer: GeForce GT 630M/PCIe/SSE2

ATTENTION: default value of option vblank_mode overridden by environment.

ATTENTION: default value of option vblank_mode overridden by environment.

197.182223 frames/sec - 220.055361 Mpixels/sec

197.323955 frames/sec - 220.213534 Mpixels/sec

197.977508 frames/sec - 220.942899 Mpixels/sec

197.979409 frames/sec - 220.945021 Mpixels/sec

197.386302 frames/sec - 220.283113 Mpixels/sec

197.776327 frames/sec - 220.718381 Mpixels/sec

197.663516 frames/sec - 220.592484 Mpixels/sec

197.889928 frames/sec - 220.845159 Mpixels/sec

198.155615 frames/sec - 221.141666 Mpixels/sec

194.356745 frames/sec - 216.902128 Mpixels/sec
```

Sans le vblank_mode=0 j'obtiens des débits vidéo similaires avec ou sans optirun ; je ne sais pas pourquoi : je ne sais pas ce qu'est cette variable vblank_mode

I'm Happy !   :Smile: 

Merci

----------

