Bumblebee-Project / bbswitch

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

Unable to switch off NVIDA card via bbswitch on Thinkpad T540p #96

Closed oliverwelter closed 8 years ago

oliverwelter commented 10 years ago

Hello, I'm trying to use bbswitch-0.8 for turning off the GeForce GT 730M on a Lenovo Thinkpad T540p. The state shown in /proc/acpi/bbswitch stays on 'ON' independent of load_state and manual setting. The power consumption supports the suspicion that the card is still running.

cat /etc/modprobe.d/bbswitch.conf:
options bbswitch load_state=0 unload_state=1

I also tried to switch off manually: 
cat /proc/acpi/bbswitch:
0000:01:00.0 ON

tee /proc/acpi/bbswitch <<<OFF:
OFF

cat /proc/acpi/bbswitch:
0000:01:00.0 ON

dmesg | grep -C 10 bbswitch:
  80.096972] IPv6: ADDRCONF(NETDEV_UP): wlp4s0: link is not ready
[   80.102515] iwlwifi 0000:04:00.0: L1 Enabled; Disabling L0S
[   80.102856] iwlwifi 0000:04:00.0: L1 Enabled; Disabling L0S
[   80.114086] IPv6: ADDRCONF(NETDEV_UP): wlp4s0: link is not ready
[   80.220897] e1000e: enp0s25 NIC Link is Down
[   80.318107] e1000e 0000:00:19.0: irq 42 for MSI/MSI-X
[   80.418589] e1000e 0000:00:19.0: irq 42 for MSI/MSI-X
[   80.418666] IPv6: ADDRCONF(NETDEV_UP): enp0s25: link is not ready
[   83.141353] e1000e: enp0s25 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
[   83.141382] IPv6: ADDRCONF(NETDEV_CHANGE): enp0s25: link becomes ready
[ 1696.021986] bbswitch: version 0.8
[ 1696.021990] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.VID_
[ 1696.021995] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG_.VID_
[ 1696.022003] ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20140424/nsarguments-95)
[ 1696.022308] bbswitch: detected an Optimus _DSM function
[ 1696.022318] pci 0000:01:00.0: enabling device (0000 -> 0003)
[ 1696.022345] bbswitch: disabling discrete graphics
[ 1696.022348] ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20140424/nsarguments-95)
[ 1696.033095] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on
[ 1718.636370] bbswitch: disabling discrete graphics
[ 1718.636381] ACPI Warning: \_SB_.PCI0.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20140424/nsarguments-95)
[ 1718.636910] ------------[ cut here ]------------
[ 1718.636917] WARNING: CPU: 1 PID: 6333 at drivers/pci/pci.c:1535 pci_disable_device+0x9c/0xb0()
[ 1718.636920] pci 0000:01:00.0: disabling already-disabled device
[ 1718.636921] Modules linked in:
[ 1718.636922]  bbswitch(O) ctr ccm acpi_call(O) dm_crypt wacom snd_usb_audio snd_usbmidi_lib snd_rawmidi snd_seq_device uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core hid_logitech_dj snd_hda_codec_hdmi arc4 snd_hda_codec_generic x86_pkg_temp_thermal dm_mod kvm_intel kvm iwlmvm mac80211 crc32c_intel aesni_intel aes_x86_64 i915 joydev iwlwifi fbcon bitblit cfbfillrect softcursor font cfg80211 cfbimgblt i2c_algo_bit cfbcopyarea wmi drm_kms_helper drm fb thinkpad_acpi fbdev snd_hda_intel intel_gtt snd_hda_controller e1000e rfkill agpgart snd_hda_codec ehci_pci ptp ehci_hcd video pps_core snd_hwdep vboxnetadp(O) vboxnetflt(O) vboxdrv(O)
[ 1718.636958] CPU: 1 PID: 6333 Comm: tee Tainted: G           O  3.16.3-gentoo #2
[ 1718.636960] Hardware name: LENOVO 20BFS05L00/20BFS05L00, BIOS GMET66WW (2.14 ) 07/01/2014
[ 1718.636961]  0000000000000009 ffff880370f3bdd8 ffffffff8156f45b ffff880370f3be20
[ 1718.636963]  ffff880370f3be10 ffffffff81060a28 ffff8804283ba000 ffff88042836ca30
[ 1718.636965]  0000000000000004 ffff880370f3bf50 0000000000000008 ffff880370f3be70
[ 1718.636967] Call Trace:
[ 1718.636973]  [<ffffffff8156f45b>] dump_stack+0x4e/0x7a
[ 1718.636976]  [<ffffffff81060a28>] warn_slowpath_common+0x78/0xa0
[ 1718.636978]  [<ffffffff81060a97>] warn_slowpath_fmt+0x47/0x50
[ 1718.636980]  [<ffffffff812ca6ac>] pci_disable_device+0x9c/0xb0

uname -a:
Linux barret 3.16.3-gentoo #2 SMP PREEMPT Sat Sep 20 12:56:47 CEST 2014 x86_64 Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz GenuineIntel GNU/Linux

Linux: Gentoo XOrg: 1.16.0.901 NVIDIA-Driver: official 343.13-r1 bbswitch-0.8

At the moment it is not possible to add comments on https://bugs.launchpad.net/bugs/752542 because of timeouts. I'm going to upload and link to the comment as soon as launchpad works again.

Kind Regards, Oliver

gsgatlin commented 9 years ago

@toxictee Does the solution at #112 help?

ghost commented 9 years ago

@gsgatlin Thank you, I tried this solution before. I thought the power usage is still to high, but it seems this is normal. But I still have an unfixed problem. On my screen are some flickering white pixels (like when you don't have a signal with your television - the white a black points, but in my case only the white ones). When I use save graphic mode at the os install everything works fine, but when I use the normal graphics installer or login after the install I get this flickering white pixels / points on the screen. Does anyone know this problem and how to fix it?

ArchangeGabriel commented 8 years ago

I’m marking this as a duplicate of #112. We definitevely have an issue since kernel 3.15 or 3.16 that probably started advertising Windows 2013 OSI by default, which resulted in some changes for _DSM methods.

ArchangeGabriel commented 8 years ago

@toxictee Also, no idea bout your latest issue, but if it’s related to normal rendering, the issue must lie on Intel/Mesa side.

late-in-autumn commented 8 years ago

Same issue, ThinkPad W541, running Manjaro.

$ dmesg|grep bbswitch [ 3.527919] bbswitch: version 0.8 [ 3.527923] bbswitch: Found integrated VGA device 0000:00:02.0: SB.PCI0.VID_ [ 3.527929] bbswitch: Found discrete VGA device 0000:01:00.0: SB.PCI0.PEG.VID [ 3.528290] bbswitch: detected an Optimus _DSM function [ 3.528334] bbswitch: disabling discrete graphics [ 3.541519] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on [ 3.542739] bbswitch: disabling discrete graphics [ 3.543132] Modules linked in: bbswitch(O) snd_hda_codec_hdmi joydev mousedev arc4 snd_hda_codec_realtek snd_hda_codec_generic nls_iso8859_1 nls_cp437 vfat fat msr intel_rapl iosf_mbi x86_pkg_temp_thermal iTCO_wdt iTCO_vendor_support intel_powerclamp coretemp kvm_intel iwlmvm kvm mac80211 crct10dif_pclmul crc32_pclmul i915 aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd iwlwifi evdev mac_hid snd_hda_intel snd_hda_controller serio_raw psmouse snd_hda_codec drm_kms_helper cfg80211 e1000e snd_hda_core drm snd_hwdep i2c_i801 lpc_ich snd_pcm ie31200_edac mei_me thinkpad_acpi snd_timer ptp intel_gtt mei edac_core i2c_algo_bit shpchp pps_core thermal wmi nvram snd soundcore rfkill ac tpm_tis battery tpm video button processor sch_fq_codel nfs lockd grace sunrpc fscache ip_tables x_tables [ 3.543170] [] bbswitch_off+0xb5/0x260 [bbswitch] [ 3.543171] [] bbswitch_proc_write+0xa5/0xc5 [bbswitch]

$ uname -r 4.1.15-1-MANJARO

$ lsb_release -a LSB Version: n/a Distributor ID: ManjaroLinux Description: Manjaro Linux Release: 15.12 Codename: Capella

$ lspci | grep Graphics 00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)

$ lspci | grep NVIDIA 01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1100M](rev a1)

Quardah commented 7 years ago

Hi all.

I am still having issues with this. bbswitch always shows the card as ON. I am on a T540p.

Here is my dmesg output :

[ 1010.113887] nvidia: module license 'NVIDIA' taints kernel. [ 1010.113889] Disabling lock debugging due to kernel taint [ 1010.136380] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=none:owns=none [ 1010.136466] nvidia-nvlink: Nvlink Core is being initialized, major device number 242 [ 1010.136490] NVRM: loading NVIDIA UNIX x86_64 Kernel Module 370.28 Thu Sep 1 19:45:04 PDT 2016 [ 1010.214579] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1010.214679] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1010.214754] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1010.214829] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1010.215099] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1010.215343] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1010.215419] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1010.241943] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1010.466110] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms 370.28 Thu Sep 1 19:18:48 PDT 2016 [ 1013.308844] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1013.311884] nvidia-modeset: Unloading [ 1013.322928] nvidia-nvlink: Unregistered the Nvlink Core, major device number 242 [ 1013.340398] bbswitch: disabling discrete graphics [ 1013.340405] ACPI Warning: _SB.PCI0.PEG.VID._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires Package [ 1013.340629] ------------[ cut here ]------------ [ 1013.340633] WARNING: CPU: 1 PID: 310 at drivers/pci/pci.c:1616 pci_disable_device+0xa8/0xd0 [ 1013.340633] pci 0000:01:00.0: disabling already-disabled device [ 1013.340634] Modules linked in: [ 1013.340634] fuse ctr ccm snd_hda_codec_hdmi bnep uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core btusb videodev btrtl btbcm btintel media bluetooth joydev mousedev iTCO_wdt iTCO_vendor_support arc4 msr bbswitch(O) mei_wdt intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd intel_cstate evdev intel_rapl_perf input_leds mac_hid psmouse pcspkr i2c_i801 i2c_smbus iwlmvm mac80211 lpc_ich iwlwifi cfg80211 rtsx_pci_ms i915 memstick snd_hda_codec_realtek snd_hda_codec_generic e1000e drm_kms_helper snd_hda_intel snd_hda_codec ptp mei_me snd_hda_core pps_core mei drm snd_hwdep intel_gtt syscopyarea snd_pcm sysfillrect sysimgblt fb_sys_fops [ 1013.340651] i2c_algo_bit ie31200_edac snd_timer shpchp edac_core thermal thinkpad_acpi wmi nvram snd soundcore led_class rfkill battery ac fjes video tpm_tis tpm_tis_core tpm button mmc_block sch_fq_codel vboxnetflt(O) vboxnetadp(O) pci_stub vboxpci(O) vboxdrv(O) acpi_call(O) ip_tables x_tables ext4 crc16 jbd2 fscrypto mbcache sr_mod sd_mod cdrom rtsx_pci_sdmmc mmc_core serio_raw atkbd libps2 ahci libahci libata scsi_mod xhci_pci ehci_pci xhci_hcd ehci_hcd rtsx_pci usbcore usb_common i8042 serio [last unloaded: nvidia] [ 1013.340664] CPU: 1 PID: 310 Comm: bumblebeed Tainted: P O 4.8.4-1-ARCH #1 [ 1013.340665] Hardware name: LENOVO 20BE003NUS/20BE003NUS, BIOS GMET76WW (2.24 ) 08/17/2016 [ 1013.340666] 0000000000000286 0000000057951fa4 ffff8804249a3cf8 ffffffff812fe480 [ 1013.340667] ffff8804249a3d48 0000000000000000 ffff8804249a3d38 ffffffff8107c85b [ 1013.340668] 0000065000000000 ffff88042bf49000 ffff88042bf06ee0 00000000020b9260 [ 1013.340670] Call Trace: [ 1013.340674] [] dump_stack+0x63/0x83 [ 1013.340675] [] warn+0xcb/0xf0 [ 1013.340676] [] warn_slowpath_fmt+0x5f/0x80 [ 1013.340677] [] ? pci_set_master+0x3b/0xf0 [ 1013.340678] [] pci_disable_device+0xa8/0xd0 [ 1013.340680] [] bbswitch_off+0xad/0x240 [bbswitch] [ 1013.340681] [] bbswitch_proc_write+0xb0/0xc7 [bbswitch] [ 1013.340683] [] proc_reg_write+0x42/0x70 [ 1013.340685] [] __vfs_write+0x37/0x140 [ 1013.340687] [] ? percpu_down_read+0x17/0x50 [ 1013.340688] [] vfs_write+0xb6/0x1a0 [ 1013.340689] [] SyS_write+0x55/0xc0 [ 1013.340690] [] entry_SYSCALL_64_fastpath+0x1a/0xa4 [ 1013.340691] ---[ end trace f98d0a53707eca25 ]--- [ 1013.356190] pci 0000:01:00.0: Refused to change power state, currently in D0

I tried this : (found here : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763272)

The workaround given was to append acpi_osi=\"!Windows 2013\" to the GRUB_CMDLINE_LINUX_DEFAULT variable in /etc/default/grub and run update-grub.

It has not changed anything.

I am on 4.8.4-1-ARCH

I am super lost in this. Thanks. JP

Quardah commented 7 years ago

Hi all.

I tried as mentionned the "acpi_osi=!Windows 2013" argument, it didn't do anything. I tried also adding "acpi_osi=Linux" argument as boot param, it made it impossible to load the "nvidia" kernel driver.

Now i took both down and i'm pretty desperate.

I'll have to stick with my old laptop until i can turn off this stupid card.

Thanks for your help, hopefully someone will enlighten me i am out of clues.

EDIT :

This might help :

[jape@T540p ~]$ dmesg | grep bbswitch [ 3.245470] bbswitch: version 0.8 [ 3.245475] bbswitch: Found integrated VGA device 0000:00:02.0: SB.PCI0.VID_ [ 3.245481] bbswitch: Found discrete VGA device 0000:01:00.0: SB.PCI0.PEG.VID [ 3.245778] bbswitch: detected an Optimus _DSM function [ 3.245785] bbswitch: device 0000:01:00.0 is in use by driver 'nvidia', refusing OFF [ 3.245787] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on [ 5.541793] bbswitch: disabling discrete graphics

Somehow the device is "refusing OFF" because it's used by nvidia?

But where? I have no clue where to check.

This is painfull really u_u

jeannotalpin commented 7 years ago

Using Ubuntu from now on, adding the below parameters to the booting lines and configuring correctly the bumblebee.conf file, I have the correct behaviour for bbswitch. "acpi_osi=!Windows\x202013" acpi_osi=Linux nogpumanager Hope it helps, Jean.

haffenloher commented 7 years ago

The only thing that helped me turn off my card is altering akmods.service as described here: https://github.com/Bumblebee-Project/bbswitch/issues/120#issuecomment-180095778

Quardah commented 7 years ago

Thanks to both of you.

I will try to add the lines in my boot parameters, i'll come back to tell you if it worked.

Also, i do not having akmods.service. (Runnning on Arch Linux, doesn't seem to be in there).

Thanks

Quardah commented 7 years ago

Holy shiiiiiiiiiiiiiiiiiit jeannotalpin that worked

thanks mate that's really appreciated. Now is 23:25, i have been trying to fix this since 10:30 in the morning.

Thanks man you're a life saver.

Hopefully someone will read this and this will help them

Cheers!

ph03 commented 7 years ago

Awesome @jeannotalpin, that kernel parameter line is working for me on Ubuntu 16.10 4.8.0-30-generic W541 as well, thank you, I can finally turn of the dGPU again :+1:

afro-coder commented 7 years ago

@ph03 the kernel parameters go in grub cmdline right?

Quardah commented 7 years ago

@leon9923

Yes.

Either add into /etc/default/grub like this : (and run "# grub-mkconfig -o /boot/grub/grub.cfg" after)

GRUB_CMDLINE_LINUX_DEFAULT="quiet 'acpi_osi=!Windows\x202013' acpi_osi=Linux nogpumanager intel_iommu=on"

Or while booting in grub press "e" to add cmdlines (won't persist after reboot, best for testing)

afro-coder commented 7 years ago

Does this still work? @Quardah It messed up the rollback drivers also in my system.

Quardah commented 7 years ago

@leon9923

Yes it works right now on the T540p.

kieselnb commented 7 years ago

Huge shoutout to @oliverwelter for the acpi_osi command line arg. dGPU is actually turning on/off with bumblebee and I get much better battery life

W540, 4.8.13-1-ARCH Changed in /etc/default/grub: GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_osi='!Windows 2013'"

jdevelop commented 7 years ago

Helped me a lot, thanks @jeannotalpin !