Commit Graph

9 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo 92a4118812 v1.13: New release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-16 16:13:19 -03:00
Arnaldo Carvalho de Melo 9a4d719304 fprintf: Allow suppressing the inferred __attribute__((__packed__))
We use things like DW_AT_alignment, so not all of those attributes are
inferred by formats like BTF that lack that info, allow suppressing the
output and make btfdiff ask for both DWARF and BTF output to have this
suppressed.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-15 15:01:53 -03:00
Arnaldo Carvalho de Melo ec935ee422 fprintf: Allow suppressing the output of force paddings at the end of structs
Things like 'struct timex' in the linux kernel led to this output:

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-15 14:45:29 -03:00
Arnaldo Carvalho de Melo 52d1c75ea4 btfdiff: Use --suppress_aligned_attribute with -F dwarf
Now that we collect DWARF5's DW_AT_alignent, btdiff shows, for instance:

  $ btfdiff examples/tcp.o
  <SNIP>
  @@ -13450,7 +13450,7 @@ struct ip6_flowlabel {
   	struct in6_addr            dst;                  /*    16    16 */
   	struct ipv6_txoptions *    opt;                  /*    32     8 */
   	long unsigned int          linger;               /*    40     8 */
  -	struct callback_head       rcu __attribute__((__aligned__(8)); /*    48    16 */
  +	struct callback_head       rcu;                  /*    48    16 */
   	/* --- cacheline 1 boundary (64 bytes) --- */
   	u8                         share;                /*    64     1 */

  @@ -13616,7 +13616,7 @@ struct fib6_node {
   	__u16                      fn_flags;             /*    42     2 */
   	int                        fn_sernum;            /*    44     4 */
   	struct fib6_info *         rr_ptr;               /*    48     8 */
  -	struct callback_head       rcu __attribute__((__aligned__(8)); /*    56    16 */
  +	struct callback_head       rcu;                  /*    56    16 */

   	/* size: 72, cachelines: 2, members: 10 */
   	/* last cacheline: 8 bytes */
  $

So ask for those attributes to be suppressed when comparing BTF and
DWARF output.

Cc: Alexei Starovoitov <ast@fb.com>
Cc: Andrii Nakryiko <andriin@fb.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Wielaard <mark@klomp.org>
Cc: Yonghong Song <yhs@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-03 18:10:16 -03:00
Andrii Nakryiko 6bcf0bd703 btfdiff: Support specifying custom pahole location
During development it's convenient to be able to specify custom location
of pahole binary, built locally.

E.g.:

  $ PAHOLE=~/local/pahole/build/pahole ./btfdiff /tmp/vmlinux4

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-22 18:06:27 -03:00
Arnaldo Carvalho de Melo 88028b5d0c btfdiff: Use --show_private_classes with DWARF
In DWARF we have the information if a struct/class is defined only
inside another struct/class or in a function, and then we consider those
to be 'private classes', requiring the use of --show_private_classes to
see those when asking for all structs.

That is not the case with BTF, that doesn't have that info and thus
shows all structs, private or not.

So, to compare the outputs in btfdiff we need to ask for
--show_private_classes when printing from DWARF.

With the Linux kernel vmlinux file the only private structure noticed
when not using this option, i.e. the only private class, as 'struct
sun_disklabel', defined in the block/partitions/sun.c file, inside the
'sun_partition' function.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-19 11:04:44 -03:00
Arnaldo Carvalho de Melo 5148be53dc btfdiff: Rename tmp files to contain the format used
So that one can comment the 'rm' line at the end to look at the files
further.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-18 11:05:29 -03:00
Arnaldo Carvalho de Melo 278b64c3ee btfdiff: Use diff's -p option to show the struct/union
To help in looking up the change and figure out its reason.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-01-17 10:07:13 -03:00
Arnaldo Carvalho de Melo 06e364bc62 btfdiff: Add utility to compare pahole output produced from DWARF and BTF
$ btfdiff
  Usage: btfdiff <filename_with_BTF_and_DWARF_info>
  $ btfdiff ~/git/build/v4.20-rc5+/net/ipv4/tcp.o
  --- /tmp/btfdiff.LRlcgc	2019-01-11 13:55:16.808989679 -0300
  +++ /tmp/btfdiff.SHuCev	2019-01-11 13:55:16.819989781 -0300
  @@ -585,11 +585,17 @@
   	__u16                      vesapm_off;           /*    48     2 */
   	__u16                      pages;                /*    50     2 */
   	__u16                      vesa_attributes;      /*    52     2 */
  -	__u32                      capabilities;         /*    54     4 */
  -	__u32                      ext_lfb_base;         /*    58     4 */
  +	__u32                      capabilities;         /*    52     4 */
  +	__u32                      ext_lfb_base;         /*    56     4 */
  +
  +	/* XXX 2 bytes hole, try to pack */
  +
   	__u8                       _reserved[2];         /*    62     2 */

   	/* size: 64, cachelines: 1, members: 36 */
  +	/* sum members: 60, holes: 1, sum holes: 2 */
  +
  +	/* BRAIN FART ALERT! 64 != 60 + 2(holes), diff = 2 */
   };
   struct apm_bios_info {
   	__u16                      version;              /*     0     2 */
  <SNIP>
  $

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-01-11 13:54:22 -03:00