Wondering about the viability (or even possibility) of turning off speculative execution.

Nazo

2[H]4U
Joined
Apr 2, 2002
Messages
3,672
So this may sound crazy. But almost by the day now it seems like new exploits involving speculative execution are found. Since AMD seems to rely on MB manufacturers for microcode updates (and even then it takes a while besides) I actually started wondering: is it even possible and, if so, how viable would it be just to turn that off? Obviously it would hurt performance -- that's a given by definition. Though the real question is how much does it in real world uses (eg gaming or whatever.) That obviously gets trickier to define... What I do know is the only things I can run that ever come even remotely close to actually using 100% of my current CPU are encoding and of course stuff like Prime95. Actual gaming struggles to ever push any actual core past somewhere in the upper 50% ranges (and that's with SMT off, so when it says 56% of a core I know that means it's actually 56%, not some averaged factor.) Even load screens seem to struggle to 100% my CPU. My GPU is generally more limiting if anything. A reasonably small loss is likely no big deal.

I did dig through my BIOS settings to see if there was anything obvious. Nothing specifically said that, however, I did find "L1 Stream HW Prefetcher" and "L2 Stream HW Prefetcher" (none for L3 -- I assume it doesn't prefetch at that level since L3 is kind of above all that?) This sounds an awful lot like that, but I can't be quite 100% sure. I have tested turning it off and so far in the games I've tested in I'm still finding the GPU to be the most used thing by a significant margin. It's very difficult to really tell since games naturally have variance in everything, but I'd almost even swear CPU usage is actually lower now. Of course that may be a completely different thing and not even related for all I really can be sure. It sounds like this would just affect caching rather than execution. But it's the closest I could tell in the BIOS so far.

Possibly a crazy idea, but anyway, I'm curious at least about its viability. Any thoughts?
 
Last edited:
No, it is not possible to disable speculative execution and/or branch prediction in x86 processors.
 
Gotcha.

The L1/L2 prefetch thing seems to have not affected most gaming, but one thing may have gone very badly because of it. (Need to try before and after tests to be sure.) Honestly I don't think turning either off would affect any of the security issues going around though anyway. I just worry in particular about the security implications of numerous devices left behind. Since a lot of these things affect a lot of devices both older and newer but the motherboard manufacturers are likely to just abandon the older ones. (Not that I trust Intel's route much more either. Really they should have some kind of firmware or something that an official patcher could just update itself without relying on motherboard manufacturers or MS or etc.)


Seems Zen 3 may be included in the list of those affected by this latest one now too. Yay.
 
You can turn off speculative execution on x86. Just gotta run a 486. Speculative execution has been included since the OG Pentium.

Maybe there's some deep down voodoo with model specific registers, but I kind of doubt it. Perf would be pretty bad without it. Most code does a lot of branches/jumps/call/return, and without speculative execution you get a pipeline bubble for each of those, even branches not taken.

That said, you might have an easier time disabling caching (but there's not going to be an easy way to do that either), because most of the wrong execution communicates via cache effects: disable caching and it doesn't matter what was read. Perf would be even worse than disabling speculative execution though, memory is very slow compared to cpu cycles.
 
Yeah, makes sense. Honestly my suspicion from the very start was that even if it could be done it wouldn't be worth it. Still, it was a slight curiosity. Speculative execution is becoming such a problem recently with a new exploit almost ever day now it feels like and each time the solution ultimately has really high performance costs for affected operations (usually AVX and the like so at least it doesn't affect things like gaming a lot, but still, geez.) I want to say most of this doesn't affect us ordinary users, but some of them (like that Zen 2 one recently) can be as simple as a Javascript on a webpage... Most would attack servers and the like, but still, I wouldn't put it past script kiddies to put up a site or two for people to accidentally stumble across.


Anyway, I guess all we can really do is keep updating and just hope we don't get left behind if we can't afford to buy the absolute latest thing.
 
If you want a modern-ish CPU without speculative execution, you can try a Raspberry Pi. They certainly aren't fast enough for gaming, but they work for everyday use.
 
I have multiple RPis. I disagree about them being particularly usable even for everyday use though. (I use a RPi 4 for a lot of stuff like as a secondary thing to have streams up and free up resources on the gaming system when actually gaming for example. It's painfully sluggish and actually freezes up when I'm typing on said streams because browsers are just too much for it.) This was more just a curiosity "is it possible" kind of thing, though I do worry about some people I know who have older chips that are more likely to potentially be abandoned (or more specifically motherboards in AMD's case.) Though it is getting to be something of a problem in general. The latest mitigation for the latest Intel issue has a huge performance impact on AVX operations for example, yet not implementing it means some random javascript somewhere could trigger it. AMD's own speculative execution issues aren't much better. I wish at least the microcode portion was kept in a firmware on the chips that could be updated via official patch tool (though of course that has its own risks, at least you wouldn't have to worry about software/hardware manufacturers abandoning older devices.)

Anyway, it seems like there is no real answer. We're all just kind of stuck. All one could really hope to do is keep updating everything possible and keep buying the latest CPUs as soon as they come out. That isn't realistic, so all we can do is our best I suppose.
 
Back
Top