"Beyond Stupid" Paranoid L1d Cache Flushing Looks Like It Will Try Again For Linux 5.15
This paranoid L1d cache flushing on context switch remains an opt-in feature and led by Amazon engineers. While frequently flushing the L1 data cache leads to significant performance implications, Amazon's motivation is over the increasing number of CPU vulnerabilities with the likes of the CVE-2020-0550 improper data forwarding vulnerability and others along with concerns over other yet-to-be-found vulnerabilities.
After Linus Torvalds dismissed the functionality last year, the L1d cache flushing patches were revised for better handling where some CPU cores may have SMT/HT disabled. This functionality also won't be available unless the kernel is booted with a special flag to enable it, while still needing to opt-in to the L1d flushing at context switch on a per-task basis via the prctl() interface. Further, the L1d flushing feature will be disabled for CPUs not affected by the Intel L1TF "Foreshadow" vulnerability. The software flushing of the L1d is no longer supported/used by this feature.
So in recap the current paranoid L1d flushing code will flush out the L1 data cache when a task is scheduled out and the incoming task is from a different process and only in cases where there is hardware-based L1d flushing available for vulnerable processors. The kernel must be booted with "l1d_flush=on" and then tasks can use PR_SPEC_L1D_FLUSH with prctl to enable the mitigation. By default there is no change to the kernel behavior.
The paranoid L1d flushing patches were queued up this morning via tip.git's x86/cpu branch which unless reverted in turn will be sent in for the Linux 5.15 merge window opening up around the start of September -- we'll see what Linus Torvalds thinks of the feature in its current form.