You are not logged in.

#1 2018-06-28 14:22:46

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

[SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

I recently purchased an XPS 15 9570. After installing and configuring Arch Linux, I tried to install the properity Nvidia drivers with Bumblebee following instructions on https://wiki.archlinux.org/index.php/Bu … stallation . So, I installed bumblebee, nvidia, mesa and bbswitch, then I ran these commands:

$ sudo gpasswd -a user bumblebee
$ sudo systemctl enable bumblebeed

After a reboot, I checked powertop to see if Nvidia GPU was turned off and it reported %100 usage(which was %0 before installing above packages). Then I tried running 'optirun glxgears -info' and 'optirun glxspheres64', both gave me same error:

[  243.877572][ERROR]Cannot access secondary GPU - error: Could not enable discrete graphics card

[  243.877599][ERROR]Aborting because fallback start is disabled.

I checked 'dmesg | grep bbswitch' and it reported me this:

[ 2.981557] bbswitch: loading out-of-tree module taints kernel.
[ 2.981710] bbswitch: version 0.8
[ 2.981713] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[ 2.981717] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
[ 2.981797] bbswitch: detected an Optimus _DSM function
[ 2.981882] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on
[ 2.982796] bbswitch: disabling discrete graphics
[ 243.698006] bbswitch: enabling discrete graphics
[ 253.983820] bbswitch: enabling discrete graphics

Note that this is after I tried to use 'optirun' 2 times.
I ran 'cat /proc/acpi/bbswitch' and the output was 'OFF':

0000:01:00.0 OFF

I think that this might be connected to these acpi errors I get during boot:

$ dmesg
...
[ 0.334157] ACPI: Added _OSI(Linux-Dell-Video)
[ 0.401173] ACPI BIOS Error (bug): Failure creating [\_SB.PCI0.XHC.RHUB.HS01._UPC], AE_ALREADY_EXISTS (20180313/dswload2-316)
[ 0.401184] ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20180313/psobject-220)
[ 0.401190] ACPI Error: Method parse/execution failed \, AE_ALREADY_EXISTS (20180313/psparse-516)
[ 0.401196] ACPI Error: Invalid zero thread count in method (20180313/dsmethod-760)
[ 0.401200] ACPI: Marking method \___ as Serialized because of AE_ALREADY_EXISTS error
[ 0.401202] ACPI Error: Invalid OwnerId: 0x00 (20180313/utownerid-156)
[ 0.401325] ACPI Error: AE_ALREADY_EXISTS, (SSDT:xh_cfhd4) while loading table (20180313/tbxfload-197)
[ 0.406452] ACPI Error: 1 table load failures, 11 successful (20180313/tbxfload-215)
[ 0.422895] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
...
[ 0.520489] ACPI Error: Method parse/execution failed \_SB.PCI0.SPI1.FPNT._CRS, AE_AML_INVALID_RESOURCE_TYPE (20180313/psparse-516)
[ 0.520504] ACPI Error: Method execution failed \_SB.PCI0.SPI1.FPNT._CRS, AE_AML_INVALID_RESOURCE_TYPE (20180313/uteval-69)
[ 0.522226] ACPI Error: Method parse/execution failed \_SB.PCI0.SPI2.FPNT._CRS, AE_AML_INVALID_RESOURCE_TYPE (20180313/psparse-516)
[ 0.522239] ACPI Error: Method execution failed \_SB.PCI0.SPI2.FPNT._CRS, AE_AML_INVALID_RESOURCE_TYPE (20180313/uteval-69)
...

I also found this part in 'dmesg' output which is probably about 'bbswitch's failure on shutting down Nvidia GPU.

[  243.698006] bbswitch: enabling discrete graphics
[  243.744869] pci 0000:01:00.0: Refused to change power state, currently in D3
[  243.805071] pci 0000:01:00.0: Refused to change power state, currently in D3
[  253.983820] bbswitch: enabling discrete graphics
[ 253.983843] pci 0000:01:00.0: Refused to change power state, currently in D3

Full dmesg output: https://gist.github.com/umutyazgan/3a38 … ca028351b5

I tried MANY suggestions on many forum posts, QA sites, bug trackers etc. including many different kernel parameters and none of them worked so far. I did hours and hours of research and I don't even remember most of my findings right now.

So, if anyone had any success on using these drivers on this laptop, please inform me about how did you achive it.

SOLVED(kinda): I ditched Bumblebee in favor of nvidia-xrun. nvidia-xrun also utilizes bbswitch so I installed a fork of nvidia-xrun made by michelesr that uses kernel power management instead of bbswitch. Here is the full process:

LazyLucretia wrote:

Alright I gave nvidia-xrun a shot and it seems like a good solution until bumblebee is fixed for this model. Here is what I did:
- Removed pcie_port_pm=off from kernel parameters (I think this parameter defaults to 'on' when not supplied to kernel)
- Uninstalled bumblebee(or bumblebee-forceunload) and bbswitch if they are installed.
- Installed michelesr fork of nvidia-xrun using the PKGBUILD: https://paste.pound-python.org/show/Uax … Ve5U11ixm/ (as suggested by setzer22), this should also install nvidia drivers as dependencies.
- Installed xf86-video-intel driver.
- Create /etc/X11/xorg.conf.d/01-noautogpu.conf, /etc/X11/xorg.conf.d/20-intel.conf and /etc/tmpfiles.d/nvidia_pm.conf as suggested above by yaworski.
/etc/X11/xorg.conf.d/01-noautogpu.conf :

Section "ServerFlags"
	Option "AutoAddGPU" "off"
EndSection

/etc/X11/xorg.conf.d/20-intel.conf :

Section "Device"
	Identifier "Intel Graphics"
	Driver "intel"
EndSection

/etc/tmpfiles.d/nvidia_pm.conf :

w /sys/bus/pci/devices/0000:01:00.0/power/control - - - - auto

- Now since bumblebee is uninstalled, /usr/lib/modprobe.d/bumblebee.conf file is also gone but we need it to stop nvidia drivers from loading at boot. Create /usr/lib/modprobe.d/bumblebee.conf with following contents:

blacklist nvidia
blacklist nvidia-drm
blacklist nvidia-modeset
blacklist nvidia-uvm
blacklist nouveau

- Reboot.
Now nvidia or nouveau modules should not be loaded on boot and Nvidia dGPU should be off. Loaded modules can be checked with 'lsmod | less' and power usage of dGPU and other system components can be checked with powertop. Power drain while idling should be below 10 Watts. Mine is around 4 W.
In order to use dGPU:
- Switch to another tty with Ctrl+Alt+F2 or another F key.
- Run 'nvidia-xrun <application>' and enter your password. I recommend installing a basic window manager such as openbox and running 'nvidia-xrun openbox' to be able to run and switch between apps in the same tty.
- In my case, when I try to run nvidia-xrun first time after boot, it throws some errors and quits after a few seconds. Run it again, it should work this time.
- When done, quit the applicatin. After entering root password for another time, it should unload modules and switch off the card.
- Exit tty (Ctrl+Alt+F1 or some other F key. Switching between tty's is also possible while nvidia-xrun is running.)

If you still experience high power drain on idle, even when Nvidia card is not used, try setting pcie_port_pm=on in kernel parameters.

Note: It's possible to use Bumblebee on this machine. It just wasn't power efficient enough in my case so I switched to nvidia-xrun. Check pages 3-4 of this thread or the Arch Wiki page of 9570 (https://wiki.archlinux.org/index.php/Dell_XPS_15_9570) for more info on how to utilize Bumblebee on this model.

UPDATE AND NEW SOLUTION: Alright it seems that we have a better solution that works with bumblebee:

Graff wrote:

After few days of experimenting and testing suggestions from this thread I was able to get switchable graphics to work on my XPS (1.5.0 bios, 4.20 kernel and nvidia 415.25). In my case, the main issue was automatic loading of nvidia modules on boot, immediately after decrypting my drive. Blacklisting by 'blacklist' option in /etc/modprobe.d/blacklist.conf didn't work. Additionally together with nvidia modules ipmi_msghandler and ipmi_devintf were loaded and they prevented unloading of nvidia. I had to use "install module_name /bin/false" command to successfully block loading of these three modules.

However, this metod also disabled loading of modules manually, by using "modprobe -a" command. Renaming / removing this file removes this obstacle, therefore in my scripts I append / remove .disable extension from conf file which holds install directive for nvidia module.

In this configuration my power consumption is ~4W on iGPU. After enabling dGPU and loading nvidia drivers it jumps to 6-7W. After disabling GPU it goes back to ~4W.

Bellow I attached my guide (as I usually prefer to write myself some instructions, as I will not remember details when I will have to do this again). I would be grateful if somebody would be able to reproduce my results by using this configuration (as I may already forgot some details). It is written in markdown.

# XPS 15 9570 - Nvidia Switchable

Guide to setup on/off operation of GPU. Based on works collected in [this](https://bbs.archlinux.org/viewtopic.php?id=238389) thread.

GPU management scripts were created by [tyrells](https://bbs.archlinux.org/viewtopic.php?pid=1825298#p1825298) to which manipulation of blacklist config was added.

## Packages
- nvidia
- bumblebee (for optirun)
- tlp (optional)
- powertop (optional - for verification)
- unigine-valley (aur, optional - for verification)

This guide should be easily adapted to *xrun* as *bumblebee* is only used for *optirun*.

## Configuration

### /etc/default/tlp
Add GPU to TLP **RUNTIME_PM_BLACKLIST**.
```
RUNTIME_PM_BLACKLIST="01:00.0"
```

### /etc/bumblebee/bumblebee.conf
```
Driver=nvidia
```
And in nvidia section:
```
PMMethod=none
```

### /etc/tempfiles.d/nvidia_pm.conf
Allow gpu to poweroff on boot
```
w /sys/bus/pci/devices/0000:01:00.0/power/control - - - - auto
```
###  /etc/X11/xorg.conf.d/01-noautogpu.conf 
```
Section "ServerFlags"
	Option "AutoAddGPU" "off"
EndSection
```

### /etc/X11/xorg.conf.d/20-intel.conf    
```
Section "Device"
 Identifier  "Intel Graphics"
 Driver      "modesetting"
EndSection
``` 

## Create blacklist files

### /etc/modprobe.d/blacklist.conf
```
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
blacklist nv
blacklist nvidia
blacklist nvidia-drm
blacklist nvidia-modeset
blacklist nvidia-uvm
blacklist ipmi_msghandler
blacklist ipmi_devintf 
```

### /etc/modprobe.d/disable-ipmi.conf
These modules are loaded together with nvidia and block its unloading. I do not need [ipmi](https://en.wikipedia.org/wiki/Intelligent_Platform_Management_Interface) therefore I simply disabled this functionality.
```
install ipmi_msghandler /usr/bin/false
install ipmi_devintf /usr/bin/false
```

### /etc/modprobe.d/disable-nvidia.conf
```
install nvidia /bin/false
```

## Create GPU management scripts
GPU management scripts were created by [tyrells](https://bbs.archlinux.org/viewtopic.php?pid=1825298#p1825298) to which manipulation of blacklist config was added.

Create two following management scripts. Creation of aliases is recommended.

### enableGpu.sh
``` bash
#!/bin/sh
# allow to load nvidia module
mv /etc/modprobe.d/disable-nvidia.conf /etc/modprobe.d/disable-nvidia.conf.disable

# remove NVIDIA card (currently in power/control = auto)
echo -n 1 > /sys/bus/pci/devices/0000\:01\:00.0/remove
sleep 1
# change PCIe power control
echo -n on > /sys/bus/pci/devices/0000\:00\:01.0/power/control
sleep 1
# rescan for NVIDIA card (defaults to power/control = on)
echo -n 1 > /sys/bus/pci/rescan
```

### disableGpu.sh
``` bash
modprobe -r nvidia_drm
modprobe -r nvidia_uvm
modprobe -r nvidia_modeset
modprobe -r nvidia

# change NVIDIA card power control
echo -n auto > /sys/bus/pci/devices/0000\:01\:00.0/power/control
sleep 1
# change PCIe power control
echo -n auto > /sys/bus/pci/devices/0000\:00\:01.0/power/control
sleep 1

# lock system form loading nvidia module
mv /etc/modprobe.d/disable-nvidia.conf.disable /etc/modprobe.d/disable-nvidia.conf
```

## Create service which locks GPU on shutdown
Service which locks GPU on shutdown / restart when it is not disabled by *disableGpu.sh* script is necessary. Otherwise on next boot nvidia will be loaded together with *ipmi* modules (even if we have blacklist with *install* command for them) and it would not be possible to unload them.

### /etc/systemd/system/disable-nvidia-on-shutdown.service
```
[Unit]
Description=Disables Nvidia GPU on OS shutdown

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=/bin/bash -c "mv /etc/modprobe.d/lock-nvidia.conf.disable /etc/modprobe.d/lock-nvidia.conf || true"

[Install]
WantedBy=multi-user.target
```

## Enabling
Reload systemd daemons and enable service:
``` bash
systemctl daemon-reload 
systemctl enable disable-nvidia-on-shutdown.service
```

## Final remarks
1. Reboot and verify that nvidia is not loaded ```lsmod | grep nvidia```
2. Disconnect charger and verify on *powertop* that power consumption is ~4W on idle (Dell XPS 4k, undervolt -168mV core / -145mV cache, disabled touchscreen, powertop --auto-tune)
3. Enable GPU by using script.
4. Verify if GPU is loaded by using ```nvidia-smi```
5. Run unigine-valley ```optirun unigine-valley```
6. Close all nvidia applications and disable gpu.
7. Check again power consumption, it should have similar value as before.

In my case I get ~4w on idle with GPU disabled and ~6W with GPU enabled.

Edit (as this is less visible in guide):
Again great thanks to tyrells for his opti-run.sh and opti-stop.sh (renamed here enableGpu.sh / disableGpu.sh as it better states their function) which serve as main switch here.

Somebody has any idea how to better solve blacklisting than file shuffling implemented by me?

I tried solution above and it worked but I had to add one more step: I had to ran `modprobe nvidia` after executing enableGpu.sh . Another user had same effect by running `nvidia-smi` (which also loads nvidia module). So if you get `Cannot access secondary GPU` or any similar error with this method, try adding `modprobe nvidia` to last line of the enableGpu.sh script. Be careful when testing though, in my case, `unigine-valley` did not teminate properly so I could not unload nvidia module. I had to manually kill `valley_x64` process to unload it.

Many thanks to everyone who put effort to solve this issue, you are awesome!

Last edited by LazyLucretia (2019-03-21 11:50:38)

Offline

#2 2018-06-29 02:20:23

Askannz
Member
Registered: 2016-10-22
Posts: 36

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Without using optirun, try to manually power on your card :

echo ON | sudo tee /proc/acpi/bbswitch

What is the output of 'cat /proc/acpi/bbswitch' after that ?

Offline

#3 2018-06-29 23:00:20

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

$ echo ON | sudo tee /proc/acpi/bbswitch 
ON

$ cat /proc/acpi/bbswitch 
0000:01:00.0 OFF

Btw, card is already powered on at the startup(according to powertop).

Last edited by LazyLucretia (2018-06-29 23:01:15)

Offline

#4 2018-06-30 05:44:51

Askannz
Member
Registered: 2016-10-22
Posts: 36

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Either your card is refusing to power on, or bbswitch is reporting it incorrectly. Anything popping up in dmesg ?

Offline

#5 2018-07-01 00:24:43

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

This popped up in dmesg when I tried 'echo ON | sudo tee /proc/acpi/bbswitch':

[  124.797063] bbswitch: enabling discrete graphics
[  124.840200] pci 0000:01:00.0: Refused to change power state, currently in D3
[  124.901281] pci 0000:01:00.0: Refused to change power state, currently in D3

I googled this error and found this: https://github.com/Bumblebee-Project/bb … issues/140 However, workarounds like 'pcie_port_pm=off' or ''acpi_osi=!Windows 2012'' did not work for me.

Offline

#6 2018-07-01 12:30:24

CiiDyR
Member
Registered: 2018-07-01
Posts: 3

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

I've got the exact same issue. These workarounds didn't work for me either.

I'm using TLP but even with PM disabled for both the proprietary nvidia driver and the pcie port it does not work.

Offline

#7 2018-07-01 22:09:31

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

CiiDyR wrote:

I've got the exact same issue. These workarounds didn't work for me either.

I'm using TLP but even with PM disabled for both the proprietary nvidia driver and the pcie port it does not work.

Have you tried it without TLP? Afaik, TLP does not play well with bbswitch.

Offline

#8 2018-07-01 22:42:23

CiiDyR
Member
Registered: 2018-07-01
Posts: 3

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Yes, I tried basically everything I could find about this.
With or without TLP, my card seems to be stuck in D3.

I can share my dmesg output if that's helpful.

Offline

#9 2018-07-01 23:07:36

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,743

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Update your UEFI if you aren't yet on the latest version. issues like that are often rooted in firmware.

Offline

#10 2018-07-02 01:05:58

CiiDyR
Member
Registered: 2018-07-01
Posts: 3

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

I did that already, unfortunately updating to the newest UEFI seems to have no effect besides fixing an unrelated issue with the bluetooth adapter.

Offline

#11 2018-07-02 07:13:39

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

V1del wrote:

Update your UEFI if you aren't yet on the latest version. issues like that are often rooted in firmware.

I'm already on the latest UEFI/BIOS.

Offline

#12 2018-07-02 16:49:45

IngeniousDox
Member
Registered: 2018-06-24
Posts: 25

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Dell XPS 15 9570 here aswell. Same problem. Intel GPU works, Intel+NVidia with PRIME Sync works. Bumblebee does not, stuck in d3.

I'm still reading up. However right now I found something that might be interesting. And even though I'm bookmarking, I figure I'll post some links here aswell, since I'm running out of time for today, and perhaps others can pick up where I left off.

Basically, it might be due to a new commit that addresses d3 states, I found info about it completely at the bottom of issue 140 on the bumblebee github:

https://github.com/Bumblebee-Project/bb … -394180574
https://github.com/torvalds/linux/commit/abf92f86361b

All of us with our new 9570 have probably been running kernels higher then 4.16.12. So we need to test a downgrade. And there is another option, that is testing the "pm-rework" rework branch of bbswitch.

Since I'm new to Arch, I'll have to start figuring out how to easily do either, perhaps one of you here might be able to get to it faster then me.

Dox

EDIT: Or what liskin is saying in the currently last comment might be interesting:

it seems that simply disabling bbswitch and enabling runtime-pm in laptop-mode-tools is enough for the dGPU to power off when the nvidia module is unloaded and power back on when it gets loaded

EDIT2: Last bit I can add before I have to run: Bumblebee can use other methods of disabling the dGPU. Perhaps it can use the method liskin is describing. Or we have to find the correct ACPI calls for it ourselves.

Last edited by IngeniousDox (2018-07-02 17:08:45)

Offline

#13 2018-07-02 18:55:35

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

I have also seen that issue thread and liskin's response. I tried manually unloading nouveau module and loading nvidia instead like liskin suggested and it worked, which explains why Prime switch works.

I also thought of doing a kernel downgrade but it would probably introduce some other maybe even nastier issues since there are commits in new kernel versions that specificaly target issues in 9570. Waiting for a kernel or UEFI/BIOS update might be a better idea.

Using pm-rework branch might worth a shot but I'm skeptical about how well it would work since latest commit on that branch is 2 years old.

Offline

#14 2018-07-02 19:08:05

IngeniousDox
Member
Registered: 2018-06-24
Posts: 25

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

At home now, eating, before rushing off again - browsing - found:

https://aur.archlinux.org/packages/bbswitch-pf/

EDIT: nevermind, that is for linux-pf.

Last edited by IngeniousDox (2018-07-02 19:10:41)

Offline

#15 2018-07-05 13:27:27

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

IngeniousDox wrote:

Dell XPS 15 9570 here aswell. Same problem. Intel GPU works, Intel+NVidia with PRIME Sync works. Bumblebee does not, stuck in d3.

I'm still reading up. However right now I found something that might be interesting. And even though I'm bookmarking, I figure I'll post some links here aswell, since I'm running out of time for today, and perhaps others can pick up where I left off.

Basically, it might be due to a new commit that addresses d3 states, I found info about it completely at the bottom of issue 140 on the bumblebee github:

https://github.com/Bumblebee-Project/bb … -394180574
https://github.com/torvalds/linux/commit/abf92f86361b

All of us with our new 9570 have probably been running kernels higher then 4.16.12. So we need to test a downgrade. And there is another option, that is testing the "pm-rework" rework branch of bbswitch.

Since I'm new to Arch, I'll have to start figuring out how to easily do either, perhaps one of you here might be able to get to it faster then me.

Dox

EDIT: Or what liskin is saying in the currently last comment might be interesting:

it seems that simply disabling bbswitch and enabling runtime-pm in laptop-mode-tools is enough for the dGPU to power off when the nvidia module is unloaded and power back on when it gets loaded

EDIT2: Last bit I can add before I have to run: Bumblebee can use other methods of disabling the dGPU. Perhaps it can use the method liskin is describing. Or we have to find the correct ACPI calls for it ourselves.

I just tried using Bumblebee without bbswitch and it works, Nvidia card is still on but Intel card is used by default for everything and I can run stuff with 'optirun' to use Nvidia card. However, I realized something: currently, running 'vblank_mode=0 glxgears' yields better results than running 'vblank_mode=0 optirun glxgears'(9200 FPS vs 3300 FPS). I also tried 'glxspheres64' and 'optirun' has barely made a difference(300 fps vs 400 fps). Next, I uninstalled Bumblebee and completely relied on Nvidia card/drivers to render everything. I ran 'glxgears' and 'glxspheres64' (without 'vblank_mode=0' there is no vsync on Nvidia drivers) and results were astonishing: 22600 FPS for glxgears and 3200 fps for glxspheres64. Looking at these results, I'm not sure if installing Bumblebee is going to worth all the hassle we have to go through.

Last edited by LazyLucretia (2018-07-05 13:56:01)

Offline

#16 2018-07-05 13:50:16

Askannz
Member
Registered: 2016-10-22
Posts: 36

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Well...

I wouldn't worry too much about it.

Offline

#17 2018-07-05 14:03:23

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Askannz wrote:

Well...

I wouldn't worry too much about it.

Yeah and I just found about this about 'glxspheres64': https://wiki.mageia.org/en/Bumblebee

You might be surprised to find that your Intel chipset gives a better framerate than the NVIDIA GPU with the glxspheres64 test. This is normal and likely due to the fact that the test is not really demanding hardware-wise, and the Intel chipset has direct access to your monitor, contrarily to the NVIDIA GPU with has to go through a bridge to access the monitor. To do a real benchmark, you will have more luck with a graphically-demanding application, e.g. SuperTuxKart or 0 A.D. with high-end graphics.

Edit: I tried a better benchmarking tool: https://aur.archlinux.org/packages/unigine-valley/ While using Nvidia driver directly is still superior, Nvidia with Bumblebee was still good enough and Intel GPU's performance was nowhere near.

Last edited by LazyLucretia (2018-07-05 15:20:31)

Offline

#18 2018-07-05 17:18:24

IngeniousDox
Member
Registered: 2018-06-24
Posts: 25

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

I had gotten past this part already, I just haven't had time to post. In Bumblebee configuration, you can set PMMethod to none, then it doesn't turn off the GPU at all. This allows you to use Optirun indeed, but not Primusrun (broken due to mesa, not related to our problem). And you can use nvidia-xrun to start another Xserver for use with PRIME Sync (however, this crashed my main xorg, will have to look into that.)

I also tried the pm-rework branch after creating a PKGBUILD for it. Without the last commit, since the last commit doesn't work. This didn't help.

I'm now looking more at runtime pm-suspend. I checked dmesg and I see that Nvidia is still being loaded (even though it is blacklisted) for nvidia-nvlink. I can't "modprobe -r nvidia" driver, due to various "ipmi" modules, and blacklisting them didn't work. Already someone posted an issues about that, but in bad English: https://github.com/Bumblebee-Project/bb … issues/173

Anyways, I think you should change the topic to something like: Dell XPS 15 - bbswitch not working, nvdia card won't resume. In the end we want to be able to turn off dGPU to save power. I'm running out of ideas myself, and might open a ticket on bbswitch github this weekend.

Dox

Last edited by IngeniousDox (2018-07-05 17:19:05)

Offline

#19 2018-07-05 17:56:32

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

IngeniousDox wrote:

I had gotten past this part already, I just haven't had time to post. In Bumblebee configuration, you can set PMMethod to none, then it doesn't turn off the GPU at all. This allows you to use Optirun indeed, but not Primusrun (broken due to mesa, not related to our problem). And you can use nvidia-xrun to start another Xserver for use with PRIME Sync (however, this crashed my main xorg, will have to look into that.)

I also tried the pm-rework branch after creating a PKGBUILD for it. Without the last commit, since the last commit doesn't work. This didn't help.

I'm now looking more at runtime pm-suspend. I checked dmesg and I see that Nvidia is still being loaded (even though it is blacklisted) for nvidia-nvlink. I can't "modprobe -r nvidia" driver, due to various "ipmi" modules, and blacklisting them didn't work. Already someone posted an issues about that, but in bad English: https://github.com/Bumblebee-Project/bb … issues/173

Anyways, I think you should change the topic to something like: Dell XPS 15 - bbswitch not working, nvdia card won't resume. In the end we want to be able to turn off dGPU to save power. I'm running out of ideas myself, and might open a ticket on bbswitch github this weekend.

Dox

Thanks for all your effort and input. I think the issue might be over our heads and require help from bbswitch or bumblebee developers.

I'm changing the title as you suggested.

Offline

#20 2018-07-05 21:11:52

IngeniousDox
Member
Registered: 2018-06-24
Posts: 25

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Actually, I'm having more success then I thought. The new branch "pm-suspend" does change something, though Bumblebee still doesn't work.

I can toggle bbswitch on / off now using "tee /proc/acpi/bbswitch <<<ON/OFF". Now when I use Optirun, I still get "Could not enable discrete card". But dmesg now shows me more:

[ 1604.957386] bbswitch: enabling discrete graphics
[ 1604.957449] bbswitch 0000:01:00.0: Refused to change power state, currently in D3
[ 1604.967293] ipmi message handler version 39.2
[ 1604.968514] ipmi device interface
[ 1604.981868] nvidia-nvlink: Nvlink Core is being initialized, major device number 237
[ 1604.982029] NVRM: This is a 64-bit BAR mapped above 4GB by the system
               NVRM: BIOS or the Linux kernel, but the PCI bridge
               NVRM: immediately upstream of this GPU does not define
               NVRM: a matching prefetchable memory window.
[ 1604.982030] NVRM: This may be due to a known Linux kernel bug.  Please
               NVRM: see the README section on 64-bit BARs for additional
               NVRM: information.
[ 1604.982032] nvidia: probe of 0000:01:00.0 failed with error -1
[ 1604.982040] NVRM: The NVIDIA probe routine failed for 1 device(s).
[ 1604.982041] NVRM: None of the NVIDIA graphics adapters were initialized!
[ 1604.982098] nvidia-nvlink: Unregistered the Nvlink Core, major device number 237

However, bbswitch does report ON now. So I think it is actually turning on the card now, but loading nvidia (nvidia-nvlink) is failing.

I'm not the only 1 that is noticing it: https://forums.fedoraforum.org/showthre … gt-4-16-7)

And that was the same thing that was failing to unload the other way around. So we are getting somewhere. Pointing to a kernel issue again.

EDIT: Or nvidia driver issue with kernel 4.17.

Last edited by IngeniousDox (2018-07-05 22:00:29)

Offline

#21 2018-07-06 07:23:45

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

I also tried "pm-rework" branch just now and it did not work. I installed nvidia and bumblebee, rebooted, fetched "pm-rework" branch and discarded last commit, ran "make" and "sudo make load". Right now Bumblebee works but I cannot turn off dGPU. "tee /proc/acpi/bbswitch <<<OFF" makes no change and gives me this in dmesg:

[  189.799931] bbswitch: Could not bind to device, is it in use by an other driver?

Offline

#22 2018-07-06 07:32:55

IngeniousDox
Member
Registered: 2018-06-24
Posts: 25

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Yeah, thats the "failing to unload other way around" that I was talking about. When you leave the card on during boot so it is available, you cannot turn it off. Since the "ipmi" are loaded and require nvidia module. So bbswitch cannot unload it.

However, ff you set bumblebee.conf (or bbswitch module options) to disable the card on boot (before the driver is loaded for the first time). Then you can use bbswitch to turn the card on / off. However, using bumblebee fails on the nvlink-error, nvidia driver is never loaded.

Offline

#23 2018-07-06 07:51:06

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Yep, I just added bbswitch to '/usr/lib/modules/extramodules-4.17-ARCH/' and the situation is exactly same with your's right now.

I also noticed something when I checked dmesg right after boot. bbswitch has tried to change power state of dGPU multiple times before successfuly disabling it.

[    2.770988] bbswitch: loading out-of-tree module taints kernel.
[    2.771326] bbswitch: version 0.8
[    2.771329] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[    2.771333] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
[    2.771405] bbswitch: detected an Optimus _DSM function
[    2.771407] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on
[    2.772328] bbswitch: disabling discrete graphics
[    3.080007] bbswitch 0000:01:00.0: Refused to change power state, currently in D0
[    5.136840] bbswitch: enabling discrete graphics
[    5.160537] bbswitch 0000:01:00.0: Refused to change power state, currently in D3
[    7.306730] bbswitch: disabling discrete graphics
[   12.980371] bbswitch: enabling discrete graphics
[   12.980429] bbswitch 0000:01:00.0: Refused to change power state, currently in D3
[   15.413471] bbswitch: disabling discrete graphics

Last edited by LazyLucretia (2018-07-06 08:28:16)

Offline

#24 2018-07-06 11:34:30

LazyLucretia
Member
Registered: 2016-01-28
Posts: 39

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

Well, I have just tried downgrading the kernel and ended up with an unbootable system... so I do not recommend it.

Edit: I tried 4.16.11 so at least do not try that one. I had to recover it using a live usb and chroot.

Last edited by LazyLucretia (2018-07-06 12:11:05)

Offline

#25 2018-07-06 15:41:17

michelesr
Member
Registered: 2016-02-04
Posts: 64

Re: [SOLVED] Dell XPS 9570 bbswitch not working, Nvdia won't power off/on

For me using bumblebee with this model never worked (since I opened this thread here: https://bbs.archlinux.org/viewtopic.php?id=237866) ... I know that is not a solution but I'm quite happy with nvidia-xrun to run X with the discrete card, and acpi_call to switch the card off when not needed (although this may hang the system on specific operations that can query the card controller, like running lspci or attempt to start an X server).

Offline

Board footer

Powered by FluxBB