Comment Re:Is there any other option, Linus? (Score 1) 507
Yes, I understand the implications... and I assume the longer the pipeline, the worse the effects. (and the industry has been pushing for ever longer pipelines). But, we're dealing with 4 Ghz chips. Intel's chips have voltage regulators to adjust to load, and most of the time, a consumer's CPU is idling at 5%. If we get say.. a 20% hit for turning off branch speculation completely.... then would that effectively mean the chip would act like a 3.2 Ghz CPU instead of a 4 Ghz CPU? Keeping in mind that those 4 Ghz CPUs largely have an idling speed, a working speed, and a "boost" speed that's above 4 Ghz for certain cores; would Joe/Jane Sixpack who uses his laptop for Facebook, Netflix, Gmail, and Youtube as the majority of his/her computing needs really even notice? Especially with quad cores? And the future systems are coming with hex cores, octa cores, etc.
Branch prediction is great for accelerating program speed, but having multiple cores means more work can be done simultaneously as well (even if not as fast without the branch prediction. I'm just reminded of the single-core days when every program had to fight for CPU time, but now with multi-core and hyperthreading, so many threads can be done at once that maybe speeding things up by branch prediction doesn't have as big of an impact in terms of human interaction as it once did.
Intel has been lowering its CPU speeds as it adds cores to keep the thermal envelope low -- especially in laptops. It's kind of an admission that multi-core is more important than core speed. But, if disabling branching has the same affect on speed as lowering the clock speed on a branch-enabled CPU, then... I just wonder if maybe disabling it altogether for security reasons would be a better path until we can fix the architectural issues. Seems these "garbage patches" are causing instabilities & many systems need a BIOS update to go with a micro-code update... and manufacturers loathe to update any BIOS for systems more than a year or so old.
I have a friend purchasing a 12 core i9 (24 threads) with 32 GB of RAM next month... and I'm just thinking... Would this guy even notice if branch speculation were disabled?!?!? The base frequency is 2.90 GHz, the Turbo is 4.30 GHz. Assuming the biggest hit was 20%, that still gives the Turbo speed of 3.44 Ghz... and the system might spend more time at a higher frequency than the base to offset the performance hit.
Now, I'm not saying we should kill branch prediction in future development, but we should probably re-evaluate how it's done if security is an issue. In the meantime, retpoline seems like a good trade-off & there are other good ideas. I would just like some data on what it would actually do in the "real world" if we shut off the insecure branch prediction completely... because I have a sneaky suspicion that unless one is working on heavily CPU-bound tasks, it wouldn't be noticeable to your average user. CAD workers, video transcoders, AI developers -- sure, they'd opt out b/c of the hit they'd take... but many might just prefer stability over crappy patches & not notice the hit at all.