Re: [PATCH bpf 1/4] libbpf: Adjust ring buffer size when probing ring buffer map

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

 



Hi,

On 11/12/2022 1:47 AM, sdf@xxxxxxxxxx wrote:
> On 11/11, Hou Tao wrote:
>> From: Hou Tao <houtao1@xxxxxxxxxx>
>
>> Adjusting the size of ring buffer when probing ring buffer map, else
>> the probe may fail on host with 64KB page size (e.g., an ARM64 host).
>
>> After the fix, the output of "bpftool feature" on above host will be
>> correct.
>
>> Before :
>>      eBPF map_type ringbuf is NOT available
>>      eBPF map_type user_ringbuf is NOT available
>
>> After :
>>      eBPF map_type ringbuf is available
>>      eBPF map_type user_ringbuf is available
>
>> Signed-off-by: Hou Tao <houtao1@xxxxxxxxxx>
>> ---
>>   tools/lib/bpf/libbpf.c          | 2 +-
>>   tools/lib/bpf/libbpf_internal.h | 2 ++
>>   tools/lib/bpf/libbpf_probes.c   | 2 +-
>>   3 files changed, 4 insertions(+), 2 deletions(-)
SNIP
>
>>   #endif /* __LIBBPF_LIBBPF_INTERNAL_H */
>> diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
>> index f3a8e8e74eb8..29a1db2645fd 100644
>> --- a/tools/lib/bpf/libbpf_probes.c
>> +++ b/tools/lib/bpf/libbpf_probes.c
>> @@ -234,7 +234,7 @@ static int probe_map_create(enum bpf_map_type map_type)
>>       case BPF_MAP_TYPE_USER_RINGBUF:
>>           key_size = 0;
>>           value_size = 0;
>> -        max_entries = 4096;
>> +        max_entries = adjust_ringbuf_sz(4096);
>
> Why not pass PAGE_SIZE directly here? Something like:
>
> max_entries = sysconf(_SC_PAGE_SIZE);
>
> ?
Good idea. Will do that in v2.
>
>>           break;
>>       case BPF_MAP_TYPE_STRUCT_OPS:
>>           /* we'll get -ENOTSUPP for invalid BTF type ID for struct_ops */
>> -- 
>> 2.29.2




[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