[PATCH] D104276: [CSSPGO][llvm-profgen] Ignore LBR records after interrup transition
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 15 12:32:24 PDT 2021
hoy added inline comments.
================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:460
+ // is likely due to interrupt which is usually unpaired. Ignore current
+ // and subsequent entries since they are likely from an unrelated
+ // pre-interrupt context.
----------------
wenlei wrote:
> What do you mean by unrelated pre-interrupt context? After interrupt is handled, execution is supposed to continue from the same spot. If we only missed one of the interrupt transition branch, the pre-interrupt IP should be right before the current IP. If that's not the case, then what's missing is more than a transition branch from the pair - it then sounds like the problem is LBR buffer is not being cleared on context switch.
Yes, LBR buffer is not cleared for all interrupts but task-scheduling interrupt. Interrupt does not reflect a normal execution flow. Pre-interrupt code and post-resume code should have the same context. For task-scheduling interrupt, the OS knows how to regroup them so that we have consistent execution flow in LBR for a single thread. Looks like it doesn't do that for other type of interrupts. We are working around here to break the LBR trace at the interrupt point.
On the second thought, we should also break at the resume point.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104276/new/
https://reviews.llvm.org/D104276
More information about the llvm-commits
mailing list