aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/events/perf_event.h
diff options
context:
space:
mode:
authorSandipan Das <sandipan.das@amd.com>2022-08-11 17:59:58 +0530
committerPeter Zijlstra <peterz@infradead.org>2022-08-27 00:05:44 +0200
commitdf3e9612f758fb5f9c251cbe262e3c68ffe67b2c (patch)
tree332c39baad41b137a57aa1b0974fe41ca7ec00bb /arch/x86/events/perf_event.h
parentperf/x86/amd/lbr: Add LbrExtV2 software branch filter support (diff)
downloadlinux-dev-df3e9612f758fb5f9c251cbe262e3c68ffe67b2c.tar.xz
linux-dev-df3e9612f758fb5f9c251cbe262e3c68ffe67b2c.zip
perf/x86: Make branch classifier fusion-aware
With branch fusion and other optimizations, branch sampling hardware in some processors can report a branch from address that points to an instruction preceding the actual branch by several bytes. In such cases, the classifier cannot determine the branch type which leads to failures such as with the recently added test from commit b55878c90ab9 ("perf test: Add test for branch stack sampling"). Branch information is also easier to consume and annotate if branch from addresses always point to branch instructions. Add a new variant of the branch classifier that can account for instruction fusion. If fusion is expected and the current branch from address does not point to a branch instruction, it attempts to find the first branch within the next (MAX_INSN_SIZE - 1) bytes and if found, additionally provides the offset between the reported branch from address and the address of the expected branch instruction. Signed-off-by: Sandipan Das <sandipan.das@amd.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/b6bb0abaa8a54c0b6d716344700ee11a1793d709.1660211399.git.sandipan.das@amd.com
Diffstat (limited to 'arch/x86/events/perf_event.h')
-rw-r--r--arch/x86/events/perf_event.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
index 2de9cd66347e..93263b98cd6e 100644
--- a/arch/x86/events/perf_event.h
+++ b/arch/x86/events/perf_event.h
@@ -1271,6 +1271,8 @@ enum {
int common_branch_type(int type);
int branch_type(unsigned long from, unsigned long to, int abort);
+int branch_type_fused(unsigned long from, unsigned long to, int abort,
+ int *offset);
ssize_t x86_event_sysfs_show(char *page, u64 config, u64 event);
ssize_t intel_event_sysfs_show(char *page, u64 config);