Bumblebee-Project / bbswitch

Disable discrete graphics (currently nvidia only)
GNU General Public License v2.0
487 stars 78 forks source link

GT650M on Inspiron 7720 won't turn on #83

Closed amitarvind closed 10 years ago

amitarvind commented 10 years ago

This used to work before for this laptop, so I'm not sure at what point it changed. I'm only just now getting time to work on the issue and tried upgrading the kernel and the driver today. /proc/acpi/bbswitch shows the gpu as OFF and it refuses to turn on, showing the message: nvidia 0000:01:00.0: Refused to change power state, currently in D3

sending "_PS0" to acpi_call seems to go through without error but never successfully turns the card on. All the requested info is below.

# dmesg | grep -C 10 bbswitch:
[   15.649777] iwlwifi 0000:02:00.0: L1 Enabled; Disabling L0S
[   15.657304] iwlwifi 0000:02:00.0: Radio type=0x2-0x0-0x0
[   15.909156] iwlwifi 0000:02:00.0: L1 Enabled; Disabling L0S
[   15.916675] iwlwifi 0000:02:00.0: Radio type=0x2-0x0-0x0
[   16.881073] wlp2s0: authenticate with 7c:05:07:54:8b:bf
[   16.887628] wlp2s0: send auth to 7c:05:07:54:8b:bf (try 1/3)
[   16.890476] wlp2s0: authenticated
[   16.892526] wlp2s0: associate with 7c:05:07:54:8b:bf (try 1/3)
[   16.895995] wlp2s0: RX AssocResp from 7c:05:07:54:8b:bf (capab=0x431 status=0 aid=4)
[   16.916098] wlp2s0: associated
[   27.377381] bbswitch: version 0.7
[   27.377386] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[   27.377389] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
[   27.377410] ACPI Warning: \_SB_.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20130725/nsarguments-95)
[   27.377577] bbswitch: detected an Optimus _DSM function
[   27.377581] bbswitch: enabling discrete graphics
[   27.377584] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is off
[   33.409789] bbswitch: enabling discrete graphics
[   33.421415] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[   48.950265] bbswitch: enabling discrete graphics
[   48.962476] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[   64.759147] bbswitch: enabling discrete graphics
[   64.770585] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[   96.293626] bbswitch: enabling discrete graphics
[   96.306624] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  127.833929] bbswitch: enabling discrete graphics
[  127.845932] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  157.866241] bbswitch: enabling discrete graphics
[  157.876934] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  189.403298] bbswitch: enabling discrete graphics
[  189.416265] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  219.428803] bbswitch: enabling discrete graphics
[  219.440506] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  250.964010] bbswitch: enabling discrete graphics
[  250.979864] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  281.000877] bbswitch: enabling discrete graphics
[  281.014269] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  312.535758] bbswitch: enabling discrete graphics
[  312.546908] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  344.073764] bbswitch: enabling discrete graphics
[  344.086224] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  374.110903] bbswitch: enabling discrete graphics
[  374.123925] nvidia 0000:01:00.0: Refused to change power state, currently in D3
[  405.648655] bbswitch: enabling discrete graphics
[  405.659947] nvidia 0000:01:00.0: Refused to change power state, currently in D3

# uname -a
Linux saida 3.12.7-gentoo #1 SMP PREEMPT Sat Jan 11 10:30:32 CST 2014 x86_64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz GenuineIntel GNU/Linux

Distribution: Gentoo

# Xorg -version

X.Org X Server 1.13.4
Release Date: 2013-04-17
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.10.7-gentoo x86_64 Gentoo
Current Operating System: Linux saida 3.12.7-gentoo #1 SMP PREEMPT Sat Jan 11 10:30:32 CST 2014 x86_64
Kernel command line: BOOT_IMAGE=/kernel-3.12.7-gentoo root=/dev/sda3 ro rcutree.rcu_idle_gp_delay=1
Build Date: 13 September 2013  09:04:27PM

Current version of pixman: 0.28.0

# emerge -s nvidia-drivers
Searching...    
[ Results for search key : nvidia-drivers ]
[ Applications found : 1 ]

*  x11-drivers/nvidia-drivers
      Latest version available: 331.20
      Latest version installed: 331.20
      Size of files: 58,606 kB
      Homepage:      http://www.nvidia.com/
      Description:   NVIDIA X11 driver and GLX libraries
      License:       GPL-2 NVIDIA-r1

# cat /proc/acpi/dump_info 
0000:00:00.0 060000 
0000:00:01.0 060400 \_SB_.PCI0.PEG0
0000:00:02.0 030000 \_SB_.PCI0.GFX0
0000:00:14.0 0c0330 \_SB_.PCI0.XHC_
0000:00:16.0 078000 
0000:00:1a.0 0c0320 \_SB_.PCI0.EHC2
0000:00:1b.0 040300 \_SB_.PCI0.HDEF
0000:00:1c.0 060400 \_SB_.PCI0.RP01
0000:00:1c.4 060400 \_SB_.PCI0.RP05
0000:00:1d.0 0c0320 \_SB_.PCI0.EHC1
0000:00:1f.0 060100 \_SB_.PCI0.LPCB
0000:00:1f.2 010601 \_SB_.PCI0.SAT0
0000:00:1f.3 0c0500 \_SB_.PCI0.SBUS
0000:01:00.0 030000 \_SB_.PCI0.PEG0.PEGP
0000:02:00.0 028000 \_SB_.PCI0.RP01.PXSX
0000:03:00.0 020000 \_SB_.PCI0.RP05.PXSX

URL to requested tarball: https://bugs.launchpad.net/lpbugreporter/+bug/752542/comments/675

amitarvind commented 10 years ago

actual url to tarball instead of my goofy comment on the bugtracker: https://bugs.launchpad.net/lpbugreporter/+bug/752542/+attachment/3946298/+files/Dell_Inc.-Inspiron_7720.tar.gz

amitarvind commented 10 years ago

Either you guys are very busy or I'm missing something from this. If you could, please let me know what I'm missing from my info and I can supply it. Thanks.

ArchangeGabriel commented 10 years ago

@Lekensteyn is indeed very busy with exams, and I have no idea of what is wrong here.

Lekensteyn commented 10 years ago

Yes, I saw this issue and anticipated that it would take some time. However, seeing the line "nvidia 01:00.0" just below "bbswitch" immediately reveals what is wrong: nvidia should not be loaded when bbswitch turned the device off. You must blacklist nvidia with kmod to ensure that it does not get loaded automatically (e.g. while bbswitch has disabled the device).

amitarvind commented 10 years ago

The results seem promising, actually. I'm a little surprised because I can't remember needing to blacklist nvidia. Either way, before testing, the output of dmesg:

dmesg

... [ 27.333427] bbswitch: version 0.8 [ 27.333436] bbswitch: Found integrated VGA device 0000:00:02.0: SB.PCI0.GFX0 [ 27.333441] bbswitch: Found discrete VGA device 0000:01:00.0: SB.PCI0.PEG0.PEGP [ 27.333453] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 27.333787] bbswitch: detected an Optimus _DSM function [ 27.333800] pci 0000:01:00.0: enabling device (0006 -> 0007) [ 27.333845] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on [ 27.336466] bbswitch: disabling discrete graphics [ 27.336476] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 40.317159] bbswitch: enabling discrete graphics [ 41.730885] nvidia: module license 'NVIDIA' taints kernel. [ 41.730889] Disabling lock debugging due to kernel taint [ 41.735710] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=none:owns=none [ 41.735832] [drm] Initialized nvidia-drm 0.0.0 20130102 for 0000:01:00.0 on minor 1 [ 41.735838] NVRM: loading NVIDIA UNIX x86_64 Kernel Module 331.38 Wed Jan 8 19:32:30 PST 2014 [ 45.037535] nvidia 0000:01:00.0: irq 47 for MSI/MSI-X [ 45.042859] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 45.042895] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 45.042908] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 45.042920] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 45.042931] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 45.043237] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 45.043382] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 45.043394] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 49.295105] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 49.320392] NVRM: GPU at 0000:01:00.0 has fallen off the bus. [ 49.320397] NVRM: os_pci_init_handle: invalid context! [ 49.320399] NVRM: os_pci_init_handle: invalid context! [ 49.320403] NVRM: GPU at 0000:01:00.0 has fallen off the bus. [ 49.320405] NVRM: os_pci_init_handle: invalid context! [ 49.320406] NVRM: os_pci_init_handle: invalid context! [ 49.334919] NVRM: RmInitAdapter failed! (0x25:0x28:1156) [ 49.334926] NVRM: rm_init_adapter failed for device bearing minor number 0 [ 49.334941] NVRM: nvidia_frontend_open: minor 0, module->open() failed, error -5 [ 49.335282] NVRM: request_irq() failed (-22) [ 49.335285] NVRM: nvidia_frontend_open: minor 0, module->open() failed, error -22

$ optirun cat /proc/acpi/bbswitch [ 283.930317] [ERROR]Cannot access secondary GPU - error: XORG NVIDIA(GPU-0): Failed to initialize the NVIDIA GPU at PCI:1:0:0. Please

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

dmesg

... [ 66.510212] bbswitch: enabling discrete graphics [ 66.522502] nvidia 0000:01:00.0: Refused to change power state, currently in D3

So, back to square one again.

amonakov commented 10 years ago

The "fallen off the bus" etc. is probably due to nvidia - kernel 3.10 incompatibility. See https://github.com/Bumblebee-Project/Bumblebee/issues/455

amitarvind commented 10 years ago

Yeah, I saw that particular ticket but the last I saw of it, it hadn't been reopened yet. If I'm understanding the other ticket correctly, you're not necessarily suggesting a rollback to pre-3.10, right?

It seems worth mentioning that past 3.10, I was still running the 325.15 driver, and it worked for a bit, and then stopped. Nvidia's compatibility issues with our kernels makes my head hurt.

amonakov commented 10 years ago

That ticked has always been opened, except for a few hours a month ago.

The workaround described in the first comment there seems to work for many people.

amitarvind commented 10 years ago

Yeah, you can see in my grub cmdline cfg, I tried it. But! Not to worry, I finally figured out the problem. See here: http://forums.gentoo.org/viewtopic-t-935316-start-0.html . Look at the post timestamped Wed Sep 19, 2012 9:37 pm.

I'm still on 3.12.7 but I recompiled with the following options compiled: CONFIG_NO_HZ CONFIG_RCU_FAST_NO_HZ CONFIG_CALGARY_IOMMU CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT

dmesg

... 23.526664] bbswitch: version 0.8 [ 23.526673] bbswitch: Found integrated VGA device 0000:00:02.0: SB.PCI0.GFX0 [ 23.526680] bbswitch: Found discrete VGA device 0000:01:00.0: SB.PCI0.PEG0.PEGP [ 23.526691] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 23.527053] bbswitch: detected an Optimus _DSM function [ 23.527066] pci 0000:01:00.0: enabling device (0006 -> 0007) [ 23.527110] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on [ 23.529386] bbswitch: disabling discrete graphics [ 23.529394] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 37.299238] bbswitch: enabling discrete graphics [ 38.190770] nvidia: module license 'NVIDIA' taints kernel. [ 38.190773] Disabling lock debugging due to kernel taint [ 38.195798] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=none:owns=none [ 38.195928] [drm] Initialized nvidia-drm 0.0.0 20130102 for 0000:01:00.0 on minor 1 [ 38.195933] NVRM: loading NVIDIA UNIX x86_64 Kernel Module 331.38 Wed Jan 8 19:32:30 PST 2014 [ 38.751129] nvidia 0000:01:00.0: irq 47 for MSI/MSI-X [ 38.756391] ACPI Warning: SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package

That last line likes to spam a lot, but that's a known nuisance and frankly, a pet peeve I have with Dell's ACPI coding practices.

It works!

$ optirun glxspheres Polygons in scene: 62464 Visual ID of window: 0x20 Context is Direct OpenGL Renderer: GeForce GT 650M/PCIe/SSE2 253.578307 frames/sec - 282.993391 Mpixels/sec 288.744940 frames/sec - 322.239353 Mpixels/sec 255.175457 frames/sec - 345.011200 Mpixels/sec 191.765979 frames/sec - 379.236401 Mpixels/sec