Re: [PATCH bpf-next 6/8] bpf: Add arch_bpf_trampoline_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Kuohai,

> On Sep 20, 2023, at 12:39 AM, Xu Kuohai <xukuohai@xxxxxxxxxx> wrote:
> 
> Hi Song,
> 
> On 9/20/2023 1:31 PM, Song Liu wrote:
>> This helper will be used to calculate the size of the trampoline before
>> allocating the memory.
>> Signed-off-by: Song Liu <song@xxxxxxxxxx>
>> ---
[...]
>> +
>> + nregs = btf_func_model_nregs(m);
>> + /* the first 8 registers are used for arguments */
>> + if (nregs > 8)
>> + return -ENOTSUPP;
>> +
>> + ret = arch_bpf_trampoline_size(m, flags, tlinks, func_addr);
>> + if (ret < 0)
>> + return ret;
> 
> Since arch_bpf_trampoline_size was already called before the trampoline
> image was allocated, it seems this call to arch_bpf_trampoline_size is
> unnecessary. If this call can be omitted, we can avoid one less dry run.

Indeed. This set doesn't call arch_bpf_trampoline_size() from struct_ops. 
But we can add that and then remove the _size() call here. 

Thanks,
Song

> 
>> +
>> + if (ret > ((long)image_end - (long)image))
>> + return -EFBIG;
>>     jit_fill_hole(image, (unsigned int)(image_end - image));
>>   ret = prepare_trampoline(&ctx, im, tlinks, func_addr, nregs, flags);
> 
> 
> [...]
> 





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux