On Wed, Nov 24, 2021 at 12:39:00PM +0100, Jiri Olsa wrote: > On Thu, Nov 18, 2021 at 02:49:35PM -0800, Andrii Nakryiko wrote: > > On Thu, Nov 18, 2021 at 6:27 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote: > > > > > > On Wed, Nov 17, 2021 at 11:42:58AM -0800, Andrii Nakryiko wrote: > > > > On Wed, Nov 17, 2021 at 11:41 AM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote: > > > > > > > > > > According to [0], compilers sometimes might produce duplicate DWARF > > > > > definitions for exactly the same struct/union within the same > > > > > compilation unit (CU). We've had similar issues with identical arrays > > > > > and handled them with a similar workaround in 6b6e6b1d09aa ("libbpf: > > > > > Accomodate DWARF/compiler bug with duplicated identical arrays"). Do the > > > > > same for struct/union by ensuring that two structs/unions are exactly > > > > > the same, down to the integer values of field referenced type IDs. > > > > > > > > Jiri, can you please try this in your setup and see if that handles > > > > all situations or there are more complicated ones still. We'll need a > > > > test for more complicated ones in that case :( Thanks. > > > > > > it seems to help largely, but I still see few modules (67 out of 780) > > > that keep 'struct module' for some reason.. their struct module looks > > > completely the same as is in vmlinux > > > > Curious, what's the size of all the module BTFs now? > > sorry for delay, I was waiting for s390x server > > so with 'current' fedora kernel rawhide I'm getting slightly different > total size number than before, so something has changed after the merge > window.. > > however the increase with BTF enabled in modules is now from 16M to 18M, > so the BTF data adds just about 2M, which I think we can live with > > > And yes, please > > try to narrow down what is causing the bloat this time. I think this > > I'm on it I'm seeing vmlinux BTF having just FWD record for sctp_mib struct, while the kernel module has the full definition kernel: [2798] STRUCT 'netns_sctp' size=296 vlen=46 'sctp_statistics' type_id=2800 bits_offset=0 [2799] FWD 'sctp_mib' fwd_kind=struct [2800] PTR '(anon)' type_id=2799 module before dedup: [78928] STRUCT 'netns_sctp' size=296 vlen=46 'sctp_statistics' type_id=78930 bits_offset=0 [78929] STRUCT 'sctp_mib' size=272 vlen=1 'mibs' type_id=80518 bits_offset=0 [78930] PTR '(anon)' type_id=78929 this field is referenced from within 'struct module' so it won't match its kernel version and as a result extra 'struct module' stays in the module's BTF I'll need to check debuginfo/pahole if that FWD is correct, but I guess it's normal that some structs might end up unwinded only in modules and not necessarily in vmlinux jirka