[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQLL=enrrKixJRU=a6daGmj9TEKs-Qjx6yFRNusZPeRJHQ@mail.gmail.com>
Date: Fri, 29 Mar 2019 12:13:45 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Yonghong Song <yhs@...com>
Cc: bpf <bpf@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next] [tools/bpf] add bpffs multi-dimensional array
tests in test_btf
On Thu, Mar 28, 2019 at 10:32 PM Yonghong Song <yhs@...com> wrote:
>
> For multiple dimensional arrays like below,
> int a[2][3]
> both llvm and pahole generated one BTF_KIND_ARRAY type like
> . element_type: int
> . index_type: unsigned int
> . number of elements: 6
>
> Such a collapsed BTF_KIND_ARRAY type will cause the divergence
> in BTF vs. the user code. In the compile-once-run-everywhere
> project, the header file is generated from BTF and used for bpf
> program, and the definition in the header file will be different
> from what user expects.
>
> But the kernel actually supports chained multi-dimensional array
> types properly. The above "int a[2][3]" can be represented as
> Type #n:
> . element_type: int
> . index_type: unsigned int
> . number of elements: 3
> Type #(n+1):
> . element_type: type #n
> . index_type: unsigned int
> . number of elements: 2
>
> The following llvm commit
> https://reviews.llvm.org/rL357215
> also enables llvm to generated proper chained multi-dimensional arrays.
>
> The test_btf already has a raw test ("struct test #1") for chained
> multi-dimensional arrays. This patch added amended bpffs test for
> chained multi-dimensional arrays.
>
> Acked-by: Martin KaFai Lau <kafai@...com>
> Signed-off-by: Yonghong Song <yhs@...com>
Applied. Thanks
Powered by blists - more mailing lists