commit | 9c1f41ca655d33a4897b1cf2a798284b4795b3c4 | [log] [tgz] |
---|---|---|
author | Venkatesh Srinivas <venkateshs@google.com> | Tue Oct 27 15:54:16 2020 +0000 |
committer | CQ Bot <commit-bot@chromium.org> | Tue Oct 27 15:54:16 2020 +0000 |
tree | d75cabbcbfff641132c0866d3b230d239eb0b736 | |
parent | 5f5abb149735c201fc72b7adb5609174d95a9b44 [diff] |
[kernel][x86] Mitigate Intel Skylake Jcc errata Intel Skylake and Skylake-derived cores have an errata that cause them to mis-execute control transfer instructions when the instruction ends on or crosses 32-byte boundaries and the instructions are executed from the Decode Stream Buffer (DSB). All control transfer instructions are affected, including macro-fused arithmetic + Jcc instructions that span a boundary. Updated microcode has been released, but it comes with a performance penalty. To avoid the performance penalty and to avoid the errata where the update is not yet loaded, prevent the compiler from emitting jumps that would cause the errata. For more details: * https://www.intel.com/content/dam/support/us/en/documents/processors/mitigations-jump-conditional-code-erratum.pdf * https://access.redhat.com/solutions/2019-microcode-nov This CR only covers the kernel; userland will need to be recompiled to avoid the errata or performance impact there. Tested: 0) Compared text size before / after. This increases .text by 55 KB: readelf -t out/default.zircon/kernel-x64-clang/obj/kernel/zircon.elf before: [ 4] .text PROGBITS ffffffff80101170 0000000000002170 0 0000000000190140 0000000000000000 0 16 [0000000000000006]: ALLOC, EXEC after: [ 4] .text PROGBITS ffffffff80101180 0000000000002180 0 000000000019daf0 0000000000000000 0 32 [0000000000000006]: ALLOC, EXEC 1) Booted on AMD Family 15h; kernel still boots 2) Booted on Intel Skylake-U (Core i5-6260U) Tested microcode 0xd6 (Jcc fix, no alignment) vs. 0xd6 (Jcc fix, alignment): 780 test cases in total 775 test cases had no significant difference (no_sig_diff) 4 test cases got faster 1 test case got slower 0 test cases added 0 test cases removed Vmo/Clone/ReadCloneAll/512kbytes.clone faster 0.609-0.984 2314 +/- 380 ns 1772 +/- 130 ns Vmo/Clone/ReadCloneAll/512kbytes.close faster 0.611-0.939 2208 +/- 298 ns 1662 +/- 131 ns Vmo/Clone/ReadCloneSome/2048kbytes.close faster 0.567-0.995 2066 +/- 307 ns 1548 +/- 202 ns Vmo/Clone/ReadOrigAll/512kbytes.close faster 0.549-0.995 2272 +/- 474 ns 1648 +/- 140 ns https://docs.google.com/spreadsheets/d/1FJQ4trU8uJT65Zz7ljMriEhGC-6eCWTSKz6KQIIVvm0/ This is how much performance the s/w fix recovers; it is quite substantial on a handful of tests. 3) Booted on AMD Zen (R7 1700), perfcompare: Summary counts: 792 test cases in total 772 test cases had no significant difference (no_sig_diff) 9 test cases got faster 11 test cases got slower 0 test cases added 0 test cases removed https://docs.google.com/spreadsheets/d/1FJQ4trU8uJT65Zz7ljMriEhGC-6eCWTSKz6KQIIVvm0/ See page two - some tests are slightly affected positively, some slightly negatively. Largest factor change range was 1.071 - 1.114. Bug: 44204 Consider building fuchsia w/ 32-byte Jcc fix Change-Id: I34a558e9f20818c04c20c32c05767326be07cf7d Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/362255 Commit-Queue: Venkatesh Srinivas <venkateshs@google.com> Reviewed-by: Roland McGrath <mcgrathr@google.com> Testability-Review: Roland McGrath <mcgrathr@google.com>
Pink + Purple == Fuchsia (a new operating system)
Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.
Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.
Read more about Fuchsia's principles.
See Getting Started.
See fuchsia.dev.