This is an archive of the discontinued LLVM Phabricator instance.

BPF: change BTF_KIND_TAG format
ClosedPublic

Authored by yonghong-song on Sep 9 2021, 6:41 PM.

Details

Summary

Previously we have the following binary representation:

struct bpf_type { name, info, type }
struct btf_tag { __u32 component_idx; }

If the tag points to a struct/union/var/func type, we will have

kflag = 1, component_idx = 0

if the tag points to struct/union member or func argument, we will have

kflag = 0, component_idx = 0, ..., vlen - 1

The above rather makes interface complex to have both kflag and
component needed to determine its legality and index.

This patch simplifies the interface by removing kflag involvement.

component_idx = (u32)-1 : tag pointing to a type
component_idx = 0 ... vlen - 1 : tag pointing to a member or argument

and kflag is always 0 and there is no need to check.

Diff Detail

Event Timeline

yonghong-song created this revision.Sep 9 2021, 6:41 PM
yonghong-song requested review of this revision.Sep 9 2021, 6:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2021, 6:41 PM
anakryiko accepted this revision.Sep 9 2021, 6:42 PM
This revision is now accepted and ready to land.Sep 9 2021, 6:42 PM
This revision was landed with ongoing or failed builds.Sep 9 2021, 7:05 PM
This revision was automatically updated to reflect the committed changes.