On 31/07/2024 19:12, Arnaldo Carvalho de Melo wrote: > On Wed, Jul 31, 2024 at 06:43:51PM +0100, Alan Maguire wrote: >> >> >> On 31/07/2024 14:26, Arnaldo Carvalho de Melo wrote: >>> On Wed, Jul 31, 2024 at 09:57:25AM +0100, Alan Maguire wrote: >>>> On 30/07/2024 23:43, Matthew Maurer wrote: >>>>> Without this, even with `--lang_exclude=rust` set, running on `vmlinux` >>>>> with `CONFIG_RUST` enabled will lead to errors like: >>>>> die__process_function: tag not supported 0x2f (template_type_parameter)! >>>>> because the filtering doesn't happen until finalization, but unsupported >>>>> tags are reported during loading. >>>>> >>>>> As an added bonus, this should speed up processing of large objects with >>>>> filtered CUs, as their details will no longer be walked. >>>>> >>>> >>>> One question on this; if we are always doing early filtering like this, >>>> should the explicit cu__filter() call be removed from pahole_stealer()? >>> >>> When I saw the introduction of an extra callback to be used inside the >>> dwarf_loader I thought that it would be used only for this specific >>> language filtering feature, i.e. a defensive approach at implementing >>> this to avoid unintended side effects of doing all filtering at that >>> point, maybe some other feature somehow depends on the cu__filter() >>> being called where it was so far. >>> >>> But then it is being used for all filtering, so it seems just a way to >>> reduce the patch size... >>> >>> So I'd keep the cu->early_cu_filter() but would use it only for the >>> language filtering feature, wdyt? >> >> So if I understand correctly, >> >> if (languages.exclude) >> conf_load.early_cu_filter = cu__filter; >> >> ? Seems reasonable to me. Thanks! > > yeah, you got it. So this new early filtering is done for the feature we > have at hand and if other uses of cu__filter() already in place need, we > can transition to this new mechanism that reuses the cu__filter() > function signature/semantics. > Sounds good! Matthew, can you send a v2 with the above change? It should still cover us for BTF generation in the kernel case since we always --lang_exclude rust as long as pahole is recent enough.