public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>, bpf@vger.kernel.org
Cc: david.faust@oracle.com,
	James Hilliard <james.hilliard1@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	David Malcolm <dmalcolm@redhat.com>,
	Julia Lawall <julia.lawall@inria.fr>,
	elena.zannoni@oracle.com, acme@redhat.com,
	Yonghong Song <yhs@fb.com>, Mykola Lysenko <mykolal@fb.com>
Subject: Re: BTF tag support in DWARF (notes for today's BPF Office Hours)
Date: Tue, 21 Feb 2023 01:42:40 +0200	[thread overview]
Message-ID: <e783fb7cdfb7bfd40e723c67daab7c5f81d12fbf.camel@gmail.com> (raw)
In-Reply-To: <877cy0j0kt.fsf@oracle.com>

On Thu, 2023-01-05 at 19:30 +0100, Jose E. Marchesi wrote:
> We agreed in the meeting to implement Solution 2 below in both GCC and
> clang.
> 
> The DW_TAG_LLVM_annotation DIE number will be changed in order to make
> it possible for pahole to handle the current tags.  The number of the
> new tag will be shared by both GCC and clang.
> 
> Thanks everyone for the feedback.
> 
[...]

Hi Jose, David,

Recently I've been working on implementation of the agreed btf_type_tag
encoding scheme for clang [1] and pahole [2]. While working on this, I came
to a conclusion that instead of introducing new DWARF tag (0x6001) we can
reuse the same tag (0x6000), but have a different DW_AT_name field:
"btf_type_tag:v2" instead of "btf_type_tag".

For example, the following C code:

    struct st {
      int __attribute__((btf_type_tag("a"))) a;
    } g;

Produces the following DWARF when [1] is used:

0x00000029:   DW_TAG_structure_type
                DW_AT_name      ("st")
                ...

0x0000002e:     DW_TAG_member
                  DW_AT_name    ("a")
                  DW_AT_type    (0x00000038 "int")
                ...

0x00000038:   DW_TAG_base_type
                DW_AT_name      ("int")
                ...

0x0000003c:     DW_TAG_LLVM_annotation
                  DW_AT_name    ("btf_type_tag:v2")
                  DW_AT_const_value     ("a")

I think that this is a tad better than abandoning 0x6000 tag because of
two reasons:
- tag numbers are a limited resource;
- might simplify discussion with upstream.

(It also makes some implementation details a bit simpler, but this is not
 very significant).

What do you think?

Both [1] and [2] are in a workable state, but [2] lacks support for
subroutine types and "void *" for now. If you are onboard with this change
I'll proceed with finalizing [1] and [2]. (Also, ":v2" suffix might be not
the best, I'm open to naming suggestions).

As a somewhat orthogonal question, would it be possible for you to use the
same 0x6000 tag on GCC side? I looked at master branch of [3] but can't
find any mentions of btf_type_tag.

Thanks,
Eduard

[1] https://reviews.llvm.org/D143967
[2] https://github.com/eddyz87/dwarves/tree/btf-type-tag-v2
[3] git://gcc.gnu.org/git/gcc.git

  parent reply	other threads:[~2023-02-20 23:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 11:37 BTF tag support in DWARF (notes for today's BPF Office Hours) Jose E. Marchesi
2023-01-05 18:30 ` Jose E. Marchesi
2023-01-22 17:53   ` Yonghong Song
2023-01-23 15:50     ` Jose E. Marchesi
2023-01-23 18:43       ` David Faust
2023-01-24  7:37         ` Yonghong Song
2023-02-20 23:42   ` Eduard Zingerman [this message]
2023-02-21 19:38     ` David Faust
2023-02-21 22:57       ` Eduard Zingerman
2023-02-22 18:03         ` David Faust
2023-02-22 18:11           ` Alexei Starovoitov
2023-02-22 19:43             ` Eduard Zingerman
2023-02-27 21:13               ` Andrii Nakryiko
2023-02-28  0:41                 ` Eduard Zingerman
2023-02-28  0:45                   ` Andrii Nakryiko
2023-02-28  0:57                     ` Eduard Zingerman
2023-02-28  2:44                       ` Alexei Starovoitov
2023-02-28  5:28                         ` Andrii Nakryiko
2023-02-28  6:53                           ` Alexei Starovoitov

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=e783fb7cdfb7bfd40e723c67daab7c5f81d12fbf.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=acme@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=david.faust@oracle.com \
    --cc=dmalcolm@redhat.com \
    --cc=elena.zannoni@oracle.com \
    --cc=james.hilliard1@gmail.com \
    --cc=jose.marchesi@oracle.com \
    --cc=julia.lawall@inria.fr \
    --cc=mykolal@fb.com \
    --cc=ndesaulniers@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox