public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: andrii.nakryiko@gmail.com, jolsa@kernel.org, ast@kernel.org,
	daniel@iogearbox.net, eddyz87@gmail.com, martin.lau@linux.dev,
	song@kernel.org, yhs@fb.com, john.fastabend@gmail.com,
	kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
	mykolal@fb.com, bpf@vger.kernel.org
Subject: Re: [PATCH v4 dwarves 0/5] pahole, btf_encoder: support --btf_features
Date: Wed, 25 Oct 2023 15:12:48 -0300	[thread overview]
Message-ID: <ZTlaoGDkALO2h95p@kernel.org> (raw)
In-Reply-To: <ZTlVAtFw7oKaFrvl@kernel.org>

Em Wed, Oct 25, 2023 at 02:48:50PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Oct 25, 2023 at 02:43:02PM -0300, Arnaldo Carvalho de Melo escreveu:
> > But 'bpftool bpf' doesn't like it:
>  
> >   $ bpftool btf dump file vmlinux.v5.19.0-rc5+.enum64 raw
> >   Error: failed to load BTF from vmlinux.v5.19.0-rc5+.enum64: Invalid argument
> >   $
>  
> > But it doesn't like it even when not using --btf_features :-\
> > 
> >   $ cp vmlinux.v5.19.0-rc5+ vmlinux.v5.19.0-rc5+.default_btf_encode ; pahole --btf_encode vmlinux.v5.19.0-rc5+.default_btf_encode
> >   $ bpftool btf dump file vmlinux.v5.19.0-rc5+.default_btf_encode raw | wc -l
> >   Error: failed to load BTF from vmlinux.v5.19.0-rc5+.default_btf_encode: Invalid argument
> >   0
> >   $ 
>  
> > I'll try to root cause this problem...
> 
> Random old bpftool on this notebook was the cause, nevermind, I'm back
> testing this, sorry for the noise :-)

Now things look better:

$ cp vmlinux.v5.19.0-rc5+ vmlinux.v5.19.0-rc5+.default_btf_encode ; pahole --btf_encode vmlinux.v5.19.0-rc5+.default_btf_encode
$ cp vmlinux.v5.19.0-rc5+ vmlinux.v5.19.0-rc5+.enum64 ; pahole --btf_encode --btf_features=enum64 vmlinux.v5.19.0-rc5+.enum64
$ bpftool btf dump file vmlinux.v5.19.0-rc5+.enum64 format raw > vmlinux.v5.19.0-rc5+.dump.enum64
$ bpftool btf dump file vmlinux.v5.19.0-rc5+.default_btf_encode format raw > vmlinux.v5.19.0-rc5+.dump.original.default_btf_encode
$ grep '^\[' vmlinux.v5.19.0-rc5+.dump.enum64 | cut -d ' ' -f 2 | sort | uniq -c | sort -k2 > enum64
$ grep '^\[' vmlinux.v5.19.0-rc5+.dump.original.default_btf_encode | cut -d ' ' -f 2 | sort | uniq -c | sort -k2 > original.default_btf_encode
$
$ diff -u original.default_btf_encode enum64
--- original.default_btf_encode	2023-10-25 14:56:45.027645981 -0300
+++ enum64	2023-10-25 14:54:15.024317995 -0300
@@ -1,6 +1,5 @@
    3677 ARRAY
    3362 CONST
-      1 DATASEC
    2109 ENUM
      11 ENUM64
   54147 FUNC
@@ -12,5 +11,4 @@
   10788 STRUCT
    2394 TYPEDEF
    1806 UNION
-    386 VAR
      23 VOLATILE
$

Now with just "var"

$ cp vmlinux.v5.19.0-rc5+ vmlinux.v5.19.0-rc5+.var ; pahole --btf_encode --btf_features=var vmlinux.v5.19.0-rc5+.var
$ bpftool btf dump file vmlinux.v5.19.0-rc5+.var format raw > vmlinux.v5.19.0-rc5+.dump.var
$ grep '^\[' vmlinux.v5.19.0-rc5+.dump.var | cut -d ' ' -f 2 | sort | uniq -c | sort -k2 > var
$ diff -u original.default_btf_encode var
--- original.default_btf_encode	2023-10-25 14:56:45.027645981 -0300
+++ var	2023-10-25 15:04:24.231228667 -0300
@@ -1,8 +1,7 @@
    3677 ARRAY
    3362 CONST
       1 DATASEC
-   2109 ENUM
-     11 ENUM64
+   2120 ENUM
   54147 FUNC
   29055 FUNC_PROTO
     111 FWD
$

vars/datasecs are not removed and enum64 is not encoded, remaining as
enum, so adding the 11 enum64 to the 2109 enums to get 2120 enums.

$ cp vmlinux.v5.19.0-rc5+ vmlinux.v5.19.0-rc5+.float ; pahole --btf_encode --btf_features=float vmlinux.v5.19.0-rc5+.float
$ bpftool btf dump file vmlinux.v5.19.0-rc5+.float format raw > vmlinux.v5.19.0-rc5+.dump.float
$ grep '^\[' vmlinux.v5.19.0-rc5+.dump.float | cut -d ' ' -f 2 | sort | uniq -c | sort -k2 > float
$ diff -u original.default_btf_encode float
--- original.default_btf_encode	2023-10-25 14:56:45.027645981 -0300
+++ float	2023-10-25 15:06:57.441315272 -0300
@@ -1,16 +1,14 @@
    3677 ARRAY
    3362 CONST
-      1 DATASEC
-   2109 ENUM
-     11 ENUM64
+   2120 ENUM
+      2 FLOAT
   54147 FUNC
   29055 FUNC_PROTO
     111 FWD
-     17 INT
+     15 INT
   15345 PTR
       4 RESTRICT
   10788 STRUCT
    2394 TYPEDEF
    1806 UNION
-    386 VAR
      23 VOLATILE
$

vars/datasecs are gone, enums combined, and floats are produced out of ints.

I'll try to script all this so that we we can have it in btfdiff or
another script to compare BTF from two files and then use in another
script to check that the differences are the ones expected for the
combinations of btf_features.

But I guess the acks/reviews + my tests are enough to merge this as-is,
thanks for your work on this!

- Arnaldo

  reply	other threads:[~2023-10-25 18:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23  9:57 [PATCH v4 dwarves 0/5] pahole, btf_encoder: support --btf_features Alan Maguire
2023-10-23  9:57 ` [PATCH v4 dwarves 1/5] btf_encoder, pahole: move btf encoding options into conf_load Alan Maguire
2023-10-23  9:57 ` [PATCH v4 dwarves 2/5] dwarves: move ARRAY_SIZE() to dwarves.h Alan Maguire
2023-10-23  9:57 ` [PATCH v4 dwarves 3/5] pahole: add --btf_features support Alan Maguire
2023-10-23  9:57 ` [PATCH v4 dwarves 4/5] pahole: add --supported_btf_features Alan Maguire
2023-10-23  9:57 ` [PATCH v4 dwarves 5/5] pahole: add --btf_features_strict to reject unknown BTF features Alan Maguire
2023-10-25 17:43 ` [PATCH v4 dwarves 0/5] pahole, btf_encoder: support --btf_features Arnaldo Carvalho de Melo
2023-10-25 17:48   ` Arnaldo Carvalho de Melo
2023-10-25 18:12     ` Arnaldo Carvalho de Melo [this message]
2023-10-25 18:30       ` Arnaldo Carvalho de Melo
2023-10-25 22:28         ` Eduard Zingerman
2023-10-26 22:06           ` Andrii Nakryiko
2023-10-27 13:25             ` Arnaldo Carvalho de Melo
2023-10-27 14:24             ` RCU stall issues in bpf-next (was: Re: [PATCH v4 dwarves 0/5] pahole, btf_encoder: support --btf_features) Alan Maguire
2023-10-27 19:54               ` Jiri Olsa
2023-10-25 18:18   ` [PATCH v4 dwarves 0/5] pahole, btf_encoder: support --btf_features Arnaldo Carvalho de Melo

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=ZTlaoGDkALO2h95p@kernel.org \
    --to=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --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