while working on the emulation system MAME, I noticed a heavy performance loss in the recent kernel. MAME is a particularly CPU-intense application.
$ uname -a; ./mame64 ti99_4a -bench 20
Linux capella.daheim.lan 4.15.13-1-default #1 SMP PREEMPT Sun Mar 25 08:34:58 UTC 2018 (950fc49) x86_64 x86_64 x86_64 GNU/Linux
Average speed: 302.08% (19 seconds)
After a reboot, I selected the older kernel 4.15.10 that is still available on my system:
$ uname -a; ./mame64 ti99_4a -bench 20
Linux capella.daheim.lan 4.15.10-1-default #1 SMP PREEMPT Thu Mar 15 20:31:17 UTC 2018 (5e4329c) x86_64 x86_64 x86_64 GNU/Linux
Average speed: 896.21% (19 seconds)
The MAME benchmark is designed to let the emulation run without screen output and without delays for realistic timing, thus running as fast as possible.
The speed value says that the emulation runs at 300% (the 19 emulated seconds only took 6.33 sec). However, the second run with the older kernel says that it ran three (!) times as fast.
I did not change anything, just booted the other kernel and immediately started the benchmark process.
I also noticed this lower performance in applications in Dosbox with choppy sound, so it is not only MAME-related.
It’s been happening this way for the last three days at least; I also did a zypper dup today, but no change. I do not have the kernels 4.15.11 or 4.15.12 on my system - need to check with another computer at my second home, maybe that one has them. Anyway, this was a rapid increase in numbers in about 10 days.
This is pretty weird; with 4.15.13 my 6 year old laptop is now faster than my desktop PC with a last-year Core i7. How could this possibly happen?
I suppose I can pull the kernel sources from Github. Do I need particular settings for creating a kernel for my Tumbleweed installation? Is there a Howto? (I did not build a kernel for the last 15 years, if I remember correctly.)
Things are getting even more complicated. On my second PC, I also found the performance loss, but it happened earlier. Rolling back, it seems as if it was between openSUSE-release-20180227-1.2.x86_64 (fast) and openSUSE-release-20180314-1.2.x86_64 (slow). The former release had kernel 4.15.6, the latter 4.15.8.
Can it be related to a library? I found that in the second release, glibc 2.27 became available.
Maybe I’ll take a spare SSD and try a clean install and see what happens.
I believe I found the problem. It is indeed the Spectre_v2 mitigation. I verified this on all PCs where I discovered the issue.
All three systems report
$ cat /sys/devices/system/cpu/vulnerabilities/spectre_v2
Mitigation: Indirect Branch Restricted Speculation, IBPB, IBRS_FW
When I add the kernel boot parameter “spectre_v2=off”, the previous high speed is available again.
Sadly, I will have to turn off that mitigation and make my system vulnerable, until a better solution will be found. Or until I decide it is time for another hardware upgrade.
I heard of performance losses with respect to this Meltdown/Spectre problem, but this is really extreme.
This has fixed an issue I was seeing where watching video (Amazon Prime) would suddenly go so slowly and the whole PC become unresponsive. I’ve now been watching for a couple of hours without incident.