Bumblebee-Project / bbswitch

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

bbswitch prevents suspend and taints kernel on ASUS UL80VT since linux 3.13 #100

Open guimillet opened 9 years ago

guimillet commented 9 years ago

Hi, I currently keep using kernel 3.11 from kubuntu 13.10 because bbswitch stopped working with kernels post 3.13 (from Ubuntu 14.04) on ASUS UL80VT (discrete nVidia G210M card, hybrid SLI system, pre-optimus). When initiating suspend (to RAM), the kernel gets tainted. Kernel 3.17 from 09/28 got tainted too.

I don't know if you noticed my original bug report on Ubuntu Launchpad https://bugs.launchpad.net/ubuntu/+source/bbswitch/+bug/1318040 where I got no useful answer. https://bugs.launchpad.net/ubuntu/+source/bbswitch/+bug/1318040/comments/7 should provide useful dmesg log.

martintama commented 9 years ago

I'm having the exact same issue on Linux Mint 17 (Based on Ubuntu 14.04) with the same machine (UL80VT).

ArchangeGabriel commented 8 years ago

Are you still facing this issue? (Launchpad bug seems unactive too).

guimillet commented 8 years ago

Yes, still facing the issue but I am now using kernel 4.2.0-23-generic with Kubuntu 15.10. I have removed bumblebee and bbswitch in order to use the laptop. For testing, I have just tested bbswitch-dkms again, 0.7-2ubuntu1, with gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2). I tried with bumblebee first, then with bumblebee-nvidia, 3.2.1-9. In both cases, X didn't start (see Xorg reports below). I tried, without bumblebee installed but only bbswitch, to load bbswitch after manually unloading nouveau from tty1 terminal: same error (see below) in dmesg appears; then, after starting sdsm and closing the lid to suspend the laptop, it freezes.

dmesg error when loading bbswitch (in the case of bumblebee installed, though the error is the same during the other tests mentioned above):

[   29.392369] bbswitch: module verification failed: signature and/or required key missing - tainting kernel
[   29.392632] bbswitch: version 0.7
[   29.392641] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.VGA_
[   29.392654] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.P0P1.VGA_
[   29.392670] ACPI Warning: \_SB_.PCI0.P0P1.VGA_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150619/nsarguments-95)
[   29.392726] ACPI Warning: \_SB_.PCI0.P0P1.VGA_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150619/nsarguments-95)
[   29.392835] bbswitch: detected a nVidia _DSM function
[   29.392870] pci 0000:01:00.0: enabling device (0000 -> 0003)
[   29.392945] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on
[   29.397136] bbswitch: disabling discrete graphics
[   29.416044] ACPI Warning: \_SB_.PCI0.P0P1.VGA_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150619/nsarguments-95)
[   29.557361] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=none,decodes=io+mem:owns=io+mem
[   29.608154] ------------[ cut here ]------------
[   29.608165] WARNING: CPU: 0 PID: 133 at /build/linux-AFqQDb/linux-4.2.0/fs/sysfs/group.c:224 sysfs_remove_group+0x93/0xa0()
[   29.608168] sysfs group ffffffff81cc2980 not found for kobject 'acpi_video1'
[   29.608171] Modules linked in: bbswitch(OE) binfmt_misc snd_hda_codec_hdmi uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep kvm_intel kvm snd_pcm arc4 snd_seq_midi snd_seq_midi_event snd_rawmidi joydev input_leds serio_raw ath9k snd_seq ath9k_common snd_seq_device ath9k_hw snd_timer ath lpc_ich mac80211 snd cfg80211 soundcore shpchp asus_laptop sparse_keymap input_polldev mac_hid cuse coretemp parport_pc ppdev lp parport autofs4 uas usb_storage mxm_wmi i915 i2c_algo_bit psmouse drm_kms_helper ahci libahci drm atl1c wmi video
[   29.608238] CPU: 0 PID: 133 Comm: kworker/u4:5 Tainted: G           OE   4.2.0-23-generic #28-Ubuntu
[   29.608240] Hardware name: ASUSTeK Computer Inc.         UL80VT              /UL80VT    , BIOS 214     01/17/2011
[   29.608246] Workqueue: kacpi_hotplug acpi_hotplug_work_fn
[   29.608249]  0000000000000000 00000000e4ac7dab ffff880035857a48 ffffffff817e94c9
[   29.608254]  0000000000000000 ffff880035857aa0 ffff880035857a88 ffffffff8107b3d6
[   29.608258]  ffff880035857a88 0000000000000000 ffffffff81cc2980 ffff880138c784a8
[   29.608262] Call Trace:
[   29.608269]  [<ffffffff817e94c9>] dump_stack+0x45/0x57
[   29.608274]  [<ffffffff8107b3d6>] warn_slowpath_common+0x86/0xc0
[   29.608278]  [<ffffffff8107b465>] warn_slowpath_fmt+0x55/0x70
[   29.608283]  [<ffffffff812770fc>] ? kernfs_find_and_get_ns+0x4c/0x60
[   29.608286]  [<ffffffff8127aa03>] sysfs_remove_group+0x93/0xa0
[   29.608291]  [<ffffffff81528977>] dpm_sysfs_remove+0x57/0x60
[   29.608295]  [<ffffffff8151c248>] device_del+0x58/0x260
[   29.608299]  [<ffffffff817ee666>] ? down_write+0x16/0x50
[   29.608303]  [<ffffffff8151c472>] device_unregister+0x22/0x70
[   29.608308]  [<ffffffff81446fcc>] backlight_device_unregister+0xac/0xc0
[   29.608315]  [<ffffffffc0000688>] acpi_video_bus_unregister_backlight.part.8+0x5e/0x111 [video]
[   29.608319]  [<ffffffffc0000e5d>] acpi_video_bus_remove+0xb5/0x11c [video]
[   29.608324]  [<ffffffff8145a945>] acpi_device_remove+0x80/0x9f
[   29.608327]  [<ffffffff81520821>] __device_release_driver+0xa1/0x150
[   29.608330]  [<ffffffff815208f3>] device_release_driver+0x23/0x30
[   29.608334]  [<ffffffff8145b468>] acpi_bus_trim+0x73/0x8d
[   29.608339]  [<ffffffff8142da3b>] disable_slot+0x7b/0xa0
[   29.608342]  [<ffffffff8142e182>] acpiphp_check_bridge.part.8+0xd2/0xf0
[   29.608346]  [<ffffffff8142e9f4>] acpiphp_hotplug_notify+0x174/0x250
[   29.608349]  [<ffffffff8142e880>] ? free_bridge+0x110/0x110
[   29.608353]  [<ffffffff8145d576>] acpi_device_hotplug+0x3af/0x40b
[   29.608356]  [<ffffffff814562df>] acpi_hotplug_work_fn+0x1f/0x2b
[   29.608361]  [<ffffffff810941ca>] process_one_work+0x1aa/0x440
[   29.608365]  [<ffffffff810944ab>] worker_thread+0x4b/0x4c0
[   29.608368]  [<ffffffff81094460>] ? process_one_work+0x440/0x440
[   29.608372]  [<ffffffff81094460>] ? process_one_work+0x440/0x440
[   29.608376]  [<ffffffff8109a868>] kthread+0xd8/0xf0
[   29.608379]  [<ffffffff8109a790>] ? kthread_create_on_node+0x1f0/0x1f0
[   29.608383]  [<ffffffff817f06df>] ret_from_fork+0x3f/0x70
[   29.608386]  [<ffffffff8109a790>] ? kthread_create_on_node+0x1f0/0x1f0
[   29.608389] ---[ end trace fca4e591b127ed3b ]---
[   36.057310] bbswitch: enabling discrete graphics
[   36.057326] ACPI Warning: \_SB_.PCI0.P0P1.VGA_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150619/nsarguments-95)

With bumblebee (nouveau), Xorg.0.log contains:

[    39.540] (==) FBDEV(0): Backing store enabled
[    39.540] (EE) FBDEV(0): FBIOPUTCMAP: Device or resource busy
... many repetitions of the line above
[    39.544] (==) FBDEV(0): DPMS enabled
[    39.544] (--) RandR disabled
[    39.571] (II) SELinux: Disabled on system
[    39.578] (II) AIGLX: Screen 0 is not DRI2 capable
[    39.579] (EE) AIGLX: reverting to software rendering
[    41.061] (II) AIGLX: Loaded and initialized swrast
[    41.061] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[    41.106] (II) modeset(G0): Damage tracking initialized
[    41.106] (EE) 
[    41.106] (EE) Backtrace:
[    41.141] (EE) 0: /usr/bin/X (xorg_backtrace+0x4e) [0x55c4670e768e]
[    41.141] (EE) 1: /usr/bin/X (0x55c466f33000+0x1b89f9) [0x55c4670eb9f9]
[    41.141] (EE) 2: /lib/x86_64-linux-gnu/libc.so.6 (0x7fbf69ca8000+0x352f0) [0x7fbf69cdd2f0]
[    41.141] (EE) 3: /usr/bin/X (RRSetChanged+0x50) [0x55c46704acc0]
[    41.141] (EE) 4: /usr/bin/X (RRScreenSetSizeRange+0x54) [0x55c46704f1e4]
[    41.141] (EE) 5: /usr/bin/X (xf86RandR12CreateScreenResources+0x2a5) [0x55c46700bd35]
[    41.141] (EE) 6: /usr/bin/X (0x55c466f33000+0xcc030) [0x55c466fff030]
[    41.141] (EE) 7: /usr/bin/X (0x55c466f33000+0x5c1b4) [0x55c466f8f1b4]
[    41.141] (EE) 8: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xf0) [0x7fbf69cc8a40]
[    41.141] (EE) 9: /usr/bin/X (_start+0x29) [0x55c466f796c9]
[    41.141] (EE) 
[    41.141] (EE) Segmentation fault at address 0xa0
[    41.141] (EE) 
Fatal server error:
[    41.141] (EE) Caught signal 11 (Segmentation fault). Server aborting

With bumblebee-nvidia, Xorg.0.log contains:

[    48.468] (II) NVIDIA(0): Creating default Display subsection in Screen section
    "nvidia" for depth/fbbpp 24/32
[    48.468] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32
[    48.468] (==) NVIDIA(0): RGB weight 888
[    48.468] (==) NVIDIA(0): Default visual is TrueColor
[    48.468] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[    48.468] (**) NVIDIA(0): Option "ConstrainCursor" "off"
[    48.468] (**) NVIDIA(0): Option "IgnoreDisplayDevices" "CRT"
[    48.468] (**) NVIDIA(0): Enabling 2D acceleration
[    48.499] (EE) NVIDIA(0): Failed to initialize the NVIDIA kernel module. Please see the
[    48.499] (EE) NVIDIA(0):     system's kernel log for additional error messages and
[    48.499] (EE) NVIDIA(0):     consult the NVIDIA README for details.
[    48.499] (EE) NVIDIA(0):  *** Aborting ***
[    48.499] (EE) NVIDIA(0): Failing initialization of X screen 0
[    48.499] (II) UnloadModule: "nvidia"
[    48.499] (II) UnloadSubModule: "wfb"
[    48.499] (II) UnloadSubModule: "fb"
...
[    48.556] (EE) Screen(s) found, but none have a usable configuration.
[    48.556] (EE) 
Fatal server error:
[    48.556] (EE) no screens found(EE) 
guimillet commented 8 years ago

Here is the report from kern.log, when I closed the lid, before it freezes:

[ 3294.897654] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 3294.897667] pci 0000:00:1e.0: PCI bridge to [bus 05]
[ 3294.897673] pci 0000:00:1e.0:   bridge window [io  0x3000-0x3fff]
[ 3294.897681] pci 0000:00:1e.0:   bridge window [mem 0xfc800000-0xfc9fffff]
[ 3294.897687] pci 0000:00:1e.0:   bridge window [mem 0xfef00000-0xff0fffff 64bit pref]
... same error 5 times more (the above 5 lines, called E1)
[ 3294.898403] pcie_pme 0000:00:01.0:pcie01: unloading service driver pcie_pme
[ 3294.898584] pci_bus 0000:01: busn_res: [bus 01] is released
[ 3294.929287] pci_bus 0000:02: Allocating resources
[ 3294.929312] pci_bus 0000:03: Allocating resources
[ 3294.929337] pci_bus 0000:04: Allocating resources
E1
[ 3294.929492] pci_bus 0000:05: Allocating resources
E1
[ 3294.951572] PM: Syncing filesystems ... done.
[ 3295.202007] PM: Preparing system for sleep (mem)
[ 3295.202249] general protection fault: 0000 [#1] SMP 
[ 3295.202289] Modules linked in: bbswitch(OE) drbg ansi_cprng ctr ccm pci_stub vboxpci(OE) vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) snd_hrtimer binfmt_misc snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev snd_pcm media arc4 snd_seq_midi snd_seq_midi_event snd_rawmidi kvm_intel ath9k ath9k_common kvm ath9k_hw ath snd_seq joydev input_leds serio_raw mac80211 snd_seq_device lpc_ich snd_timer cfg80211 snd soundcore shpchp asus_laptop sparse_keymap input_polldev mac_hid cuse coretemp parport_pc ppdev lp parport autofs4 uas usb_storage mxm_wmi ttm i915 psmouse ahci libahci i2c_algo_bit atl1c drm_kms_helper drm wmi video [last unloaded: nouveau]
[ 3295.202822] CPU: 1 PID: 2706 Comm: systemd-sleep Tainted: G        W  OE   4.2.0-23-generic #28-Ubuntu
[ 3295.202878] Hardware name: ASUSTeK Computer Inc.         UL80VT              /UL80VT    , BIOS 214     01/17/2011
[ 3295.202938] task: ffff8800b4e88000 ti: ffff88013a27c000 task.ti: ffff88013a27c000
[ 3295.202981] RIP: 0010:[<ffffffff8152b88b>]  [<ffffffff8152b88b>] __pm_runtime_resume+0x1b/0x70
[ 3295.203039] RSP: 0018:ffff88013a27fcc8  EFLAGS: 00010246
[ 3295.203072] RAX: ffff88013a56a800 RBX: 2f736563697665dc RCX: 0000000000000003
[ 3295.203114] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 2f736563697665dc
[ 3295.203156] RBP: ffff88013a27fce8 R08: ffffffff815330d0 R09: ffffffffc02a3000
[ 3295.203198] R10: 000000000001ab10 R11: 00000000000004e8 R12: 0000000000000004
[ 3295.203239] R13: 0000000000000003 R14: 0000000000000000 R15: 0000000000000000
[ 3295.203282] FS:  00007fa044ad7740(0000) GS:ffff88013fd00000(0000) knlGS:0000000000000000
[ 3295.203331] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 3295.203365] CR2: 00007f5e82692000 CR3: 000000008d2d0000 CR4: 00000000000406e0
[ 3295.203406] Stack:
[ 3295.203421]  00000000fffffffa ffffffff81ce8c40 0000000000000003 0000000000000000
[ 3295.203470]  ffff88013a27fcf8 ffffffffc02a1053 ffff88013a27fd08 ffffffffc02a17b8
[ 3295.203518]  ffff88013a27fd48 ffffffff8109b67e 0000000000000010 ffffffff81c502e0
[ 3295.203567] Call Trace:
[ 3295.203590]  [<ffffffffc02a1053>] dis_dev_get+0x33/0x40 [bbswitch]
[ 3295.203630]  [<ffffffffc02a17b8>] bbswitch_pm_handler+0x48/0x70 [bbswitch]
[ 3295.203675]  [<ffffffff8109b67e>] notifier_call_chain+0x4e/0x80
[ 3295.203713]  [<ffffffff8109b9cb>] __blocking_notifier_call_chain+0x4b/0x70
[ 3295.203756]  [<ffffffff8109ba06>] blocking_notifier_call_chain+0x16/0x20
[ 3295.203798]  [<ffffffff810c6f8a>] pm_notifier_call_chain+0x1a/0x40
[ 3295.203838]  [<ffffffff810c84c8>] pm_suspend+0x1f8/0x3c0
[ 3295.203872]  [<ffffffff810c6e7c>] state_store+0x7c/0xe0
[ 3295.203905]  [<ffffffff813c819f>] kobj_attr_store+0xf/0x20
[ 3295.203941]  [<ffffffff81279627>] sysfs_kf_write+0x37/0x40
[ 3295.203976]  [<ffffffff81278a1d>] kernfs_fop_write+0x11d/0x170
[ 3295.204014]  [<ffffffff811fca68>] __vfs_write+0x18/0x40
[ 3295.204045]  [<ffffffff811fd3f6>] vfs_write+0xa6/0x1a0
[ 3295.204078]  [<ffffffff811fe0e5>] SyS_write+0x55/0xc0
[ 3295.204111]  [<ffffffff817f02b2>] entry_SYSCALL_64_fastpath+0x16/0x75
[ 3295.204150] Code: 00 48 83 c4 08 5b 41 5c 41 5d 5d c3 0f 1f 40 00 66 66 66 66 90 55 48 89 e5 41 56 41 55 41 54 41 89 f4 83 e6 01 53 48 89 fb 75 09 <f6> 87 99 01 00 00 02 74 42 41 f6 c4 04 74 07 f0 ff 83 90 01 00 
[ 3295.204372] RIP  [<ffffffff8152b88b>] __pm_runtime_resume+0x1b/0x70
[ 3295.204414]  RSP <ffff88013a27fcc8>
[ 3295.212244] ---[ end trace f3bc63793fb4bf93 ]---
ArchangeGabriel commented 8 years ago

Please use markdown syntax when pasting such output (look at the way I edited your message).

You need at least bbswitch 0.8, 0.7 can’t work with kernel above 3.13.

guimillet commented 8 years ago

Thanks for the edit. I have installed bbswitch-dkms 0.8-3ubuntu1. When bbswitch was loaded (nouveau was not loaded), I got the same error as above (in dmesg, sysfs group ffffffff81cc2980 not found for kobject 'acpi_video1', etc.) apart from bbswitch: version 0.8. After that, when I launched suspending, the screen went black except for the cursor, and the system froze; no additional lines reported in kern.log.

sil-van commented 8 years ago

This seems to be related to https://github.com/Bumblebee-Project/bbswitch/issues/114 as kernel versions almost match and the hardware is almost the same.

Lekensteyn commented 8 years ago

Hmm, perhaps this needs a pci_ignore_hotplug() somewhere. Apparently there was a change in 3.12 that causes issues when hotplug events are generated (https://git.kernel.org/linus/f244d8b623da and https://git.kernel.org/linus/b440bde74f04).

For the affected, can you try this patch and report back results?

diff --git a/bbswitch.c b/bbswitch.c
index 341608f..72b7de7 100644
--- a/bbswitch.c
+++ b/bbswitch.c
@@ -471,6 +471,8 @@ static int __init bbswitch_init(void) {
             pr_warn("failed to enable %s\n", dev_name(&dis_dev->dev));
     }

+    pci_ignore_hotplug(pdev);
+
     if (load_state == CARD_ON)
         bbswitch_on();
     else if (load_state == CARD_OFF)
cris- commented 7 years ago

I was having the same problem with my UL50VT notebook using Debian and their official bbswitch package. I wanted to report that I've compiled the version of bbswitch with Lekensteyn's commit from this tree: with this version the discrete card gets turned on and off without the kernel panic


[   26.305031] bbswitch: module verification failed: signature and/or required key missing - tainting kernel
[   26.305497] bbswitch: version 0.8
[   26.305505] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.VGA_
[   26.305517] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.P0P1.VGA_
[   26.305684] bbswitch: detected a nVidia _DSM function
[   26.305688] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on
[   26.316708] bbswitch: disabling discrete graphics
[   26.340874] bbswitch 0000:01:00.0: Refused to change power state, currently in D0
[  194.406911] bbswitch: enabling discrete graphics
[  287.968116] bbswitch: disabling discrete graphics
[  287.988277] bbswitch 0000:01:00.0: Refused to change power state, currently in D0
[  562.876209] bbswitch: enabling discrete graphics```

Thank you very much!
cris- commented 7 years ago

mmmh, works but hangs when suspending...

Lekensteyn commented 7 years ago

@cris- If you do not use the proprietary drivers, consider using the nouveau driver with a recent kernel version. (What kernel are you using exactly?)

cris- commented 7 years ago

@Lekensteyn I've got the same problem with both nouveau and the proprietary driver; the version of the kernel is "SMP Debian 4.8.7-1".

Anyway, I think I could work around the problem by using a systemd service that removes the module before entering suspend and then loads it again when resuming: toggle.bbswitch.service I also needed to add parameters values for the modules under /etc/modprobe.d: options bbswitch load_state=0 unload_state=1