Declining performance with optimus

I have a problem with declining performance running OpenSUSE Leap 42.2 on a laptop with nvidia bumblebee.
Right after start up the system is fast and the mouse reacts without lag. After running a while the performance is poor. Usually seen from one day to the next.
I didn’t have this on OpenSUSE 13.2 which I upgraded from recently.

My mouse and keyboard is a bit slow and lagging when moving and typing. This after running a day or two. Logging out and in makes my KDE system responsive again.

The browser is also flickering often. This I have experienced with both Vivaldi and Chromium.

I am using an Optimus laptop. Running with Bumblebee and nvidia-bumblebee driver. I have installed Linux Kernel and Bumblebee from the Kernel Stable repository, because I need a newer kernel for my hardware (the touchpad).
I have 3 monitors, the laptop 15" 19201080 and two 24" 19201200.

Could perhaps my integrated Intel graphic not be able to run all 3 monitors? But then why didn’t I experience this problem while I was running OpenSUSE 13.2?
Perhaps I should have nvidia running the entire system and KDE session by default instead of Intel (disable Intel in BIOS). Even when the only application I am running is the browser I see the mouse is having some hickups when I move it slowly.

Both CPU and memory usage is low. So what could the cause be? It must be the graphic rendering by the integrated Intel graphics.

00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
Driver: i915

mkinitrd
dracut: Possible missing firmware “i915/kbl_guc_ver9_14.bin” for kernel module “i915.ko”
dracut: Possible missing firmware “i915/bxt_guc_ver8_7.bin” for kernel module “i915.ko”

01:00.0 3D controller: NVIDIA Corporation GK107GLM [Quadro K1100M] (rev a1)
Driver: nouveau active:no
Driver: nvidia_drm active:no
Driver: nvidia active:no

Running kernel 4.10.1 from Kernel Stable repository
Mesa 11.2 that comes with OpenSUSE Leap 42.2

Latest Mesa is now 17.0. Would I perhaps get better performance with that version?

I am really disliking optimus right now. It is nothing but trouble. I am seriously thinking of disabling Intel graphic in BIOS and run only on NVIDIA.
I have a home computer running an low-profile NVIDIA GT610 using nouveau, and it has the same declining performance after running a while with the same latest stable kernel.

/var/log/zypp/history


# 2017-03-08 08:54:28 Output of nvidia-bumblebee-375.26-1.2.x86_64.rpm %posttrans script:
#     + '' -x /usr/sbin/dkms ']'
#     + /usr/sbin/dkms add -m nvidia -v 375.26 --rpm_safe_upgrade
#     
#     Creating symlink /var/lib/dkms/nvidia/375.26/source ->
#                      /usr/src/nvidia-375.26
#     
#     DKMS: add completed.
#     + /usr/sbin/dkms build -m nvidia -v 375.26
#     
#     Kernel preparation unnecessary for this kernel.  Skipping...
#     
#     Building module:
#     cleaning build area...
#     'make' KERNEL_UNAME=4.10.1-5.gf764d42-default modules.........(bad exit status: 2)
#     Error! Bad return status for module build on kernel: 4.10.1-5.gf764d42-default (x86_64)
#     Consult /var/lib/dkms/nvidia/375.26/build/make.log for more information.
#     + /usr/sbin/dkms install -m nvidia -v 375.26
#     
#     Kernel preparation unnecessary for this kernel.  Skipping...
#     
#     Building module:
#     cleaning build area...
#     'make' KERNEL_UNAME=4.10.1-5.gf764d42-default modules........(bad exit status: 2)
#     Error! Bad return status for module build on kernel: 4.10.1-5.gf764d42-default (x86_64)
#     Consult /var/lib/dkms/nvidia/375.26/build/make.log for more information.
#     + popd

/var/lib/dkms/nvidia/375.26/build/make.log



 CONFTEST: drm_atomic_modeset_nonblocking_commit_available
  CC [M]  /var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.o
In file included from /var/lib/dkms/nvidia/375.26/build/common/inc/nv-linux.h:18:0,
                 from /var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.c:13:
/var/lib/dkms/nvidia/375.26/build/common/inc/nv-mm.h: In function ‘NV_GET_USER_PAGES_REMOTE’:
/var/lib/dkms/nvidia/375.26/build/common/inc/nv-mm.h:86:13: error: too few arguments to function ‘get_user_pages_remote’
             return get_user_pages_remote(tsk, mm, start, nr_pages, flags, pages, vmas);
             ^
In file included from /var/lib/dkms/nvidia/375.26/build/common/inc/nv-pgprot.h:17:0,
                 from /var/lib/dkms/nvidia/375.26/build/common/inc/nv-linux.h:17,
                 from /var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.c:13:
/usr/src/linux-4.10.1-5.gf764d42/include/linux/mm.h:1267:6: note: declared here
 long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
      ^
/usr/src/linux-4.10.1-5.gf764d42/scripts/Makefile.build:295: recipe for target '/var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.o' failed
make[3]: *** [/var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.o] Error 1
/usr/src/linux-4.10.1-5.gf764d42/Makefile:1500: recipe for target '_module_/var/lib/dkms/nvidia/375.26/build' failed
make[2]: *** [_module_/var/lib/dkms/nvidia/375.26/build] Error 2
make[2]: Leaving directory '/usr/src/linux-4.10.1-5.gf764d42-obj/x86_64/default'
Makefile:150: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2

I am going to await and see if any of you have any ideas or suggestion before I venture into the BIOS and disable Intel.

I ventured into the BIOS and there was no option to disable any graphic solution, neither intel nor nvidia.
Seems I am stuck with both, but cannot I force running with NVIDIA by removing bumblebee and installing the non-bumblebee nvidia driver?

The only reference for nvidia in my boot is


mars 08 09:42:00 alya dkms.systemd[913]: 'make' KERNEL_UNAME=4.10.1-5.gf764d42-default modules.........(bad exit status: 2)
mars 08 09:42:00 alya dkms.systemd[913]: Error! Bad return status for module build on kernel: 4.10.1-5.gf764d42-default (x86_64)
mars 08 09:42:00 alya dkms.systemd[913]: Consult /var/lib/dkms/nvidia/375.26/build/make.log for more information.

Hi, cannot confirm your findings, but please be aware that the Nvidia driver doesn’t build with the 4.10.x kernel as shown by your log and maybe the poor performance is related.
You need to patch the driver and maybe use the newer 378.13 version. Patch available here https://pkgs.rpmfusion.org/cgit/nonfree/nvidia-kmod.git/plain/kernel_4.10.patch

Ok. That makes some sense, as this worked previously when I was running kernel 4.9 (along with OpenSUSE 13.2). Now with kernel 4.10 and OpenSUSE Leap 42.2 I thought the problem might be OSL422.

How do I apply that patch? Do I need to reinstall some nvidia/bumblebee packages before or after applying the patch?
nvidia-bumblebee, bbswitch-kmp-default

The newer NVIDIA 378.13 is not available with bumblebee repository.

Apparently you have set up bumblebee in the standard way that works with the stock 4.4.x kernel and only partially updated to 4.10.x.
Namely, you currently miss an nvidia-bumblebee matching both Nvidia driver 378.13 AND kernel 4.10.x.
While in principle it should be possible to tweak that package, I’m not able to fly-you-by-wire to do such a task.
With kernel 4.10 you should be able to run bumblebee with the nouveau driver with decent performance: try just uninstalling nvidia-bumblebee until an updated package shows up.
Or, if you still have a working kernel 4.9.x and matching packages, boot with that until updated packages show up.

Or consider jettisoning bumblebee entirely, since with kernel 4.10 (and maybe an Xserver version 1.18 or newer) you should be able to run the Nvidia GPU with nouveau via DRI_PRIME (check this as a starting point https://forums.opensuse.org/showthread.php/522499-How-do-I-install-(nvidia-suse)-Prime-using-the-Nouveau-driver-on-my-Asus-Optimus-laptop?p=2812608#post2812608 ).

Or… wait for a better answer from somebody that has already done what you need… :wink:

I have followed the guide on installing Bumblebee, but instead of using with the default kernel I have used the latest stable.
http://download.opensuse.org/repositories/Kernel:/stable/standard/
http://download.opensuse.org/repositories/X11:/Bumblebee/Kernel_stable_standard/

The bumblebee packages here are built against the latest kernel, and the nvidia version there is 375.26
nvidia-bumblebee-375.26-1.2.x86_64.rpm
bbswitch-kmp-default-0.8_k4.10.1_5.gf764d42-24.358.x86_64.rpm
kernel-default-4.10.1-5.1.gf764d42.x86_64.rpm

The 3D drivers of the Nouveau driver suite are in Mesa
Mesa in Leap 42.2 is 11, while the latest is 17. For best Nouveau performance wouldn’t the latest Mesa be preferable?
I could give nouveau a try and see if the performance betters.

jettisoning bumblebee entirely

Is it possible to run with the standard Nvidia drivers on Optimus? I think I tried it once before without issues.

As already pointed out, you lack a matching nvidia-bumblebee: AFAIK the patch for kernel 4.10 applies to the 378.13 driver and the 375.26 doesn’t build against the 4.10 kernel.

Agree, I have a test setup with kernel 4.10, Mesa 17 and Xorg 1.19: you need to switch packages to the X11:/Xorg repo http://download.opensuse.org/repositories/X11:/XOrg/openSUSE_Leap_42.2/

Yes, it is possible but it takes control of the system, i.e. no more Intel integrated graphics. Then currently GDM (and maybe also SDDM) have issues with this setup, so you have to use LIGHTDM and tweak its configuration according to NVIDIA Optimus - ArchWiki

Then they should have updated the repository.

Or move over to Tumbleweed.

I’m not a developer or packager, so I’m not involved in that work, but my understanding is that the repo is intended for the RELEASED version of Leap (or Tumbleweed) and that if you go for kernel:stable or kernel:head you must be prepared to bear some burden…

I jsut updated the kernel to 4.10.4 and bumblebee accordingly. It still had the same problem with nvidia.

journalctl -b


mars 22 10:51:42 mintaka dkms.systemd[937]: 'make' KERNEL_UNAME=4.10.4-2.gc2678b7-default modules.........(bad exit status: 2)
mars 22 10:51:42 mintaka dkms.systemd[937]: Error! Bad return status for module build on kernel: 4.10.4-2.gc2678b7-default (x86_64)
mars 22 10:51:42 mintaka dkms.systemd[937]: Consult /var/lib/dkms/nvidia/375.26/build/make.log for more information.

less /var/lib/dkms/nvidia/375.26/build/make.log


 CONFTEST: drm_atomic_modeset_nonblocking_commit_available
  CC [M]  /var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.o
In file included from /var/lib/dkms/nvidia/375.26/build/common/inc/nv-linux.h:18:0,
                 from /var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.c:13:
/var/lib/dkms/nvidia/375.26/build/common/inc/nv-mm.h: In function ‘NV_GET_USER_PAGES_REMOTE’:
/var/lib/dkms/nvidia/375.26/build/common/inc/nv-mm.h:86:13: error: too few arguments to function ‘get_user_pages_remote’
             return get_user_pages_remote(tsk, mm, start, nr_pages, flags, pages, vmas);
             ^
In file included from /var/lib/dkms/nvidia/375.26/build/common/inc/nv-pgprot.h:17:0,
                 from /var/lib/dkms/nvidia/375.26/build/common/inc/nv-linux.h:17,
                 from /var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.c:13:
/usr/src/linux-4.10.4-2.gc2678b7/include/linux/mm.h:1267:6: note: declared here
 long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
      ^
/usr/src/linux-4.10.4-2.gc2678b7/scripts/Makefile.build:295: recipe for target '/var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.o'
 failed
make[3]: *** [/var/lib/dkms/nvidia/375.26/build/nvidia/nv-frontend.o] Error 1

However I did an upgrade of X-Server and Mesa as suggested from
http://download.opensuse.org/repositories/X11:/XOrg/openSUSE_Leap_42.2/
My system became immensely more responsive. Though it remains to be seen after running a few days.

The upgrade was an improvement of performance. However I still see a small decline after running a few days, but not in the same degree as before. Specially a more decline if I have JavaFX applications running for a long time.

Mouse is sluggish, but not so much as before. Moving in high pace works fine, but the last inches when I slow down to align it where I want to click it gets very sluggish some times.

Browsers content still flicker sometimes when moving back and forth from tabs and other applications.

At the moment CPU usage is not very high 20% of 8 cores (probably 4 virtual cores). The two most applications using most of the CPU are
/usr/bin/baloo_file_extractor
/usr/bin/plasmashell --shut-up

I think the problem is plasmashell. I have an additional desktop computer which I experience the same decline in performance and it doesn’t have a dual graphics solution, just a single low-profile nvidia card running nouveau. This computer has it way worse than my laptop. After running a few days KDE/X gets slow, mouse clicks hardly register. I have to click 2-3 times on the application for it to open up.

CPU usage of plasmashell is 100-140% while X is between 25-45% CPU (total 400% of 4 cores). After I log out and back in the plasmashell and X process is only 0-3%.

So what makes both plasmashell and X consume so much CPU?

I’ve had the same performance problems with KDE/plasma and tried GNOME, which I don’t like. My solution was to setup an openbox that I like and my system responds much better. I still have issues with the open source radeon driver causing system problems, but at least my keyboard and mouse respond well, now.

I tried XFCE, Mate, LxQt, LxDe, and finally landed on openbox with tint2, conky, nitrogen, etc.

Would like to know why the performance degrades over time.
I have seen it on two systems, one running intel the other nouveau. Both running Leap 42.2 with the latest kernel, X and Mesa.
The performance was worse before I updated X and Mesa.

For what it is worth I run a non Optimus desktop with AMD processor (no GPU) and NVIDIA 630 GPU with the GO4 driver on 42.2 KDE no slow downs or other glitches seen. I run for weeks between boots