LLVM Begins Landing Preliminary Patches Around Intel's JCC Erratum, GAS Support Landed
Written by Michael Larabel in Intel on 22 December 2019 at 03:40 AM EST. 6 Comments
INTEL --
Disclosed back in November was the Intel Jump Conditional Code (JCC) erratum affecting Skylake and newer CPUs that could lead to "unpredictable behavior" when jump instructions cross cache lines. Intel issued a CPU microcode update to address the problem at a performance cost, but with some compiler toolchain magic, it's possible to mitigate a good portion of that impact.

Intel had the GNU Assembler patches around JCC Erratum sent out and similarly work going on within the LLVM camp given its ever increasing usage. LLVM developers have been debating their own patches for helping to mitigate the JCC Erratum impact.

That LLVM debate is still ongoing but on Friday some preliminary work was merged in order to get the discussion moving forward. The initial patch landing in LLVM 10 explained:
WARNING: If you're looking at this patch because you're looking for a full performace mitigation of the Intel JCC Erratum, this is not it!

This is a preliminary patch on the patch towards mitigating the performance regressions caused by Intel's microcode update for Jump Conditional Code Erratum.

The patch adds the required assembler infrastructure and command line options needed to exercise the logic for INTERNAL TESTING. These are NOT public flags, and should not be used for anything other than LLVM's own testing/debugging purposes. They are likely to change both in spelling and meaning.

WARNING: This patch is knowingly incorrect in some cornercases. We need, and do not yet provide, a mechanism to selective enable/disable the padding. Conversation on this will continue in parallel with work on extending this infrastructure to support prefix padding.

The goal here is to have the assembler align specific instructions such that they neither cross or end at a 32 byte boundary.

So the flags aren't yet public and it's not yet stable, but it's a start and will hopefully move the discussion forward. Though in mid-January is the LLVM / Clang 10.0 feature freeze so hopefully the work can come together in time. The LLVM work continues to be discussed here.


In upstream Binutils, their JCC Erratum patches landed just over a week ago without much fanfare. The patches landed there though require setting -mbranches-within-32B-boundaries for the GNU Assembler (GAS) as it's not enabled by default. When it comes to the GNU toolchain support, the only Linux distribution I am aware of shipping with patched support to help offset that performance impact is Clear Linux where the mitigated behavior is applied by default.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week