All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
Cc: Yonghong Song <yhs@fb.com>,
	dwarves@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team@fb.com
Subject: Re: [PATCH dwarves v2 0/2] generate BTF_KIND_TAG types from DW_TAG_LLVM_annotation dwarf tags
Date: Mon, 27 Sep 2021 17:59:12 -0300	[thread overview]
Message-ID: <YVIwoJHMd0gkRf2O@kernel.org> (raw)
In-Reply-To: <YVIsKZTWlDugv3Yz@kernel.org>

Em Mon, Sep 27, 2021 at 05:40:09PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Sep 21, 2021 at 07:13:21PM -0700, Yonghong Song escreveu:
> > LLVM has implemented btf_tag attribute ([1]) which intended
> > to provide a "string" tag for struct/union or its member, var,
> > a func or its parameter. Such a "string" tag will be encoded
> > in dwarf. For non-BPF target like x86_64, pahole needs to
> > convert those dwarf btf_tag annotations to BTF so kernel
> > can utilize these "string" tags for bpf program verification, etc.
> >         
> > Patch 1 enhanced dwarf_loader to encode DW_TAG_LLVM_annotation
> > tags into internal data structure and Patch 2 will encode
> > such information to BTF with BTF_KIND_TAGs.
> > 
> >  [1] https://reviews.llvm.org/D106614
> 
> Applied both locally, now building HEAD llvm/clang to test everything,

⬢[acme@toolbox pahole]$ pahole -JV t.o
Found per-CPU symbol 'g' at address 0x0
Found 1 per-CPU variables!
Found 1 functions!
File t.o:
[1] INT int size=4 nr_bits=32 encoding=SIGNED
[2] PTR (anon) type_id=3
[3] STRUCT t size=8
	a type_id=1 bitfield_size=1 bits_offset=0
	b type_id=1 bitfield_size=0 bits_offset=32
[4] TAG tag1 type_id=3 component_idx=0
[5] TAG tag2 type_id=3 component_idx=1
[6] TAG tag1 type_id=3 component_idx=-1
[7] TAG tag2 type_id=3 component_idx=-1
[8] FUNC_PROTO (anon) return=1 args=(2 a1, 1 a2)
[9] FUNC foo type_id=8
[10] TAG tag2 type_id=9 component_idx=1
[11] TAG tag1 type_id=9 component_idx=-1
search cu 't.c' for percpu global variables.
Variable 'g' from CU 't.c' at address 0x0 encoded
[12] VAR g type=1 linkage=1
[13] TAG tag1 type_id=12 component_idx=-1
[14] DATASEC .data..percpu size=4 vlen=1
	type=12 offset=0 size=4
⬢[acme@toolbox pahole]$ pahole -JV --skip_encoding_btf_tag t.o
Found per-CPU symbol 'g' at address 0x0
Found 1 per-CPU variables!
Found 1 functions!
File t.o:
[1] INT int size=4 nr_bits=32 encoding=SIGNED
[2] PTR (anon) type_id=3
[3] STRUCT t size=8
	a type_id=1 bitfield_size=1 bits_offset=0
	b type_id=1 bitfield_size=0 bits_offset=32
[4] FUNC_PROTO (anon) return=1 args=(2 a1, 1 a2)
[5] FUNC foo type_id=4
search cu 't.c' for percpu global variables.
Variable 'g' from CU 't.c' at address 0x0 encoded
[6] VAR g type=1 linkage=1
[7] DATASEC .data..percpu size=4 vlen=1
	type=6 offset=0 size=4
⬢[acme@toolbox pahole]$ clang -v
clang version 14.0.0 (https://github.com/llvm/llvm-project f7e82e4fa849376ea9226220847a098dc92d74a0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/11
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/11
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
⬢[acme@toolbox pahole]$

And the usual:

⬢[acme@toolbox pahole]$ pahole -J vmlinux
⬢[acme@toolbox pahole]$ btfdiff vmlinux
⬢[acme@toolbox pahole]$

So applied, pushing out to the tmp.master branch so that libbpf's CI can
have a go at it, then after the next run I'll push to master, thanks!

- Arnaldo

      reply	other threads:[~2021-09-27 20:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22  2:13 [PATCH dwarves v2 0/2] generate BTF_KIND_TAG types from DW_TAG_LLVM_annotation dwarf tags Yonghong Song
2021-09-22  2:13 ` [PATCH dwarves v2 1/2] dwarf_loader: parse dwarf tag DW_TAG_LLVM_annotation Yonghong Song
2021-09-22  2:13 ` [PATCH dwarves v2 2/2] btf_encoder: generate BTF_KIND_TAG from llvm annotations Yonghong Song
2021-09-27 20:40 ` [PATCH dwarves v2 0/2] generate BTF_KIND_TAG types from DW_TAG_LLVM_annotation dwarf tags Arnaldo Carvalho de Melo
2021-09-27 20:59   ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YVIwoJHMd0gkRf2O@kernel.org \
    --to=acme@kernel.org \
    --cc=andrii@kernel.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dwarves@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.