Thread (8 messages) 8 messages, 3 authors, 2026-01-13

Re: [PATCH bpf-next 1/3] bpf, x64: Call perf_snapshot_branch_stack in trampoline

From: Leon Hwang <hidden>
Date: 2026-01-09 16:31:48
Also in: bpf, linux-kselftest, lkml, netdev


On 2026/1/10 00:24, Alexei Starovoitov wrote:
On Fri, Jan 9, 2026 at 7:37 AM Leon Hwang [off-list ref] wrote:
quoted
[...]
quoted
@@ -3366,6 +3416,14 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im

        save_args(m, &prog, regs_off, false, flags);

+       if (bpf_prog_copy_branch_snapshot(fentry)) {
+               /* Get branch snapshot asap. */
+               if (invoke_branch_snapshot(&prog, image, rw_image)) {
+                       ret = -EINVAL;
+                       goto cleanup;
+               }
+       }
Andrii already tried to do it.
I hated it back then and still hate the idea.
We're not going to add custom logic for one specific use case
no matter how appealing it sounds to save very limited LBR entries.
The HW will get better, but we will be stuck with this optimization forever.
Understood, thanks for the explanation.

I won’t pursue this approach further.

Thanks,
Leon
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help