On 2026/1/10 00:24, Alexei Starovoitov wrote:
> On Fri, Jan 9, 2026 at 7:37 AM Leon Hwang <[email protected]> wrote:
>>
[...]
>> @@ -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