This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Improve Linux Kernel ORC reader
ClosedPublic

Authored by maksfb on Jul 19 2023, 5:25 PM.

Details

Summary
  • Sort ORC entries in the internal table. Older Linux kernels did not sort them in the file (only during boot time).
  • Add an option to dump sorted ORC tables (--dump-orc).
  • Associate entries in the internal ORC table with a BinaryFunction even when we are not changing the function.
  • If the function doesn't have ORC entry at the start, propagate ORC state from a previous entry.

Diff Detail

Event Timeline

maksfb created this revision.Jul 19 2023, 5:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2023, 5:25 PM
Herald added a subscriber: mgrang. · View Herald Transcript
maksfb requested review of this revision.Jul 19 2023, 5:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2023, 5:25 PM
Amir added a comment.Jul 19 2023, 8:20 PM

LG, but can we have some tests? Is it possible to add ORC information using assembly directives?

maksfb updated this revision to Diff 542679.Jul 20 2023, 2:39 PM

Add test case.

Amir accepted this revision.Jul 20 2023, 5:34 PM

Wow, ORC encoding is this simple.

bolt/lib/Rewrite/LinuxKernelRewriter.cpp
595

My understanding is this is optimized encoding (skipping redundant entries). I don't see that the test covers that – can you add a test for it?

This revision is now accepted and ready to land.Jul 20 2023, 5:34 PM

Wow, ORC encoding is this simple.

From https://www.kernel.org/doc/html/next/x86/orc-unwinder.html:

"Orcs, fearsome creatures of medieval folklore, are the Dwarves’ natural enemies. Similarly, the ORC unwinder was created in opposition to the complexity and slowness of DWARF."

maksfb updated this revision to Diff 542741.Jul 20 2023, 7:04 PM
maksfb retitled this revision from [BOLT] Improve Linux ORC reader to [BOLT] Improve Linux Kernel ORC reader.

Add test case covering propagation of ORC info form another function.

maksfb marked an inline comment as done.Jul 20 2023, 7:04 PM
This revision was landed with ongoing or failed builds.Jul 20 2023, 7:06 PM
This revision was automatically updated to reflect the committed changes.