Where can I find the map's BTF type key/value specification?

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

 



I'm looking for how BTF type definition '__type(key, int)' is being changed
to '__uint(key_size, sizeof(int))'. (Not exactly "changed" but wonder how
it can be considered the same)

    __uint(type, BPF_MAP_TYPE_ARRAY);
    __type(key, int);          => __uint(key_size, sizeof(int))
    __type(value, u32);    => __uint(value_size, sizeof(u32))
    __uint(max_entries, 2);

Whether the specific map type supports BTF or not can be inferred from
the file in kernel/bpf/*map.c and by checking each MAP type's
bpf_map_ops .map_check_btf pointer is initialized as map_check_no_btf.

But how can I figure out that specific types of map support BTF types for
key/value? And how can I determine how this BTF key/value type is
converted?

I am aware that BTF information is created in the form of a compact
type by using pahole to deduplicate repeated types, strings information
from DWARF information. However, looking at the *btf or pahole file
in dwarves repository, it seemed that it was not responsible for the
conversion of the BTF key/value.

The remaining guess is that LLVM's BPF target compiler is responsible
for this, or it's probably somewhere in the kernel, but I'm not sure
where it is.

--
Best,
Daniel T. Lee



[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