BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: "Jose E. Marchesi" <jose.marchesi@oracle.com>,
	bpf@vger.kernel.org,
	 Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Yonghong Song <yonghong.song@linux.dev>,
	david.faust@oracle.com,  cupertino.miranda@oracle.com
Subject: Re: [RFC bpf-next] bpf: avoid clang-specific push/pop attribute pragmas in bpftool
Date: Sun, 05 May 2024 23:26:52 -0700	[thread overview]
Message-ID: <0f9e9023387c147e9362a45365d31ba69b0d1fc6.camel@gmail.com> (raw)
In-Reply-To: <CAEf4Bza5cmJK-+tK1QJ-SVUWmTOTOM_3gZQ=9yhynU5vE_wWyg@mail.gmail.com>

On Fri, 2024-05-03 at 15:14 -0700, Andrii Nakryiko wrote:
[...]

> With the decomposition into sort + emit string representation, it's
> now trivial to use in this flexible way.
> 
> Thoughts?

Compared to callbacks for attributes this adds the following:
- ability to filter-out some types;
- ability to add some pre-processor statements between specific types.

Compared to callbacks for attributes this lacks the following:
- ability to specify attributes for nested anonymous types
  (not important for preserve_access_index).

As I ranted in the off-list discussion, full flexibility is achievable
only with some kind of C AST:
- an API to produce such an AST;
- an API to modify AST where necessary;
- an API to serialize the AST as C code.

Adding such AST to libbpf is completely out of scope.

So, what we are left with is a set of half-measures:
1. a fixed attribute string as in Jose's patch;
2. a callback before printing attributes as suggested by me;
3. two API functions to get a sorted list of types and to print a type
   as suggested by Andrii.

And a set of use-cases:
a. capability to add some attribute for all structs;
b. capability to add some attribute for specific types;
c. capability to filter printed types.

(1) covers only (a);
(2) covers (a,b);
(3) covers (a,b,c).

Still, (3) has limited flexibility and I do not exclude the necessity
to add some sort of (2) in the future.

On the other hand, necessity to modify dump output arises not often,
so I think that (3) is preferable at the moment.

      parent reply	other threads:[~2024-05-06  6:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03 11:18 [RFC bpf-next] bpf: avoid clang-specific push/pop attribute pragmas in bpftool Jose E. Marchesi
2024-05-03 20:36 ` Eduard Zingerman
2024-05-03 21:18   ` Eduard Zingerman
2024-05-03 22:14     ` Andrii Nakryiko
2024-05-04 21:09       ` Jose E. Marchesi
2024-05-06 18:55         ` Eduard Zingerman
2024-05-06 19:10           ` Jose E. Marchesi
2024-05-06 21:35             ` Andrii Nakryiko
2024-05-06  6:26       ` Eduard Zingerman [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=0f9e9023387c147e9362a45365d31ba69b0d1fc6.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=cupertino.miranda@oracle.com \
    --cc=david.faust@oracle.com \
    --cc=jose.marchesi@oracle.com \
    --cc=yonghong.song@linux.dev \
    /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