Jump to content
IGNORED

Crippled by a Spectre


mizapf
 Share

Recommended Posts

[also posted to the MAME forum]

 

(Find information about the recent CPU security vulnerabilities on Wikipedia: https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability) , https://en.wikipedia.org/wiki/Spectre_(security_vulnerability) )

 

It took me some weeks to finally find the reason for the drastic performance loss that I observed since mid-March.

 

During my works on the Hexbus system and the HX5102 floppy drive for the TI-99/8 I found that for no obvious reason, the bench performance of MAME dropped significantly.

 

The 99/8 emulation is pretty CPU-hungry, but since my last HW upgrade to a Skylake system (i7-6700K CPU @ 4.00GHz), these issues seemed gone. The naked 99/8 delivered a bench performance of 350%, which was enough reserve for screen output and the floppy drive.

 

Just about end of March, close to the completion of the HX5102, I noticed that MAME did not achieve 100% emulation speed anymore, which I noticed from the chopped sound. I did another bench test, and got just about 150%. First I thought I accidentally build a debug version, then, a non-optimized version. This was not the case, the build was good. In fact, I found an old build of MAME from June 2017, a 0.186 release, untouched since then. I continued my tests with the 99/4A driver built into that one.

 

Here again, I remembered that the reserve was pretty high, between 800% and 900%. Now, only 300% were reached.

 

I am using openSUSE Linux (Tumbleweed rolling release) and suspected some issue in the kernel, so I started bisecting. The results were not clear; the bisect result on one PC did not match the one on my second PC.

 

I now found the issue, as I believe. When I add the kernel boot parameter "spectre_v2=off", the higher emulation speed is back. Obviously, MAME is particularly affected by the Spectre issue, because it is a heavy CPU-load application. It is not only MAME, though. I am using a Bluray player on WINE, which turned unusable now. I know that I successfully watched a Bluray some time ago with the same system.

A kernel developer explained to me that when you see this:

 

$ cat /sys/devices/system/cpu/vulnerabilities/spectre_v2
Mitigation: Indirect Branch Restricted Speculation, IBPB, IBRS_FW
it means that your system is heavily slowed down, since the much better performing retpolines do not work.

For me this means that my two PC systems are hit back to pre-2011 performance. I have a laptop from 2012 (Core i5 3220M), which now runs MAME faster than my Skylake PC (i7-6700K CPU @ 4.00GHz) and my KabyLake PC (i7-7700K CPU @ 4.20GHz).

 

There are some open points to consider:

* Why is my dually installed Windows 10 still running fast? Maybe Microsoft did not yet deploy the mitigation. When this occurs, I am curious what will happen.

* Is this a failure of the openSUSE people who are tailoring the vanilla kernel to their distribution?

 

For the time being, I seem to be forced to turn off the Spectre mitigation and make my PC vulnerable.

 

Here are some numbers, gained from the current MAME build:

 

With mitigation (current situation)

 

$ ./mame64 ti99_8 -bench 20
Average speed: 153.85% (19 seconds)
$ ./mame64 ti99_4a -bench 20
Average speed: 298.34% (19 seconds)
Without mitigation (previous situation, now adding "spectre_v2=off"):

 

$./mame64 ti99_8 -bench 20
Average speed: 362.01% (19 seconds)
$ ./mame64 ti99_4a -bench 20
Average speed: 895.49% (19 seconds)
Note that you may possible be affected only if your system is a Skylake or newer system. Edited by mizapf
Link to comment
Share on other sites

[also posted to the MAME forum]

 

(Find information about the recent CPU security vulnerabilities on Wikipedia: https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability) , https://en.wikipedia.org/wiki/Spectre_(security_vulnerability) )

 

..........

 

Note that you may possible be affected only if your system is a Skylake or newer system.

 

This may explain slow down issues, I have had with my company provided Thinkpad.

Edited by RickyDean
Link to comment
Share on other sites

I may be experiencing the same. I can no longer run MAME at full speed [edit: and record video using the aviwrite option] on battery power on my Thinkpad E470 with i7-7500U CPU. The same version worked fine before. When I plug it in it works reasonably well.

Edited by Asmusr
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...