Em Sat, Mar 04, 2023 at 03:31:16AM +0200, Eduard Zingerman escreveu: > On Tue, 2023-02-28 at 17:24 -0300, Arnaldo Carvalho de Melo wrote: > > Em Thu, Feb 23, 2023 at 10:47:55PM +0200, Eduard Zingerman escreveu: > > > Hello Dwarves community, > > > > > > I have a set of changes that add support for "btf_type_tag" attached to the > > > hosting type, as discussed in [1]. I'd like to test these changes before > > > submitting via this mailing list. I have some local tests for the feature > > > itself and I checked that kernel build / BPF selftests work as expected. > > > Are there any additional tests I can run? > > > Maybe some manual testing procedures? > > > > You may want to test using 'btfdiff vmlinux' after encoding BTF from > > DWARF. > > Hi Arnaldo, > > Thank you for the recommendation. > > I've noticed that with my config this method might get a bit > non-deterministic because of the following two data structures: > > drivers/net/ethernet/intel/e1000/e1000_param.c: > struct e1000_option { > ... > union { > ... > struct { > int nr; > const struct e1000_opt_list { int i; char *str; } *p; > ^^^^^ > this const is not present below > } l; > } arg; > }; > > drivers/net/ethernet/intel/e1000e/param.c: > struct e1000_option { > ... > union { > ... > struct { > int nr; > struct e1000_opt_list { int i; char *str; } *p; > } l; > } arg; > }; > > Both are present in the BTF. Ok, and you are linking those two drivers statically, so it gets into vmlinux, which is something I had never tried. > As far as I understand, which one would be picked by > "pahole -F btf --sort" depends on exact order of types in the BTF, > because: > - `pahole.c:type__compare_members_types()` does not compare fields for > inline structures; > - `pahole.c:type__compare_members_types()` ignores qualifiers; > - hence, `pahole.c:resort_add()` considers these types identical. > > I can try to modify the comparison function to address both points > and thus generate both versions of the `struct e1000_option` in the output. > Is it worth doing? I think so, comparing what we get from DWARF with what we get from BTF showed to be useful so far, even with some insurmountable differences, those options in btfdiff to change the output. - Arnaldo