7 ms·
Is it bad that I disable spectre mitigations on all my PCs to get a free double-digit-% performance boost?
by umvi 2y ago
Is it bad that I disable spectre mitigations on all my PCs to get a free double-digit-% performance boost?
- kllrnohj 2y agoWhat are you doing where you see anything remotely close to double-digit-% gains from disabling spectre mitigations?
- umvi 2y agomy specific use case where I see significant performance improvement is image segmentation pipelines (which involve opencv-style image processing and AI inference). YMMV depending on your CPU I suppose.
- iforgot22 2y agoVideo editing maybe? Which is not going to involve running untrusted code.
- kllrnohj 2y agoIt's not going to hammer on syscalls, either, so it won't have any spectre-related regressions.
- AHTERIX5000 2y agoIf mitigations include disabling SMT and the workload is compiling code, then the difference is easily in double digits.
- kllrnohj 2y agoWhat OS ships the mitigation of disabling SMT by default? Surely they just meant things like the retpoline mitigations in syscalls?
- baq 2y agoOnly if you don't care if baddies see you go fast
- thijsr 2y agoIt depends on your threat model. If you don't run any untrusted code on your hardware (including Javascript), you can safely disable the mitigations. If you do run untrusted code, keep them enabled.
- positr0n 2y agoWhat is the threat model if I run lots of untrusted JavaScript, but I only have a small amount of memory in other processes worth reading and I would notice sustained high CPU usage? Is there an example in the wild of a spectre exploit stealing my gmail cookie and doing something with it? (Would be difficult since it's tied to other fingerprints like my IP) Or stealing credit card numbers when they're in memory after I place an online order?
- School-Cotton 2y agoIf you’re not sure, just keep the mitigations on.
- fc417fc802 2y ago[dead]
- coldpie 2y agoIn the context of a regular end-user desktop machine, this seems overly paranoid to me. The odds of encountering a real, JS-based spectre attack in the wild are basically zero (has anyone ever seen a browser-based Spectre attack outside of a research context? even once?), and the odds of it then being able to retrieve actual sensitive data are also basically zero. That's two astonishingly tiny numbers multiplied together. The threat just isn't there. For regular end-user desktop machines, the mitigations only decrease performance for no real benefit. Spectre is a highly targeted attack, it's not something you can just point at any random machine to retrieve all their bank passwords or whatever.
- saagarjha 2y agoSpectre is mitigated by your browser already.
- basementcat 2y agoIf your machine is air gapped and/or not running random downloaded code, I think it is a possible reasonable option.
- autoexec 2y agoIt's a tragedy that so many websites insist on having the ability to run random downloaded code on our systems to do basic things like displaying simple text and images. Things browsers are capable of with nothing but HTML. Google refuses to even show search results, a bunch of literal hyperlinks, without javascript being enabled.
- deleted 2y ago[deleted]
- ribcage 2y agoThe real tragedy is that our processors try to win a bit more speed by sacrificing simplicity and therefore increasing the chances of such exploits. The other tragedy is that our operating systems are obsolete and have worthless security. Back in the day when UNIX was relevant, a hundred people could use it at the same on a mainframe with no fear of it breaking, now one person cannot safely use a single computer.
- spydum 2y agoI got bad news: those systems were NOT secure
- Gigachad 2y agoUnix systems protected against a physical person trying to read or modify another persons file. They did not stop programs run by the user reading the users own data unexpectedly which is now considered unacceptable but was previously the norm.
- School-Cotton 2y ago> The real tragedy is that our processors try to win a bit more speed by sacrificing simplicity and therefore increasing the chances of such exploits. This gets repeated on every thread about speculative execution exploits, but I think people who say this are underestimating how huge the difference would be. I suspect processors without speculative execution would be many times slower, not "a bit".
- deleted 2y ago[deleted]
- daneel_w 2y agoYou're not getting a boost, you're avoiding a penalty. In some (but not all) cases you can avoid the penalty and the exploits by disabling SMT. Remember, SMT isn't twice as many cores, just twice as many half-cores. You'll be fine.
- School-Cotton 2y agoIn my experience SMT is still faster for most workloads even with the mitigations.
- daneel_w 2y agoIt's a common misunderstanding that the CPU suddenly has twice as large performance envelope when SMT is enabled. Only specialized software/scenarios will tangibly benefit from the parasitic gains of SMT-induced extra parallelization, e.g. video encoders like x264 or CPU-bound raytracers to name a few examples. These gains typically amount to about 15-20% at the very extreme end. In some cases you'll see a performance drop due to the inherent contention of two "cores" sharing one actual core. If you're stuck with a dual-core CPU for your desktop setup you should absolutely enable SMT to make your general experience feel a bit more responsive.
- School-Cotton 2y ago> It's a common misunderstanding that the CPU suddenly has twice as large performance envelope when SMT is enabled. Perhaps, but I am not under this misunderstanding and never expressed it. > Only specialized software/scenarios will tangibly benefit from the parasitic gains of SMT-induced extra parallelization In my experience it also speeds up C++/Rust compilation, which is the main thing I care about. I can't find any benchmarks now but I have definitely seen a benefit in the past.
- avianlyric 2y agoAre you sure about your statement > video encoders like x264 or CPU-bound raytracers to name a few examples. These gains typically amount to about 15-20% at the very extreme end. Normally those types of compute heavy processes, data streamlined, processes don’t see much benefit from SMT. After all SMT only provides a performance benefit by allowing the CPU to pull from two distinct chains of instructions, and fill the pipeline gaps from one thread, with instructions from the other thread. It’s effectively instruction-by-instruction scheduling of two different threads. But if you’re running an optimised and efficient process that doesn’t have significant unpredictable branching, or significant unpredictable memory operations. Then SMT offers you very little because the instruction pipeline for each thread is almost fully packed, offering few opportunities to schedule instructions from a different thread.
- viraptor 2y agoIn practice probably not, as long as general population keeps it enabled. I mean, looking at effort required, it's not worth spending time exploiting spectre these days, because virtually everyone is protected. If you're not likely to be directly targeted, "herd immunity" will work.
- iforgot22 2y agoIf just visiting a webpage with some JS will let them do ACE on even 0.1% of visitors, hackers are probably still motivated enough to try it. But I vaguely remember these kinds of vulns can be patched in-browser for a perf hit instead of taking the hit system-wide, which sounds like an ok compromise. Edit: Arbitrary memory access, not ACE
- bawolff 2y ago> If just visiting a webpage with some JS will let them do ACE on even 0.1% of visitors Spectre is not an arbitrary code execution kind of attack.
- iforgot22 2y agoOops, I meant arbitrary memory access.
- viraptor 2y agoLinux on its own isn't even 0.1% visitors normally. We're talking multiple orders of magnitude less for disabled mitigations. And on top of all that, it's possible that exploiting on that machine is going to be harder due to custom software with uncommon memory layout - i.e. it's probably not a stock Ubuntu. And finally, for accessing data outside of the page, you really want to have some specific target, so they'd have to guess that too.
- iforgot22 2y agoIf only Linux is affected then sure. Was talking about spectre in general. Maybe only Linux users are turning the spectre mitigation flags off, but there are plenty of outdated Windows systems too.
- paulddraper 2y ago> double-digit-% In the early days there was a ~10% hit, but that's changed a lot since then.
- umvi 2y agoIt depends on the CPU, think. The most dramatic improvement I've seen is 20-30%+ improvements in python run times for numpy/pytorch heavy workloads on c2-standard-16 VMs in GCP with spectre mitigations disabled
- jorvi 2y agoYou shouldn't disable Spectre mitigations, but Retbleed and Downfall (Intel) are much more of a "lab" exploit, and the fall-out for Retbleed is much more severe on cloud boxes than your personal PC. Easy 20-40% performance uplift on AMD Zen1-Zen2 and Intel 6th-11th gen.
- 99catmaster 2y agoWhere and how do you disable these mitigations?
- umvi 2y agoNot sure about Windows, but on Linux I used: https://unix.stackexchange.com/a/554922 https://unix.stackexchange.com/a/554922