WSL2-Linux-Kernel/arch
Song Liu c22ac2a3d4 perf: Enable branch record for software events
The typical way to access branch record (e.g. Intel LBR) is via hardware
perf_event. For CPUs with FREEZE_LBRS_ON_PMI support, PMI could capture
reliable LBR. On the other hand, LBR could also be useful in non-PMI
scenario. For example, in kretprobe or bpf fexit program, LBR could
provide a lot of information on what happened with the function. Add API
to use branch record for software use.

Note that, when the software event triggers, it is necessary to stop the
branch record hardware asap. Therefore, static_call is used to remove some
branch instructions in this process.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/bpf/20210910183352.3151445-2-songliubraving@fb.com
2021-09-13 10:53:50 -07:00
..
alpha Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
arc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
arm Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
arm64 Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
csky Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
h8300 asm-generic changes for 5.15 2021-09-01 15:13:02 -07:00
hexagon Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
ia64 Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
m68k Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
microblaze Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
mips Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
nds32 Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
nios2 Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
openrisc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
parisc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
powerpc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
riscv Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
s390 Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
sh Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
sparc Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
um Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
x86 perf: Enable branch record for software events 2021-09-13 10:53:50 -07:00
xtensa Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
.gitignore
Kconfig Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00