This is an archive of the discontinued LLVM Phabricator instance.

[x86][seses] No lfences in bb w/ 1 load and 0 stores
AcceptedPublic

Authored by zbrid on Mar 10 2020, 10:12 AM.

Details

Summary

Add a flag to the x86 Speculative Execution Side Effect Suppression Pass
that allows users to turn off adding LFENCEs in basic blocks with a
single load and no stores.

This is a part of a set of flags that can be used to experiment with
optimizing this mitigation for Load Value Injection.

One pager on Load Value Injection:
https://software.intel.com/security-software-guidance/software-guidance/load-value-injection

Deep dive on Load Value Injection:
https://software.intel.com/security-software-guidance/insights/deep-dive-load-value-injection

Results of performance testing

I ran the BoringSSL benchmarks which run many cryptographic operations
and reports the number of operations per second completed in a given
time.

Modified Mitigation vs Baseline
Geometric mean
0.073 (This can be read as the geomean ops/s of the mitigated program
was 7.3% of the ops/s of the unmitigated program. Similar below.)
Minimum
0.041
Quartile 1
0.060
Median
0.064
Quartile 3
0.081
Maximum
0.232

Fully Mitigated vs Baseline
Geometric mean
0.071
Minimum
0.041
Quartile 1
0.060
Median
0.063
Quartile 3
0.077
Maximum
0.230

Diff Detail

Event Timeline

zbrid created this revision.Mar 10 2020, 10:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2020, 10:12 AM

Thanks!

Please wait for a stamp from another reviewer here, too.

llvm/lib/Target/X86/X86SpeculativeExecutionSideEffectSuppression.cpp
59

nit: 80cols please

100–101

nit: please remove this blank line

104

clang-format this patch please (the & should be near the MI)

llvm/test/CodeGen/X86/speculative-execution-side-effect-suppression-omit-lfence-in-bb-with-one-load-no-stores.ll
26

same "please consider using -NEXT if you want to match adjacent lines" comment as D75941

This revision is now accepted and ready to land.Mar 10 2020, 5:41 PM
zbrid updated this revision to Diff 250102.Mar 12 2020, 4:53 PM
zbrid marked 4 inline comments as done.
  • Update tests to use CHECK-NEXT
  • ClangFormat/nits
zbrid added a comment.Mar 12 2020, 4:54 PM

Updated based on comments. Sorry about all the nits/unClangFormatted stuff. I'll do better with that next time. Thanks for the review!

xbolva00 added inline comments.
llvm/test/CodeGen/X86/speculative-execution-side-effect-suppression-omit-lfence-in-bb-with-one-load-no-stores.ll
26

Or use update_llc_checks.py regenerate test checks