Re: BTF tag support in DWARF (notes for today's BPF Office Hours)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2023-02-27 at 16:45 -0800, Andrii Nakryiko wrote:
> On Mon, Feb 27, 2023 at 4:41 PM Eduard Zingerman <eddyz87@xxxxxxxxx> 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@xxxxxxxxx> 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
> > 





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux