public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	David Faust <david.faust@oracle.com>,
	"Jose E. Marchesi" <jose.marchesi@oracle.com>,
	bpf <bpf@vger.kernel.org>,
	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,
	Arnaldo Carvalho de Melo <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, 28 Feb 2023 02:57:10 +0200	[thread overview]
Message-ID: <a6e526ec1408ec4c833b19f8d482ace57dc30c11.camel@gmail.com> (raw)
In-Reply-To: <CAEf4BzbGA=wSeoPpg+mKp-nh7qRPb6Bp+DfWgvSaWtPaWC7+nA@mail.gmail.com>

On Mon, 2023-02-27 at 16:45 -0800, Andrii Nakryiko wrote:
> On Mon, Feb 27, 2023 at 4:41 PM Eduard Zingerman <eddyz87@gmail.com> wrote:
> > 
> > On Mon, 2023-02-27 at 13:13 -0800, Andrii Nakryiko wrote:
> > > On Wed, Feb 22, 2023 at 11:51 AM Eduard Zingerman <eddyz87@gmail.com> wrote:
> > > > 
> > > > On Wed, 2023-02-22 at 10:11 -0800, Alexei Starovoitov wrote:
> > > > [...]
> > > > > > > > What do you think about something like "debug_type_tag" or
> > > > > > > > "debug_type_annotation" (and a similar update for the decl tags)?
> > > > > > > > The translation into BTF records would be the same, but the DWARF info
> > > > > > > > would stand on its own without being tied to BTF.
> > > > > > > > 
> > > > > > > > (Naming is a bit tricky since terms like 'tag' are already in use by
> > > > > > > > DWARF, e.g. "type tag" in the context of DWARF DIEs makes me think of
> > > > > > > > DW_TAG_xxxx_type...)
> > > > > > > > 
> > > > > > > > As far as I understand, early proposals for the tags were more generic
> > > > > > > > but the LLVM reviewers wished for something more specific due to the
> > > > > > > > relatively limited use of the tags at the time. Now that the tags and
> > > > > > > > their DWARF format have matured I think a good case can be made to
> > > > > > > > make these generic. We'd be happy to help push for such change.
> > > > > > > 
> > > > > > > On the other hand, BTF is a thing we are using this annotation for.
> > > > > > > Any other tool can reuse DW_TAG_LLVM_annotation, but it will need a
> > > > > > > way to distinguish it's annotations from BTF annotations. And this can
> > > > > > > be done by using a different DW_AT_name. So, it seems logical to
> > > > > > > retain "btf" in the DW_AT_name. What do you think?
> > > > > > 
> > > > > > OK I can understand keeping it BTF specific.
> > > > > > 
> > > > > > Other than that, I don't come up with any significantly different idea
> > > > > > than to use the ":v2" suffix, so let's go with "btf_type_tag:v2"?
> > > > > 
> > > > > I don't like v2 suffix either.
> > > > > Please come up with something else.
> > > > 
> > > > Nothing particularly good comes to mind:
> > > > - btf_type_tag:wrapper
> > > > - btf_type_tag:outer
> > > > - btf_type_tag:own
> > > > - exterior_btf_type_tag
> > > > - outer_btf_tag
> > > > - btf_type_prefix
> > > > - btf_type_qualifier (as in const/volatile)
> > > > 
> > > > Or might as well use btf_type_tag:gcc, as you suggested earlier,
> > > > but it is as confusing as the others.
> > > 
> > > btf.type_tag or btf:type_tag or btf/type_tag (you get the idea, it's
> > > "BTF scoped")?
> > 
> > `btf/type_tag` is nice but might be somewhat confusing when DWARF is inspected:
> > - both old-style and new-style tags would be present in DWARF for some
> >   time for backwards compatibility;
> > - old-style tag has name "btf_type_tag".
> 
> old-style tag will be deprecated and removed eventually, so I'd
> optimize for the new-style naming, as that's what we'll be dealing
> with the most going forward

I still think that presence of a literal string "bty_type_tag" might
make some grepping easier but whatever. If there are no further
objections I'll post the changes using "btf:type_tag" literal tomorrow.
Andrii, thanks for the input.

Thanks,
Eduard

> 
> > 
> > Thus, the following C code:
> > 
> >   #define __tag1 __attribute__((btf_type_tag("tag1")))
> >   #define __tag2 __attribute__((btf_type_tag("tag2")))
> > 
> >   int __tag1 * __tag2 g;
> > 
> > Would be encoded in DWARF as:
> > 
> >   0x29:   DW_TAG_pointer_type
> >             DW_AT_type      (0x35 "int")
> > 
> >   0x2e:     DW_TAG_LLVM_annotation
> >               DW_AT_name    ("btf/type_tag:")
> >               DW_AT_const_value     ("tag2")
> > 
> >   0x31:     DW_TAG_LLVM_annotation
> >               DW_AT_name    ("btf_type_tag")
> >               DW_AT_const_value     ("tag1")
> > 
> >   0x34:     NULL
> > 
> >   0x35:   DW_TAG_base_type
> >             DW_AT_name      ("int")
> >             DW_AT_encoding  (DW_ATE_signed)
> >             DW_AT_byte_size (0x04)
> > 
> >   0x39:     DW_TAG_LLVM_annotation
> >               DW_AT_name    ("btf/type_tag:")
> >               DW_AT_const_value     ("tag1")
> > 
> >   0x3c:     NULL
> > 
> > Which is not very helpful.
> > 
> > In my opinion "btf_type_tag:v2" is the least confusing option, but if
> > Alexei does not like it, let's use "btf_type_tag:parent" and move on.
> > 
> > Thanks,
> > Eduard
> > 


  reply	other threads:[~2023-02-28  0:57 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
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 [this message]
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=a6e526ec1408ec4c833b19f8d482ace57dc30c11.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=acme@redhat.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.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